source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230524193841_add_staff_picked_at_to_products_index.rb | Ruby | mit | 8,966 | main | 287 | # frozen_string_literal: true
class AddStaffPickedAtToProductsIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
staff_picked_at: { type: "date" }
}
}
)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121203174115_add_ip_state_country_to_purchases.rb | Ruby | mit | 8,966 | main | 209 | # frozen_string_literal: true
class AddIpStateCountryToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :ip_country, :string
add_column :purchases, :ip_state, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111220181954_remove_floats.rb | Ruby | mit | 8,966 | main | 723 | # frozen_string_literal: true
class RemoveFloats < ActiveRecord::Migration
def up
remove_column :links, :balance
remove_column :links, :price
remove_column :purchases, :price
add_column :users, :balance_cents, :integer, default: 0.0
User.find_each do |user|
user.balance_cents = user.balance... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150520200000_add_merchant_id_to_balances.rb | Ruby | mit | 8,966 | main | 577 | # frozen_string_literal: true
class AddMerchantIdToBalances < ActiveRecord::Migration
def up
add_column :balances, :merchant_account_id, :integer, default: MerchantAccount.gumroad(StripeChargeProcessor.charge_processor_id).id
add_index :balances, [:user_id, :merchant_account_id, :date], unique: true
remo... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230302132622_add_seller_id_to_refunds.rb | Ruby | mit | 8,966 | main | 756 | # frozen_string_literal: true
class AddSellerIdToRefunds < ActiveRecord::Migration[7.0]
def up
change_table :refunds, bulk: true do |t|
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :purchase_id, :bigint
t.change :refunding_user_id, :bigint
t.change :link... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120521221732_add_profile_guid_to_users.rb | Ruby | mit | 8,966 | main | 208 | # frozen_string_literal: true
class AddProfileGuidToUsers < ActiveRecord::Migration
def up
add_column :users, :profile_guid, :string
end
def down
remove_column :users, :profile_guid
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231128094242_change_payment_amount_cents_to_bigint.rb | Ruby | mit | 8,966 | main | 243 | # frozen_string_literal: true
class ChangePaymentAmountCentsToBigint < ActiveRecord::Migration[7.0]
def up
change_column :payments, :amount_cents, :bigint
end
def down
change_column :payments, :amount_cents, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140528153153_create_twitter_order.rb | Ruby | mit | 8,966 | main | 1,181 | # frozen_string_literal: true
class CreateTwitterOrder < ActiveRecord::Migration
def change
create_table :twitter_orders do |t|
t.references :purchase
t.string :twitter_order_id
t.integer :order_timestamp, limit: 8
t.string :stripe_transaction_id
t.integer :charge_amount_micro_curre... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150812000000_add_is_business_publicly_traded_to_user_compliance_info.rb | Ruby | mit | 8,966 | main | 211 | # frozen_string_literal: true
class AddIsBusinessPubliclyTradedToUserComplianceInfo < ActiveRecord::Migration
def change
add_column :user_compliance_info, :is_business_publicly_traded, :boolean
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201221053736_remove_some_fb_columns_from_user.rb | Ruby | mit | 8,966 | main | 353 | # frozen_string_literal: true
class RemoveSomeFbColumnsFromUser < ActiveRecord::Migration[6.0]
def up
change_table :users do |t|
t.remove :facebook_gender, :facebook_verified
end
end
def down
change_table :users do |t|
t.string :facebook_gender, limit: 255
t.string :facebook_verifi... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120928045005_create_events.rb | Ruby | mit | 8,966 | main | 1,589 | # frozen_string_literal: true
class CreateEvents < ActiveRecord::Migration
def change
create_table "events", force: true do |t|
t.integer "visit_id"
t.string "ip_address"
t.string "event_name"
t.integer "user_id"
t.integer "link_id"
t.datetime "created_at"
t.datet... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240218091437_add_seller_id_and_indexes_to_subscription_events.rb | Ruby | mit | 8,966 | main | 265 | # frozen_string_literal: true
class AddSellerIdAndIndexesToSubscriptionEvents < ActiveRecord::Migration[7.0]
def change
change_table :subscription_events, bulk: true do |t|
t.bigint :seller_id
t.index [:seller_id, :occurred_at]
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230327174823_create_admin_action_call_infos.rb | Ruby | mit | 8,966 | main | 395 | # frozen_string_literal: true
class CreateAdminActionCallInfos < ActiveRecord::Migration[7.0]
def change
create_table :admin_action_call_infos do |t|
t.string :controller_name, null: false
t.string :action_name, null: false
t.integer :call_count, default: 0, null: false
t.timestamps
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200927050534_sync_tables_default_charsets.rb | Ruby | mit | 8,966 | main | 6,139 | # frozen_string_literal: true
class SyncTablesDefaultCharsets < ActiveRecord::Migration[6.0]
def up
table_changes = {
"affiliate_credits" => "CHARACTER SET latin1",
"affiliate_partial_refunds" => "CHARACTER SET latin1",
"affiliates" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"affili... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151109202709_add_humanized_name_and_flag_to_tags.rb | Ruby | mit | 8,966 | main | 237 | # frozen_string_literal: true
class AddHumanizedNameAndFlagToTags < ActiveRecord::Migration
def change
add_column(:tags, :humanized_name, :string, length: 100)
add_column(:tags, :flagged_at, :datetime, default: nil)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150527232652_add_subscription_id_to_purchase_codes.rb | Ruby | mit | 8,966 | main | 226 | # frozen_string_literal: true
class AddSubscriptionIdToPurchaseCodes < ActiveRecord::Migration
def change
add_column :purchase_codes, :subscription_id, :integer
add_index :purchase_codes, :subscription_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20251124133549_add_abandoned_cart_indexes.rb | Ruby | mit | 8,966 | main | 246 | # frozen_string_literal: true
class AddAbandonedCartIndexes < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
add_index :carts, [:deleted_at, :updated_at]
add_index :cart_products, [:deleted_at, :cart_id]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211006125152_add_ancestry_to_comments.rb | Ruby | mit | 8,966 | main | 273 | # frozen_string_literal: true
class AddAncestryToComments < ActiveRecord::Migration[6.1]
def change
change_table :comments, bulk: true do |t|
t.string :ancestry
t.integer :ancestry_depth, default: 0, null: false
t.index :ancestry
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150721004604_add_purchase_id_to_purchase_codes.rb | Ruby | mit | 8,966 | main | 214 | # frozen_string_literal: true
class AddPurchaseIdToPurchaseCodes < ActiveRecord::Migration
def change
add_column :purchase_codes, :purchase_id, :integer
add_index :purchase_codes, :purchase_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220222192027_add_null_false_to_taxonomies_slug.rb | Ruby | mit | 8,966 | main | 768 | # frozen_string_literal: true
class AddNullFalseToTaxonomiesSlug < ActiveRecord::Migration[6.1]
def up
if Rails.env.development? && Taxonomy.where(slug: nil).exists?
raise <<~ERROR
Your database contains a Taxonomy without slug.
To fix it, run the script to fill the taxonomy slugs
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240422093212_create_wishlist_followers.rb | Ruby | mit | 8,966 | main | 305 | # frozen_string_literal: true
class CreateWishlistFollowers < ActiveRecord::Migration[7.1]
def change
create_table :wishlist_followers do |t|
t.belongs_to :wishlist, null: false
t.belongs_to :follower_user, null: false
t.datetime :deleted_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230606002249_add_taxonomy_id_to_purchase_index.rb | Ruby | mit | 8,966 | main | 284 | # frozen_string_literal: true
class AddTaxonomyIdToPurchaseIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
taxonomy_id: { type: "long" }
}
}
)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20261121000000_add_index_to_oauth_access_grants_on_resource_owner_and_application.rb | Ruby | mit | 8,966 | main | 222 | # frozen_string_literal: true
class AddIndexToOauthAccessGrantsOnResourceOwnerAndApplication < ActiveRecord::Migration[7.1]
def change
add_index :oauth_access_grants, [:resource_owner_id, :application_id]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210618101147_add_state_and_failed_verification_attempts_count_to_custom_domains.rb | Ruby | mit | 8,966 | main | 344 | # frozen_string_literal: true
class AddStateAndFailedVerificationAttemptsCountToCustomDomains < ActiveRecord::Migration[6.1]
def change
change_table :custom_domains, bulk: true do |t|
t.string :state, null: false, default: "unverified"
t.integer :failed_verification_attempts_count, null: false, defau... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150608001919_create_product_tags.rb | Ruby | mit | 8,966 | main | 394 | # frozen_string_literal: true
class CreateProductTags < ActiveRecord::Migration
def change
create_table :product_tags, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :link
t.string :tag
t.string :tag_value
t.timestamps
t.datetime :deleted_at
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111109005838_create_purchases.rb | Ruby | mit | 8,966 | main | 269 | # frozen_string_literal: true
class CreatePurchases < ActiveRecord::Migration
def change
create_table :purchases do |t|
t.integer :user_id
t.string :unique_permalink
t.float :price
t.date :created_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250116082729_add_unique_index_on_utm_columns_of_utm_links.rb | Ruby | mit | 8,966 | main | 1,040 | # frozen_string_literal: true
class AddUniqueIndexOnUtmColumnsOfUtmLinks < ActiveRecord::Migration[7.1]
def up
change_table :utm_links, bulk: true do |t|
t.change :utm_source, :string, limit: 64, null: false
t.change :utm_medium, :string, limit: 64, null: false
t.change :utm_campaign, :string, ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130516174229_add_owner_to_application.rb | Ruby | mit | 8,966 | main | 305 | # frozen_string_literal: true
class AddOwnerToApplication < ActiveRecord::Migration
def change
add_column :oauth_applications, :owner_id, :integer, null: true
add_column :oauth_applications, :owner_type, :string, null: true
add_index :oauth_applications, [:owner_id, :owner_type]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230322212701_add_recommender_model_name_to_recommended_purchase_infos.rb | Ruby | mit | 8,966 | main | 218 | # frozen_string_literal: true
class AddRecommenderModelNameToRecommendedPurchaseInfos < ActiveRecord::Migration[7.0]
def change
add_column :recommended_purchase_infos, :recommender_model_name, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121018221916_add_browser_fingerprint_to_events_and_visits.rb | Ruby | mit | 8,966 | main | 343 | # frozen_string_literal: true
class AddBrowserFingerprintToEventsAndVisits < ActiveRecord::Migration
def up
add_column :events, :browser_fingerprint, :string
add_column :visits, :browser_fingerprint, :string
end
def down
remove_column :events, :browser_fingerprint
remove_column :visits, :browser... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140717232212_update_daily_metrics_index.rb | Ruby | mit | 8,966 | main | 384 | # frozen_string_literal: true
class UpdateDailyMetricsIndex < ActiveRecord::Migration
def up
add_index :daily_metrics, [:event_name, :events_date, :source_type], name: "index_daily_metrics_on_event_name_events_date_and_source_type", unique: true
end
def down
remove_index :daily_metrics, name: "index_dai... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120526043012_add_can_contact_to_purchases.rb | Ruby | mit | 8,966 | main | 305 | # frozen_string_literal: true
class AddCanContactToPurchases < ActiveRecord::Migration
def up
change_table :purchases do |t|
t.boolean :can_contact, default: true
end
Purchase.update_all ["can_contact = ?", true]
end
def down
remove_column :purchases, :can_contact
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231228200056_remove_membership_price_migration_attributes.rb | Ruby | mit | 8,966 | main | 391 | # frozen_string_literal: true
class RemoveMembershipPriceMigrationAttributes < ActiveRecord::Migration[7.0]
def up
change_table :prices, bulk: true do |t|
t.remove :archived_at
t.remove :base_tier_price
end
end
def down
change_table :prices, bulk: true do |t|
t.column :archived_at,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201017221238_add_description_to_product_files.rb | Ruby | mit | 8,966 | main | 232 | # frozen_string_literal: true
class AddDescriptionToProductFiles < ActiveRecord::Migration[6.0]
def up
add_column :product_files, :description, :text
end
def down
remove_column :product_files, :description
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120720235047_remove_infos.rb | Ruby | mit | 8,966 | main | 399 | # frozen_string_literal: true
class RemoveInfos < ActiveRecord::Migration
def up
drop_table :infos
end
def down
create_table :infos do |t|
t.string :filetype
t.string :filegroup
t.integer :size
t.integer :duration
t.integer :bitrate
t.integer :framerate
t.intege... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115033456_remove_error_code_as_index_on_purchases.rb | Ruby | mit | 8,966 | main | 213 | # frozen_string_literal: true
class RemoveErrorCodeAsIndexOnPurchases < ActiveRecord::Migration
def up
remove_index :purchases, :error_code
end
def down
add_index :purchases, :error_code
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115041918_add_composite_event_name_link_id_index_on_events.rb | Ruby | mit | 8,966 | main | 244 | # frozen_string_literal: true
class AddCompositeEventNameLinkIdIndexOnEvents < ActiveRecord::Migration
def up
add_index "events", ["event_name", "link_id"]
end
def down
remove_index "events", ["event_name", "link_id"]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240819015410_make_subtitle_files_cdn_deletable.rb | Ruby | mit | 8,966 | main | 943 | # frozen_string_literal: true
class MakeSubtitleFilesCdnDeletable < ActiveRecord::Migration[7.1]
def up
change_table :subtitle_files, bulk: true do |t|
t.datetime :deleted_from_cdn_at
t.index :url
t.index :deleted_at
t.change :id, :bigint, null: false, auto_increment: true
t.change... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220329131939_create_top_sellers.rb | Ruby | mit | 8,966 | main | 386 | # frozen_string_literal: true
class CreateTopSellers < ActiveRecord::Migration[6.1]
def change
create_table :top_sellers do |t|
t.bigint :user_id, null: false, index: { unique: true }
t.bigint :sales_usd, default: 0, null: false
t.bigint :sales_count, default: 0, null: false
t.integer :ra... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250317100111_create_community_chat_recap_runs.rb | Ruby | mit | 8,966 | main | 518 | # frozen_string_literal: true
class CreateCommunityChatRecapRuns < ActiveRecord::Migration[7.1]
def change
create_table :community_chat_recap_runs do |t|
t.string :recap_frequency, null: false, index: true
t.datetime :from_date, null: false
t.datetime :to_date, null: false
t.integer :reca... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210923103544_create_taxonomies.rb | Ruby | mit | 8,966 | main | 225 | # frozen_string_literal: true
class CreateTaxonomies < ActiveRecord::Migration[6.1]
def change
create_table :taxonomies do |t|
t.string :name, null: false
t.bigint :parent_id, index: true
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230120075219_create_discover_searches.rb | Ruby | mit | 8,966 | main | 571 | # frozen_string_literal: true
class CreateDiscoverSearches < ActiveRecord::Migration[7.0]
def change
create_table :discover_searches do |t|
t.string :query, index: true # searched text
t.references :taxonomy, index: false # taxonomy filtering the search
t.references :user # logged in user
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120531013446_create_failed_purchases.rb | Ruby | mit | 8,966 | main | 507 | # frozen_string_literal: true
class CreateFailedPurchases < ActiveRecord::Migration
def change
create_table :failed_purchases do |t|
# what to buy
t.integer :link_id
t.integer :price_cents
# who tries to buy
t.text :email
t.string :ip_address
# Card data
t.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120503214002_add_soundcloud_fields_to_users.rb | Ruby | mit | 8,966 | main | 216 | # frozen_string_literal: true
class AddSoundcloudFieldsToUsers < ActiveRecord::Migration
def change
add_column :users, :soundcloud_username, :string
add_column :users, :soundcloud_token, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240923045553_change_user_compliance_info_json_data_to_text.rb | Ruby | mit | 8,966 | main | 264 | # frozen_string_literal: true
class ChangeUserComplianceInfoJsonDataToText < ActiveRecord::Migration[7.1]
def up
change_column :user_compliance_info, :json_data, :text
end
def down
change_column :user_compliance_info, :json_data, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200514132135_add_variant_id_to_prices.rb | Ruby | mit | 8,966 | main | 230 | # frozen_string_literal: true
class AddVariantIdToPrices < ActiveRecord::Migration[5.1]
def up
add_reference :prices, :variant, index: true, type: :integer
end
def down
remove_reference :prices, :variant
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230502051135_add_compound_index_on_email_infos.rb | Ruby | mit | 8,966 | main | 260 | # frozen_string_literal: true
class AddCompoundIndexOnEmailInfos < ActiveRecord::Migration[7.0]
def change
change_table :email_infos, bulk: true do |t|
t.index [:installment_id, :purchase_id]
t.remove_index :installment_id
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150206022753_add_additional_kyc_data_to_user_compliance_info.rb | Ruby | mit | 8,966 | main | 1,003 | # frozen_string_literal: true
class AddAdditionalKycDataToUserComplianceInfo < ActiveRecord::Migration
def change
add_column :user_compliance_info, :business_name, :string
add_column :user_compliance_info, :business_street_address, :string
add_column :user_compliance_info, :business_city, :string
add... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111121221801_purchase_fee_cents.rb | Ruby | mit | 8,966 | main | 257 | # frozen_string_literal: true
class PurchaseFeeCents < ActiveRecord::Migration
def up
add_column :purchases, :fee_cents, :integer
Purchase.update_all({ fee_cents: 0 })
end
def down
remove_column :purchase, :fee_cents, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220518034006_create_product_cached_values.rb | Ruby | mit | 8,966 | main | 519 | # frozen_string_literal: true
class CreateProductCachedValues < ActiveRecord::Migration[6.1]
def change
create_table :product_cached_values do |t|
t.bigint :product_id, null: false, index: true
t.boolean :expired, default: false, null: false, index: true
t.integer :successful_sales_count
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150520200001_add_merchant_id_to_credit.rb | Ruby | mit | 8,966 | main | 244 | # frozen_string_literal: true
class AddMerchantIdToCredit < ActiveRecord::Migration
def change
add_column :credits, :merchant_account_id, :integer, default: MerchantAccount.gumroad(StripeChargeProcessor.charge_processor_id).id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150114194817_add_scopes_to_oauth_applications.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
class AddScopesToOauthApplications < ActiveRecord::Migration
def change
add_column :oauth_applications, :scopes, :string, null: false, default: "" rescue nil
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231003202428_drop_profile_tags.rb | Ruby | mit | 8,966 | main | 357 | # frozen_string_literal: true
class DropProfileTags < ActiveRecord::Migration[7.0]
def change
drop_table :profile_tags do |t|
t.references :user, null: false
t.references :tag, null: false
t.boolean :active, default: true, null: false
t.timestamps null: false
t.index [:user_id, :tag... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210620233525_remove_foreign_key_constraints.rb | Ruby | mit | 8,966 | main | 1,503 | # frozen_string_literal: true
class RemoveForeignKeyConstraints < ActiveRecord::Migration[6.1]
def up
remove_foreign_key :devices, :users
remove_foreign_key :featured_posts, :installments, column: :post_id
remove_foreign_key :installment_events, :installments
remove_foreign_key :large_sellers, :users... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130419202456_add_preorder_id_to_purchases.rb | Ruby | mit | 8,966 | main | 200 | # frozen_string_literal: true
class AddPreorderIdToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :preorder_id, :integer
add_index :purchases, :preorder_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190715141316_add_vat_id_to_purchase_sales_tax_infos.rb | Ruby | mit | 8,966 | main | 212 | # frozen_string_literal: true
class AddVatIdToPurchaseSalesTaxInfos < ActiveRecord::Migration
def change
add_column :purchase_sales_tax_infos, :business_vat_id, :string, default: nil, null: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210303113039_add_last_active_sessions_invalidated_at_to_users.rb | Ruby | mit | 8,966 | main | 441 | # frozen_string_literal: true
class AddLastActiveSessionsInvalidatedAtToUsers < ActiveRecord::Migration[6.1]
def up
# Using raw SQL due to a bug in departure gem: https://github.com/gumroad/web/pull/17299#issuecomment-786054996
execute <<~SQL
ALTER TABLE users
ADD COLUMN last_active_sessions_in... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220421141928_add_timestamps_to_legacy_permalinks.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
class AddTimestampsToLegacyPermalinks < ActiveRecord::Migration[6.1]
def change
change_table :legacy_permalinks, bulk: true do |t|
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201203030128_set_dropbox_files_to_utf8mb4.rb | Ruby | mit | 8,966 | main | 736 | # frozen_string_literal: true
class SetDropboxFilesToUtf8mb4 < ActiveRecord::Migration[6.0]
def up
execute alter_query("utf8mb4")
end
def down
execute alter_query("utf8")
end
private
def alter_query(charset)
"ALTER TABLE dropbox_files" \
" CHARACTER SET #{charset} COLLATE #{charset}... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130904230941_prepare_bank_account.rb | Ruby | mit | 8,966 | main | 802 | # frozen_string_literal: true
class PrepareBankAccount < ActiveRecord::Migration
def up
rename_table :ach_accounts, :bank_accounts
add_column :bank_accounts, :type, :string, default: "AchAccount"
add_column :bank_accounts, :branch_code, :string
rename_column :bank_accounts, :routing_number, :bank_num... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230709185752_make_url_redirects_token_unique.rb | Ruby | mit | 8,966 | main | 449 | # frozen_string_literal: true
class MakeUrlRedirectsTokenUnique < ActiveRecord::Migration[7.0]
def up
change_table :url_redirects, bulk: true do |t|
t.change :token, :string, null: false
t.remove_index :token
t.index :token, unique: true
end
end
def down
change_table :url_redirects... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120226234156_change_type_to_filetype.rb | Ruby | mit | 8,966 | main | 231 | # frozen_string_literal: true
class ChangeTypeToFiletype < ActiveRecord::Migration
def up
remove_column :infos, :type
add_column :infos, :filetype, :string
end
def down
remove_column :infos, :filetype
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220907152005_add_content_type_to_resource_subscription.rb | Ruby | mit | 8,966 | main | 237 | # frozen_string_literal: true
class AddContentTypeToResourceSubscription < ActiveRecord::Migration[6.1]
def change
add_column :resource_subscriptions, :content_type, :string, default: "application/x-www-form-urlencoded"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151128025657_create_service_charges.rb | Ruby | mit | 8,966 | main | 1,887 | # frozen_string_literal: true
class CreateServiceCharges < ActiveRecord::Migration
def change
create_table :service_charges, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.timestamps
t.references :user
t.references :recurring_service
t.integer :c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190513150807_remove_flags_from_import_jobs_and_third_party_analytics.rb | Ruby | mit | 8,966 | main | 222 | # frozen_string_literal: true
class RemoveFlagsFromImportJobsAndThirdPartyAnalytics < ActiveRecord::Migration
def change
remove_column :import_jobs, :flags
remove_column :third_party_analytics, :flags
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121206083254_add_index_on_url_redirect_token.rb | Ruby | mit | 8,966 | main | 204 | # frozen_string_literal: true
class AddIndexOnUrlRedirectToken < ActiveRecord::Migration
def up
add_index :url_redirects, :token
end
def down
remove_index :url_redirects, :token
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150514183650_create_prices.rb | Ruby | mit | 8,966 | main | 479 | # frozen_string_literal: true
class CreatePrices < ActiveRecord::Migration
def change
create_table :prices, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :link
t.integer :price_cents, default: 0, null: false
t.string :currency, default: "usd"
t.string :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240712150014_add_flags_to_purchase_custom_fields.rb | Ruby | mit | 8,966 | main | 203 | # frozen_string_literal: true
class AddFlagsToPurchaseCustomFields < ActiveRecord::Migration[7.1]
def change
add_column :purchase_custom_fields, :flags, :bigint, default: 0, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140528212240_add_dates_to_variants.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
class AddDatesToVariants < ActiveRecord::Migration
def change
add_column(:variants, :created_at, :datetime)
add_column(:variants, :updated_at, :datetime)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120522050227_add_attachment_to_links.rb | Ruby | mit | 8,966 | main | 642 | # frozen_string_literal: true
class AddAttachmentToLinks < ActiveRecord::Migration
def self.up
add_column :links, :attachment_file_name, :string
add_column :links, :attachment_content_type, :string
add_column :links, :attachment_file_size, :integer
add_column :links, :attachment_updated_at, :datetime... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201221130000_sync_dev_tables_collations_with_prod.rb | Ruby | mit | 8,966 | main | 37,122 | # frozen_string_literal: true
class SyncDevTablesCollationsWithProd < ActiveRecord::Migration[6.0]
def up
execute %(ALTER TABLE affiliate_credits CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci)
execute %(ALTER TABLE affiliate_partial_refunds CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci)
execute %(A... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140204042121_create_imported_customers.rb | Ruby | mit | 8,966 | main | 397 | # frozen_string_literal: true
class CreateImportedCustomers < ActiveRecord::Migration
def change
create_table :imported_customers do |t|
t.string :email
t.datetime :purchase_date
t.integer :link_id
t.integer :importing_user_id
t.timestamps
end
add_index(:imported_customers... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111206214227_user_verification.rb | Ruby | mit | 8,966 | main | 226 | # frozen_string_literal: true
class UserVerification < ActiveRecord::Migration
def up
add_column :users, :email_verified_at, :datetime
end
def down
remove_column :users, :email_verified_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231228165738_create_wishlist_products.rb | Ruby | mit | 8,966 | main | 397 | # frozen_string_literal: true
class CreateWishlistProducts < ActiveRecord::Migration[7.0]
def change
create_table :wishlist_products do |t|
t.references :wishlist, null: false
t.references :product, null: false
t.references :variant
t.string :recurrence
t.integer :quantity, null: fa... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150805170243_create_base_variants_product_files_join_table.rb | Ruby | mit | 8,966 | main | 376 | # frozen_string_literal: true
class CreateBaseVariantsProductFilesJoinTable < ActiveRecord::Migration
def change
create_table :base_variants_product_files do |t|
t.references :base_variant
t.references :product_file
end
add_index :base_variants_product_files, :base_variant_id
add_index :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130304235024_add_default_value_to_webhook_fail_count.rb | Ruby | mit | 8,966 | main | 272 | # frozen_string_literal: true
class AddDefaultValueToWebhookFailCount < ActiveRecord::Migration
def up
change_column :links, :webhook_fail_count, :integer, default: 0
end
def down
change_column :links, :webhook_fail_count, :integer, default: nil
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200921213213_create_subscription_plan_changes.rb | Ruby | mit | 8,966 | main | 468 | # frozen_string_literal: true
class CreateSubscriptionPlanChanges < ActiveRecord::Migration[5.2]
def change
create_table :subscription_plan_changes do |t|
t.references :subscription, null: false, index: true
t.references :base_variant, null: false, index: true
t.string :recurrence, null: false
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150624000000_create_processed_audio.rb | Ruby | mit | 8,966 | main | 310 | # frozen_string_literal: true
class CreateProcessedAudio < ActiveRecord::Migration
def change
create_table :processed_audios do |t|
t.references :product_file
t.string :url
t.timestamps
t.datetime :deleted_at
end
add_index :processed_audios, :product_file_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130910180507_add_refunder_to_refunds.rb | Ruby | mit | 8,966 | main | 222 | # frozen_string_literal: true
class AddRefunderToRefunds < ActiveRecord::Migration
def up
add_column :refunds, :refunding_user_id, :integer
end
def down
remove_column :refunds, :refunding_user_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111109225157_default.rb | Ruby | mit | 8,966 | main | 550 | # frozen_string_literal: true
class Default < ActiveRecord::Migration
def up
change_column_default(:links, :price, 1.00)
change_column_default(:links, :length_of_exclusivity, 0)
change_column_default(:links, :number_of_paid_downloads, 0)
change_column_default(:links, :number_of_downloads, 0)
chan... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240423185410_add_charge_id_to_purchase_early_fraud_warnings.rb | Ruby | mit | 8,966 | main | 884 | # frozen_string_literal: true
class AddChargeIdToPurchaseEarlyFraudWarnings < ActiveRecord::Migration[7.1]
def up
change_table :purchase_early_fraud_warnings, bulk: true do |t|
t.bigint :charge_id, index: { unique: true }
t.change :purchase_id, :bigint, null: true
t.index :processor_id, unique... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210215094712_add_service_name_to_active_storage_blobs.active_storage.rb | Ruby | mit | 8,966 | main | 637 | # frozen_string_literal: true
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240218085253_add_seller_id_and_indexes_to_subscriptions.rb | Ruby | mit | 8,966 | main | 253 | # frozen_string_literal: true
class AddSellerIdAndIndexesToSubscriptions < ActiveRecord::Migration[7.0]
def change
change_table :subscriptions, bulk: true do |t|
t.bigint :seller_id
t.index [:seller_id, :created_at]
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230719132348_create_order_purchases.rb | Ruby | mit | 8,966 | main | 262 | # frozen_string_literal: true
class CreateOrderPurchases < ActiveRecord::Migration[7.0]
def change
create_table :order_purchases do |t|
t.references :order, null: false
t.references :purchase, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230905142104_change_product_files_archives_json_data_type.rb | Ruby | mit | 8,966 | main | 272 | # frozen_string_literal: true
class ChangeProductFilesArchivesJsonDataType < ActiveRecord::Migration[7.0]
def up
change_column :product_files_archives, :json_data, :mediumtext
end
def down
change_column :product_files_archives, :json_data, :text
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190603183838_add_link_id_to_product_review.rb | Ruby | mit | 8,966 | main | 222 | # frozen_string_literal: true
class AddLinkIdToProductReview < ActiveRecord::Migration
def up
add_column :product_reviews, :link_id, :integer
end
def down
remove_column :product_reviews, :link_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231119173129_drop_bins.rb | Ruby | mit | 8,966 | main | 629 | # frozen_string_literal: true
class DropBins < ActiveRecord::Migration[7.0]
def up
drop_table :bins
end
def down
create_table "bins", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.string "card_bin"
t.string "issuing_bank"
t.string "card_type"
t.string... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230104184824_create_team_invitations.rb | Ruby | mit | 8,966 | main | 419 | # frozen_string_literal: true
class CreateTeamInvitations < ActiveRecord::Migration[7.0]
def change
create_table :team_invitations do |t|
t.bigint :seller_id, null: false
t.string :email, null: false
t.string :role, null: false
t.timestamps
t.datetime :expires_at, null: false
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231115001459_create_bundle_product_purchases.rb | Ruby | mit | 8,966 | main | 296 | # frozen_string_literal: true
class CreateBundleProductPurchases < ActiveRecord::Migration[7.0]
def change
create_table :bundle_product_purchases do |t|
t.references :bundle_purchase, null: false
t.references :product_purchase, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211222010343_create_sales_export_chunks.rb | Ruby | mit | 8,966 | main | 412 | # frozen_string_literal: true
class CreateSalesExportChunks < ActiveRecord::Migration[6.1]
def change
create_table :sales_export_chunks do |t|
t.bigint :export_id, null: false, index: true
t.longtext :purchase_ids
t.text :custom_fields
t.longtext :purchases_data
t.boolean :processed... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20131115164420_index_transcoded_videos_on_product_file_id.rb | Ruby | mit | 8,966 | main | 242 | # frozen_string_literal: true
class IndexTranscodedVideosOnProductFileId < ActiveRecord::Migration
def up
add_index :transcoded_videos, :product_file_id
end
def down
remove_index :transcoded_videos, :product_file_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211221202333_create_sales_exports.rb | Ruby | mit | 8,966 | main | 251 | # frozen_string_literal: true
class CreateSalesExports < ActiveRecord::Migration[6.1]
def change
create_table :sales_exports do |t|
t.bigint :recipient_id, null: false, index: true
t.text :query
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230719161044_add_flags_to_upsells.rb | Ruby | mit | 8,966 | main | 210 | # frozen_string_literal: true
class AddFlagsToUpsells < ActiveRecord::Migration[7.0]
def change
change_table :upsells, bulk: true do |t|
t.integer :flags, default: 0, null: false
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150331074645_rename_fields_and_add_deleted_at_to_shipping_destinations.rb | Ruby | mit | 8,966 | main | 448 | # frozen_string_literal: true
class RenameFieldsAndAddDeletedAtToShippingDestinations < ActiveRecord::Migration
def change
add_column :shipping_destinations, :deleted_at, :datetime
rename_column :shipping_destinations, :country_code2, :country_code
rename_column :shipping_destinations, :standalone_rate_c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231119190051_drop_megaphone_states.rb | Ruby | mit | 8,966 | main | 525 | # frozen_string_literal: true
class DropMegaphoneStates < ActiveRecord::Migration[7.0]
def up
drop_table :megaphone_states
end
def down
create_table "megaphone_states", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.integer "user_id"
t.bigint "flags", default: 0, ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240410225020_create_email_info_charges.rb | Ruby | mit | 8,966 | main | 276 | # frozen_string_literal: true
class CreateEmailInfoCharges < ActiveRecord::Migration[7.0]
def change
create_table :email_info_charges do |t|
t.references :email_info, index: true, null: false
t.references :charge, index: true, null: false
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230720171507_change_shipped_at_to_datetime_on_dispute_evidences.rb | Ruby | mit | 8,966 | main | 355 | # frozen_string_literal: true
class ChangeShippedAtToDatetimeOnDisputeEvidences < ActiveRecord::Migration[7.0]
def up
execute "UPDATE `dispute_evidences` SET `dispute_evidences`.`shipped_at` = NULL;"
change_column :dispute_evidences, :shipped_at, :datetime
end
def down
change_column :dispute_evidenc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150330045333_create_shipping_destinations.rb | Ruby | mit | 8,966 | main | 536 | # frozen_string_literal: true
class CreateShippingDestinations < ActiveRecord::Migration
def change
create_table :shipping_destinations do |t|
t.integer :link_id
t.integer :user_id
t.string :country_code2, null: false
t.integer :standalone_rate_cents, null: false
t.integer :combine... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120117000944_add_rate_purchase.rb | Ruby | mit | 8,966 | main | 228 | # frozen_string_literal: true
class AddRatePurchase < ActiveRecord::Migration
def up
add_column :purchases, :rate_converted_to_usd, :string
end
def down
remove_column :purchases, :rate_converted_to_usd
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230404185041_remove_messages.rb | Ruby | mit | 8,966 | main | 815 | # frozen_string_literal: true
class RemoveMessages < ActiveRecord::Migration[7.0]
def up
drop_table :messages
end
def down
create_table "messages", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.integer "parent_id"
t.integer "purchase_id"
t.integer "flags", ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.