repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150818004412_rename_media_location_to_media_location_percentage.rb | db/migrate/20150818004412_rename_media_location_to_media_location_percentage.rb | # frozen_string_literal: true
class RenameMediaLocationToMediaLocationPercentage < ActiveRecord::Migration
def up
rename_column :consumption_events, :media_location, :media_location_basis_points
end
def down
rename_column :consumption_events, :media_location_basis_points, :media_location
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121115020045_add_user_id_as_index_on_links_table.rb | db/migrate/20121115020045_add_user_id_as_index_on_links_table.rb | # frozen_string_literal: true
class AddUserIdAsIndexOnLinksTable < ActiveRecord::Migration
def up
add_index :links, :user_id
end
def down
remove_index :links, :user_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20221128145639_add_quantity_to_subscription_plan_change.rb | db/migrate/20221128145639_add_quantity_to_subscription_plan_change.rb | # frozen_string_literal: true
class AddQuantityToSubscriptionPlanChange < ActiveRecord::Migration[7.0]
def change
change_table :subscription_plan_changes, bulk: true do |t|
t.integer "quantity", default: 1, null: false
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231123103858_remove_legacy_url_and_webhook_columns_from_links.rb | db/migrate/20231123103858_remove_legacy_url_and_webhook_columns_from_links.rb | # frozen_string_literal: true
class RemoveLegacyUrlAndWebhookColumnsFromLinks < ActiveRecord::Migration[7.0]
def up
change_table :links, bulk: true do |t|
t.remove :url
t.remove :webhook
t.remove :webhook_url
end
end
def down
change_table :links, bulk: true do |t|
t.column :url, :mediumtext
t.column :webhook, :boolean, default: false
t.column :webhook_url, :mediumtext
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140619000635_change_twitter_ids_to_strings.rb | db/migrate/20140619000635_change_twitter_ids_to_strings.rb | # frozen_string_literal: true
class ChangeTwitterIdsToStrings < ActiveRecord::Migration
def up
change_column :twitter_merchants, :twitter_assigned_merchant_id, :string
end
def down
change_column :twitter_merchants, :twitter_assigned_merchant_id, :integer, limit: 8
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120927071206_add_processor_to_payments.rb | db/migrate/20120927071206_add_processor_to_payments.rb | # frozen_string_literal: true
class AddProcessorToPayments < ActiveRecord::Migration
def change
add_column :payments, :processor, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250217220151_add_pay_in_installments_to_cart_products.rb | db/migrate/20250217220151_add_pay_in_installments_to_cart_products.rb | # frozen_string_literal: true
class AddPayInInstallmentsToCartProducts < ActiveRecord::Migration[7.1]
def change
add_column :cart_products, :pay_in_installments, :boolean, null: false, default: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220421141928_add_timestamps_to_legacy_permalinks.rb | db/migrate/20220421141928_add_timestamps_to_legacy_permalinks.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240619073817_create_cached_sales_related_products_infos.rb | db/migrate/20240619073817_create_cached_sales_related_products_infos.rb | # frozen_string_literal: true
class CreateCachedSalesRelatedProductsInfos < ActiveRecord::Migration[7.1]
def change
create_table :cached_sales_related_products_infos do |t|
t.bigint :product_id, null: false, index: { unique: true }
t.json :counts
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121018222852_add_index_to_browser_fingerprint.rb | db/migrate/20121018222852_add_index_to_browser_fingerprint.rb | # frozen_string_literal: true
class AddIndexToBrowserFingerprint < ActiveRecord::Migration
def change
add_index :events, :browser_guid
add_index :visits, :browser_guid
add_index :events, :browser_fingerprint
add_index :visits, :browser_fingerprint
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111207025721_add_attachment_meta.rb | db/migrate/20111207025721_add_attachment_meta.rb | # frozen_string_literal: true
class AddAttachmentMeta < ActiveRecord::Migration
def up
add_column :attachments, :file_meta, :text
end
def down
remove_column :attachments, :file_meta
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120501221923_add_shown_on_profile_to_links.rb | db/migrate/20120501221923_add_shown_on_profile_to_links.rb | # frozen_string_literal: true
class AddShownOnProfileToLinks < ActiveRecord::Migration
def change
add_column :links, :shown_on_profile, :boolean, default: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230512132813_remove_unique_index_constraint_from_rich_contents.rb | db/migrate/20230512132813_remove_unique_index_constraint_from_rich_contents.rb | # frozen_string_literal: true
class RemoveUniqueIndexConstraintFromRichContents < ActiveRecord::Migration[7.0]
def up
remove_index :rich_contents, name: "index_rich_contents_on_entity_id_and_entity_type"
add_index :rich_contents, [:entity_id, :entity_type], name: "index_rich_contents_on_entity_id_and_entity_type"
end
def down
remove_index :rich_contents, name: "index_rich_contents_on_entity_id_and_entity_type"
add_index :rich_contents, [:entity_id, :entity_type], name: "index_rich_contents_on_entity_id_and_entity_type", unique: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220516205519_make_links_discover_fee_per_thousand_not_null.rb | db/migrate/20220516205519_make_links_discover_fee_per_thousand_not_null.rb | # frozen_string_literal: true
class MakeLinksDiscoverFeePerThousandNotNull < ActiveRecord::Migration[6.1]
def change
change_column_null :links, :discover_fee_per_thousand, false, 100
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230125154900_create_upsell_purchases.rb | db/migrate/20230125154900_create_upsell_purchases.rb | # frozen_string_literal: true
class CreateUpsellPurchases < ActiveRecord::Migration[7.0]
def change
create_table :upsell_purchases do |t|
t.references :upsell, null: false
t.references :purchase, null: false
t.references :selected_product, null: false
t.references :upsell_variant
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210502193415_drop_preview_columns.rb | db/migrate/20210502193415_drop_preview_columns.rb | # frozen_string_literal: true
class DropPreviewColumns < ActiveRecord::Migration[6.1]
def up
change_table :links do |t|
t.remove "preview_file_name"
t.remove "preview_content_type"
t.remove "preview_file_size"
t.remove "preview_updated_at"
t.remove "preview_guid"
t.remove "attachment_file_name"
t.remove "attachment_content_type"
t.remove "attachment_file_size"
t.remove "attachment_updated_at"
t.remove "attachment_guid"
t.remove "preview_meta"
t.remove "attachment_meta"
end
end
def down
change_table :links do |t|
t.string "preview_file_name"
t.string "preview_content_type"
t.integer "preview_file_size"
t.datetime "preview_updated_at"
t.string "preview_guid"
t.string "attachment_file_name"
t.string "attachment_content_type"
t.integer "attachment_file_size"
t.datetime "attachment_updated_at"
t.string "attachment_guid"
t.string "preview_meta"
t.string "attachment_meta"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120522050227_add_attachment_to_links.rb | db/migrate/20120522050227_add_attachment_to_links.rb | # 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
add_column :links, :attachment_guid, :string
end
def self.down
remove_column :links, :attachment_file_name
remove_column :links, :attachment_content_type
remove_column :links, :attachment_file_size
remove_column :links, :attachment_updated_at
remove_column :links, :attachment_guid
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20241126194353_remove_date_uniqueness_constraint_from_balances.rb | db/migrate/20241126194353_remove_date_uniqueness_constraint_from_balances.rb | # frozen_string_literal: true
class RemoveDateUniquenessConstraintFromBalances < ActiveRecord::Migration[7.1]
def up
change_table :balances, bulk: true do |t|
t.index [:user_id, :merchant_account_id, :date], name: "index_on_user_merchant_account_date"
t.remove_index name: "unique_index"
end
end
def down
change_table :balances, bulk: true do |t|
t.index [:user_id, :merchant_account_id, :date, :currency, :holding_currency], unique: true, name: "unique_index"
t.remove_index name: "index_on_user_merchant_account_date"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230602014951_add_tax_refunded_cents_to_purchase_index.rb | db/migrate/20230602014951_add_tax_refunded_cents_to_purchase_index.rb | # frozen_string_literal: true
class AddTaxRefundedCentsToPurchaseIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
tax_refunded_cents: { type: "long" }
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151008033909_add_flags_to_payments.rb | db/migrate/20151008033909_add_flags_to_payments.rb | # frozen_string_literal: true
class AddFlagsToPayments < ActiveRecord::Migration
def change
add_column :payments, :flags, :integer, default: 0, null: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150206022753_add_additional_kyc_data_to_user_compliance_info.rb | db/migrate/20150206022753_add_additional_kyc_data_to_user_compliance_info.rb | # 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_column :user_compliance_info, :business_state, :string
add_column :user_compliance_info, :business_zip_code, :string
add_column :user_compliance_info, :business_country, :string
add_column :user_compliance_info, :business_type, :string
add_column :user_compliance_info, :business_tax_id, :binary
add_column :user_compliance_info, :business_tax_id_type, :string, default: "ein"
rename_column :user_compliance_info, :tax_id, :individual_tax_id
add_column :user_compliance_info, :individual_tax_id_type, :string, default: "ssn"
add_column :user_compliance_info, :birthday, :date
add_column :user_compliance_info, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150929000001_add_holding_currency_to_balances.rb | db/migrate/20150929000001_add_holding_currency_to_balances.rb | # frozen_string_literal: true
class AddHoldingCurrencyToBalances < ActiveRecord::Migration
def up
add_column :balances, :currency, :string, default: "usd"
add_column :balances, :holding_currency, :string, default: "usd"
add_column :balances, :holding_amount_cents, :integer, default: 0
add_index :balances, [:user_id, :merchant_account_id, :date, :currency, :holding_currency], unique: true, name: "unique_index"
remove_index :balances, column: [:user_id, :merchant_account_id, :date]
end
def down
add_index :balances, [:user_id, :merchant_account_id, :date], unique: true
remove_index :balances, name: "unique_index"
remove_column :balances, :holding_amount_cents
remove_column :balances, :holding_currency
remove_column :balances, :currency
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120921003128_add_purchase_number_to_purchases.rb | db/migrate/20120921003128_add_purchase_number_to_purchases.rb | # frozen_string_literal: true
class AddPurchaseNumberToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :purchase_number, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150909000001_add_timestamps_to_disputes.rb | db/migrate/20150909000001_add_timestamps_to_disputes.rb | # frozen_string_literal: true
class AddTimestampsToDisputes < ActiveRecord::Migration
def change
add_column :disputes, :created_at, :datetime
add_column :disputes, :updated_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130410194734_add_index_to_subscription_id_in_purchases.rb | db/migrate/20130410194734_add_index_to_subscription_id_in_purchases.rb | # frozen_string_literal: true
class AddIndexToSubscriptionIdInPurchases < ActiveRecord::Migration
def change
add_index :purchases, :subscription_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150624000000_create_processed_audio.rb | db/migrate/20150624000000_create_processed_audio.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130124005549_create_refunds.rb | db/migrate/20130124005549_create_refunds.rb | # frozen_string_literal: true
class CreateRefunds < ActiveRecord::Migration
def change
create_table :refunds do |t|
t.integer :amount_cents, default: 0
t.integer :purchase_id
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220907151951_add_notification_content_type_to_user.rb | db/migrate/20220907151951_add_notification_content_type_to_user.rb | # frozen_string_literal: true
class AddNotificationContentTypeToUser < ActiveRecord::Migration[6.1]
def change
add_column :users, :notification_content_type, :string, default: "application/x-www-form-urlencoded"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150608000000_add_stripe_ids_to_payments.rb | db/migrate/20150608000000_add_stripe_ids_to_payments.rb | # frozen_string_literal: true
class AddStripeIdsToPayments < ActiveRecord::Migration
def change
add_column :payments, :stripe_connect_account_id, :string
add_column :payments, :stripe_transfer_id, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120703062941_add_user_id_to_delayed_emails.rb | db/migrate/20120703062941_add_user_id_to_delayed_emails.rb | # frozen_string_literal: true
class AddUserIdToDelayedEmails < ActiveRecord::Migration
def change
add_column :delayed_emails, :user_id, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120627225210_remove_attachments_table.rb | db/migrate/20120627225210_remove_attachments_table.rb | # frozen_string_literal: true
class RemoveAttachmentsTable < ActiveRecord::Migration
def up
drop_table :attachments
end
def down
create_table :attachments do |t|
t.string :blob_key
t.string :file_name
t.integer :date
t.string :unique_permalink
t.string :file_type
t.string :file_file_name
t.string :file_content_type
t.integer :file_file_size
t.datetime :file_updated_at
t.string :file_guid
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130626020421_add_card_expiry_to_purchases.rb | db/migrate/20130626020421_add_card_expiry_to_purchases.rb | # frozen_string_literal: true
class AddCardExpiryToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :card_expiry_month, :integer
add_column :purchases, :card_expiry_year, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120816014041_add_manage_pages_to_users.rb | db/migrate/20120816014041_add_manage_pages_to_users.rb | # frozen_string_literal: true
class AddManagePagesToUsers < ActiveRecord::Migration
def change
add_column :users, :manage_pages, :boolean, default: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240502183124_add_duration_in_minutes_to_base_variants.rb | db/migrate/20240502183124_add_duration_in_minutes_to_base_variants.rb | # frozen_string_literal: true
class AddDurationInMinutesToBaseVariants < ActiveRecord::Migration[7.1]
def change
add_column :base_variants, :duration_in_minutes, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250821014630_add_support_email_to_links.rb | db/migrate/20250821014630_add_support_email_to_links.rb | # frozen_string_literal: true
class AddSupportEmailToLinks < ActiveRecord::Migration[7.1]
def change
add_column :links, :support_email, :string, null: true, default: nil
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111209004152_make_purchase_findable.rb | db/migrate/20111209004152_make_purchase_findable.rb | # frozen_string_literal: true
class MakePurchaseFindable < ActiveRecord::Migration
def up
add_index :purchases, :link_id
end
def down
remove_index :purchases, :link_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120226213809_add_link_id_to_infos.rb | db/migrate/20120226213809_add_link_id_to_infos.rb | # frozen_string_literal: true
class AddLinkIdToInfos < ActiveRecord::Migration
def change
add_column :infos, :link_id, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150721004604_add_purchase_id_to_purchase_codes.rb | db/migrate/20150721004604_add_purchase_id_to_purchase_codes.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120424204521_change_card_type_to_type.rb | db/migrate/20120424204521_change_card_type_to_type.rb | # frozen_string_literal: true
class ChangeCardTypeToType < ActiveRecord::Migration
def up
rename_column :credit_cards, :card_type, :type
end
def down
rename_column :credit_cards, :type, :card_type
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120924203422_add_purchase_state_to_purchases.rb | db/migrate/20120924203422_add_purchase_state_to_purchases.rb | # frozen_string_literal: true
class AddPurchaseStateToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :purchase_state, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210728192116_rename_media_location_link_to_product.rb | db/migrate/20210728192116_rename_media_location_link_to_product.rb | # frozen_string_literal: true
class RenameMediaLocationLinkToProduct < ActiveRecord::Migration[6.1]
def up
Alterity.disable do
rename_column :media_locations, :link_id, :product_id
end
end
def down
Alterity.disable do
rename_column :media_locations, :product_id, :link_id
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230504184554_remove_is_business_publicly_traded_from_user_compliance_info.rb | db/migrate/20230504184554_remove_is_business_publicly_traded_from_user_compliance_info.rb | # frozen_string_literal: true
class RemoveIsBusinessPubliclyTradedFromUserComplianceInfo < ActiveRecord::Migration[7.0]
def change
remove_column :user_compliance_info, :is_business_publicly_traded, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20180322091933_add_unconfirmed_email_index.rb | db/migrate/20180322091933_add_unconfirmed_email_index.rb | # frozen_string_literal: true
class AddUnconfirmedEmailIndex < ActiveRecord::Migration
def change
add_index :users, :unconfirmed_email, name: "index_users_on_unconfirmed_email", length: 191
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230502051135_add_compound_index_on_email_infos.rb | db/migrate/20230502051135_add_compound_index_on_email_infos.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150505211933_add_meta_to_attachments.rb | db/migrate/20150505211933_add_meta_to_attachments.rb | # frozen_string_literal: true
class AddMetaToAttachments < ActiveRecord::Migration
def change
add_column(:asset_previews, :attachment_meta, :text)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120601235856_add_index_to_url_redirects.rb | db/migrate/20120601235856_add_index_to_url_redirects.rb | # frozen_string_literal: true
class AddIndexToUrlRedirects < ActiveRecord::Migration
def change
add_index :url_redirects, :purchase_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140212002303_add_index_for_imported_customer_on_url_redirects.rb | db/migrate/20140212002303_add_index_for_imported_customer_on_url_redirects.rb | # frozen_string_literal: true
class AddIndexForImportedCustomerOnUrlRedirects < ActiveRecord::Migration
def up
add_index :url_redirects, :imported_customer_id
end
def down
remove_index :url_redirects, :imported_customer_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20191127061350_remove_unique_index_from_custom_domain.rb | db/migrate/20191127061350_remove_unique_index_from_custom_domain.rb | # frozen_string_literal: true
class RemoveUniqueIndexFromCustomDomain < ActiveRecord::Migration
def up
remove_index :custom_domains, :domain
add_index :custom_domains, :domain
end
def down
remove_index :custom_domains, :domain
add_index :custom_domains, :domain, unique: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120620212331_add_ban_flag_to_users.rb | db/migrate/20120620212331_add_ban_flag_to_users.rb | # frozen_string_literal: true
class AddBanFlagToUsers < ActiveRecord::Migration
def change
add_column :users, :ban_flag, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121004173944_add_highlight_color_to_users.rb | db/migrate/20121004173944_add_highlight_color_to_users.rb | # frozen_string_literal: true
class AddHighlightColorToUsers < ActiveRecord::Migration
def change
add_column :users, :hightlight_color, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240228162247_add_deleted_at_to_product_reviews.rb | db/migrate/20240228162247_add_deleted_at_to_product_reviews.rb | # frozen_string_literal: true
class AddDeletedAtToProductReviews < ActiveRecord::Migration[7.1]
def change
add_column :product_reviews, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250131062035_utm_link_update_unique_index_on_utm_params.rb | db/migrate/20250131062035_utm_link_update_unique_index_on_utm_params.rb | # frozen_string_literal: true
class UtmLinkUpdateUniqueIndexOnUtmParams < ActiveRecord::Migration[7.1]
def change
change_table :utm_links, bulk: true do |t|
t.remove_index [:seller_id, :utm_source, :utm_medium, :utm_campaign, :utm_term, :utm_content], where: "deleted_at IS NULL", name: "index_utm_links_on_utm_fields", unique: true
t.index [:seller_id, :utm_source, :utm_medium, :utm_campaign, :utm_term, :utm_content, :target_resource_type, :target_resource_id], where: "deleted_at IS NULL", name: "index_utm_links_on_utm_fields_and_target_resource", unique: true
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20201010080412_add_refunded_amount_cents_to_purchase_index.rb | db/migrate/20201010080412_add_refunded_amount_cents_to_purchase_index.rb | # frozen_string_literal: true
class AddRefundedAmountCentsToPurchaseIndex < ActiveRecord::Migration[6.0]
def up
Elasticsearch::Model.client.indices.put_mapping(
index: "purchases_v2",
type: "purchase",
body: {
purchase: {
properties: {
amount_refunded_cents: { type: "long" }
}
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20191031114536_create_affiliate_partial_refund.rb | db/migrate/20191031114536_create_affiliate_partial_refund.rb | # frozen_string_literal: true
class CreateAffiliatePartialRefund < ActiveRecord::Migration
def change
create_table :affiliate_partial_refunds do |t|
t.integer :amount_cents, default: 0
t.integer :purchase_id, null: false
t.integer :total_credit_cents, default: 0
t.integer :affiliate_user_id
t.integer :seller_id
t.integer :affiliate_id
t.integer :balance_id
t.integer :affiliate_credit_id
t.timestamps
end
add_index :affiliate_partial_refunds, :purchase_id
add_index :affiliate_partial_refunds, :affiliate_user_id
add_index :affiliate_partial_refunds, :seller_id
add_index :affiliate_partial_refunds, :affiliate_id
add_index :affiliate_partial_refunds, :balance_id
add_index :affiliate_partial_refunds, :affiliate_credit_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140326164256_add_deleted_at_to_oauth_applications.rb | db/migrate/20140326164256_add_deleted_at_to_oauth_applications.rb | # frozen_string_literal: true
class AddDeletedAtToOauthApplications < ActiveRecord::Migration
def change
add_column :oauth_applications, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140724201402_add_size_to_subtitle_files.rb | db/migrate/20140724201402_add_size_to_subtitle_files.rb | # frozen_string_literal: true
class AddSizeToSubtitleFiles < ActiveRecord::Migration
def change
add_column :subtitle_files, :size, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111207011513_old_user_grandfathered.rb | db/migrate/20111207011513_old_user_grandfathered.rb | # frozen_string_literal: true
class OldUserGrandfathered < ActiveRecord::Migration
def up
User.update_all({ confirmed_at: true })
end
def down
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210902085559_change_comment_ids_to_bigints_and_change_its_content_limit_and_add_deleted_at.rb | db/migrate/20210902085559_change_comment_ids_to_bigints_and_change_its_content_limit_and_add_deleted_at.rb | # frozen_string_literal: true
class ChangeCommentIdsToBigintsAndChangeItsContentLimitAndAddDeletedAt < ActiveRecord::Migration[6.1]
def up
change_table :comments, bulk: true do |t|
# Added
t.datetime :deleted_at, null: true
# Changed
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :commentable_id, :bigint
t.change :author_id, :bigint
end
end
def down
change_table :comments, bulk: true do |t|
# Previously added
t.remove :deleted_at
# Previously changed
t.change :id, :integer, null: false, unique: true, auto_increment: true
t.change :commentable_id, :integer
t.change :author_id, :integer
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120531212313_remove_soundscan_from_links.rb | db/migrate/20120531212313_remove_soundscan_from_links.rb | # frozen_string_literal: true
class RemoveSoundscanFromLinks < ActiveRecord::Migration
def change
remove_column :links, :soundscan
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120415221152_add_shipping_info_to_links_and_purchases.rb | db/migrate/20120415221152_add_shipping_info_to_links_and_purchases.rb | # frozen_string_literal: true
class AddShippingInfoToLinksAndPurchases < ActiveRecord::Migration
def change
add_column :purchases, :street_address, :string
add_column :purchases, :city, :string
add_column :purchases, :state, :string
add_column :purchases, :zip_code, :string
add_column :purchases, :country, :string
add_column :links, :require_shipping, :boolean, default: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111220191412_remove_balance_cents.rb | db/migrate/20111220191412_remove_balance_cents.rb | # frozen_string_literal: true
class RemoveBalanceCents < ActiveRecord::Migration
def up
remove_column :users, :balance
end
def down
add_column :users, :balance, :float
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190413210021_sync_indexes_with_production.rb | db/migrate/20190413210021_sync_indexes_with_production.rb | # frozen_string_literal: true
class SyncIndexesWithProduction < ActiveRecord::Migration
def up
# ==========
# Following indexes exist in dev, not in production
# ==========
create_index_unless_exists(:affiliate_credits, :link_id, :index_affiliate_credits_on_link_id)
create_index_unless_exists(:affiliate_credits, :purchase_id, :index_affiliate_credits_on_purchase_id)
create_index_unless_exists(:followers, [:followed_id, :email], :index_follows_on_followed_id_and_email)
# The following 3 have an unusal name in production.
# MySQL 5.6 does not allow renaming of indexes, so we are recreating the ones in dev rather than touching the ones in production.
recreate_index(:purchases, :purchase_chargeback_balance_id, before: :index_purchases_on_purchase_chargeback_balance_id, after: :index_purchase_chargeback_balance_id)
recreate_index(:purchases, :purchase_refund_balance_id, before: :index_purchases_on_purchase_refund_balance_id, after: :index_purchase_refund_balance_id)
recreate_index(:purchases, :purchase_success_balance_id, before: :index_purchases_on_purchase_success_balance_id, after: :index_purchase_success_balance_id)
# If a column is varchar(191) and an index is created with that length, AR will NOT declare that length in the schema dump.
# If a column is varchar(255) and an index is created with a different length, AR will.
# The problem with these columns is that they either have mismatching lengths on dev & prod, and/or index column lengths.
# Here we are removing the dev ones and replacing them with the prod version.
resize_columns_and_recreate_index(:links, :index_links_on_custom_permalink, lengths: { custom_permalink: 191 })
resize_columns_and_recreate_index(:links, :index_links_on_unique_permalink, lengths: { unique_permalink: 191 })
resize_columns_and_recreate_index(:offer_codes, :index_offer_codes_on_name_and_link_id, lengths: { name: 191, link_id: nil })
resize_columns_and_recreate_index(:users, :index_users_on_confirmation_token, lengths: { confirmation_token: 191 })
resize_columns_and_recreate_index(:users, :index_users_on_email, lengths: { email: 191 })
resize_columns_and_recreate_index(:users, :index_users_on_external_id, lengths: { external_id: 191 })
resize_columns_and_recreate_index(:users, :index_users_on_facebook_uid, lengths: { facebook_uid: 191 })
resize_columns_and_recreate_index(:users, :index_users_on_twitter_user_id, lengths: { twitter_user_id: 191 })
resize_columns_and_recreate_index(:users, :index_users_on_unconfirmed_email, lengths: { unconfirmed_email: 191 })
resize_columns_and_recreate_index(:users, :index_users_on_username, lengths: { username: 191 })
# ==========
# Following indexes exist in prod, not in dev
# ==========
create_index_unless_exists(:affiliate_credits, :oauth_application_id, :index_affiliate_credits_on_oauth_application_id)
create_index_unless_exists(:events, :visit_id, :index_events_on_visit_id)
create_index_unless_exists(:purchases, :ip_address, :index_purchases_on_ip_address)
create_index_unless_exists(:purchases, :stripe_fingerprint, :index_purchases_on_stripe_fingerprint)
# Special case: In dev, this there's an index named events.index_events_on_event_name_and_link_id which based on the columns [event_name, link_id].
# In prod, an index with the SAME NAME is actually indexing [event_name, link_id, created_at].
# MySQL 5.6 does not allow renaming of indexes, so we're recreating the index in dev to match the one in prod.
if index_name_exists?(:events, :index_events_on_event_name_and_link_id, nil).columns.size == 2
remove_index(:events, name: :index_events_on_event_name_and_link_id)
add_index(:events, [:event_name, :link_id, :created_at], name: :index_events_on_event_name_and_link_id)
end
end
def down
# Irreversible by nature
end
def create_index_unless_exists(table_name, columns, index_name)
return if index_name_exists?(table_name, index_name, nil)
add_index(table_name, columns, name: index_name)
end
def recreate_index(table_name, columns, before:, after:)
return unless index_name_exists?(table_name, before, nil)
remove_index(table_name, name: before)
add_index(table_name, columns, name: after)
end
def resize_columns_and_recreate_index(table_name, index_name, lengths:)
index_definition = index_name_exists?(table_name, index_name, nil)
return unless index_definition.columns == lengths.keys.map(&:to_s) && index_definition.lengths != lengths.values
remove_index(table_name, name: index_name)
lengths.each_pair do |column_name, length|
next if length.nil?
change_column(table_name, column_name, :string, limit: 255)
end
add_index(table_name, lengths.keys, name: index_name, length: lengths)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120627004427_add_preview_automatically_generated_to_links.rb | db/migrate/20120627004427_add_preview_automatically_generated_to_links.rb | # frozen_string_literal: true
class AddPreviewAutomaticallyGeneratedToLinks < ActiveRecord::Migration
def change
add_column :links, :preview_automatically_generated, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120426222422_add_publisher_to_infos.rb | db/migrate/20120426222422_add_publisher_to_infos.rb | # frozen_string_literal: true
class AddPublisherToInfos < ActiveRecord::Migration
def change
add_column :infos, :publisher, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140624205931_create_subtitle_files.rb | db/migrate/20140624205931_create_subtitle_files.rb | # frozen_string_literal: true
class CreateSubtitleFiles < ActiveRecord::Migration
def change
create_table :subtitle_files do |t|
t.string :url
t.string :language
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151007212137_create_recommended_purchase_info.rb | db/migrate/20151007212137_create_recommended_purchase_info.rb | # frozen_string_literal: true
class CreateRecommendedPurchaseInfo < ActiveRecord::Migration
def change
create_table :recommended_purchase_infos, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.timestamps
t.references :purchase
t.integer :recommended_link_id
t.integer :recommended_by_link_id
t.string :recommendation_type
end
add_index :recommended_purchase_infos, :purchase_id
add_index :recommended_purchase_infos, :recommended_link_id
add_index :recommended_purchase_infos, :recommended_by_link_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140130003625_add_page_layout_to_users.rb | db/migrate/20140130003625_add_page_layout_to_users.rb | # frozen_string_literal: true
class AddPageLayoutToUsers < ActiveRecord::Migration
def change
add_column(:users, :page_layout, :text)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120911235443_change_link_size_to_bigint.rb | db/migrate/20120911235443_change_link_size_to_bigint.rb | # frozen_string_literal: true
class ChangeLinkSizeToBigint < ActiveRecord::Migration
def up
change_column :links, :size, :integer, limit: 8
end
def down
change_column :links, :size, :integer, limit: 4
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20241215185121_update_purchase_refund_policies.rb | db/migrate/20241215185121_update_purchase_refund_policies.rb | # frozen_string_literal: true
class UpdatePurchaseRefundPolicies < ActiveRecord::Migration[7.1]
def change
add_column :purchase_refund_policies, :max_refund_period_in_days, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190127012512_add_deleted_from_cdn_index_indexes.rb | db/migrate/20190127012512_add_deleted_from_cdn_index_indexes.rb | # frozen_string_literal: true
class AddDeletedFromCdnIndexIndexes < ActiveRecord::Migration
def change
add_index :product_files, :deleted_from_cdn_at
add_index :product_files_archives, :deleted_from_cdn_at
add_index :transcoded_videos, :deleted_from_cdn_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150616175837_rename_oauth_application_owner_id_to_affiliate_user_id.rb | db/migrate/20150616175837_rename_oauth_application_owner_id_to_affiliate_user_id.rb | # frozen_string_literal: true
class RenameOauthApplicationOwnerIdToAffiliateUserId < ActiveRecord::Migration
def up
remove_index :affiliate_credits, name: "index_affiliate_credits_on_oauth_application_owner_id"
rename_column :affiliate_credits, :oauth_application_owner_id, :affiliate_user_id
add_index :affiliate_credits, :affiliate_user_id
end
def down
remove_index :affiliate_credits, name: "index_affiliate_credits_on_affiliate_user_id"
rename_column :affiliate_credits, :affiliate_user_id, :oauth_application_owner_id
add_index :affiliate_credits, :oauth_application_owner_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250101092549_add_json_data_to_credits.rb | db/migrate/20250101092549_add_json_data_to_credits.rb | # frozen_string_literal: true
class AddJsonDataToCredits < ActiveRecord::Migration[7.1]
def change
add_column :credits, :json_data, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190906144207_remove_shown_on_profile_column_from_product_taggings.rb | db/migrate/20190906144207_remove_shown_on_profile_column_from_product_taggings.rb | # frozen_string_literal: true
class RemoveShownOnProfileColumnFromProductTaggings < ActiveRecord::Migration
def up
remove_column :product_taggings, :shown_on_profile
end
def down
add_column :product_taggings, :shown_on_profile, :boolean
change_column_default :product_taggings, :shown_on_profile, true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140528212240_add_dates_to_variants.rb | db/migrate/20140528212240_add_dates_to_variants.rb | # frozen_string_literal: true
class AddDatesToVariants < ActiveRecord::Migration
def change
add_column(:variants, :created_at, :datetime)
add_column(:variants, :updated_at, :datetime)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240923045553_change_user_compliance_info_json_data_to_text.rb | db/migrate/20240923045553_change_user_compliance_info_json_data_to_text.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130322184037_remove_unused_index_from_purchases.rb | db/migrate/20130322184037_remove_unused_index_from_purchases.rb | # frozen_string_literal: true
class RemoveUnusedIndexFromPurchases < ActiveRecord::Migration
def up
remove_index :purchases, :created_at
remove_index :purchases, :price_cents
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120316181713_add_username_to_users.rb | db/migrate/20120316181713_add_username_to_users.rb | # frozen_string_literal: true
class AddUsernameToUsers < ActiveRecord::Migration
def change
change_table :users do |t|
t.string :username
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230412221958_modify_upsells_selected_products.rb | db/migrate/20230412221958_modify_upsells_selected_products.rb | # frozen_string_literal: true
class ModifyUpsellsSelectedProducts < ActiveRecord::Migration[7.0]
def change
change_table(:upsells_selected_products, bulk: true) do |t|
t.rename :product_id, :selected_product_id
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20200330184434_add_description_to_base_variants.rb | db/migrate/20200330184434_add_description_to_base_variants.rb | # frozen_string_literal: true
class AddDescriptionToBaseVariants < ActiveRecord::Migration
def up
add_column :base_variants, :description, :string, limit: 255
end
def down
remove_column :base_variants, :description
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230412221512_modify_upsells.rb | db/migrate/20230412221512_modify_upsells.rb | # frozen_string_literal: true
class ModifyUpsells < ActiveRecord::Migration[7.0]
def change
change_table(:upsells, bulk: true) do |t|
t.rename :offered_product_id, :product_id
t.rename :offered_variant_id, :variant_id
t.boolean :universal, null: false, default: false
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240222000604_add_index_on_media_locations_purchase_file_consumed_at.rb | db/migrate/20240222000604_add_index_on_media_locations_purchase_file_consumed_at.rb | # frozen_string_literal: true
class AddIndexOnMediaLocationsPurchaseFileConsumedAt < ActiveRecord::Migration[7.0]
def change
add_index :media_locations, [:purchase_id, :product_file_id, :consumed_at], name: "index_media_locations_on_purchase_id_product_file_id_consumed_at"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120830210601_add_digest_sent_at_to_users.rb | db/migrate/20120830210601_add_digest_sent_at_to_users.rb | # frozen_string_literal: true
class AddDigestSentAtToUsers < ActiveRecord::Migration
def change
add_column :users, :digest_sent_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250103130628_create_utm_link_visits.rb | db/migrate/20250103130628_create_utm_link_visits.rb | # frozen_string_literal: true
class CreateUtmLinkVisits < ActiveRecord::Migration[7.1]
def change
create_table :utm_link_visits do |t|
t.references :utm_link, null: false
t.references :user
t.string :referrer
t.string :ip_address, null: false
t.string :user_agent
t.string :browser_guid, null: false, index: true
t.string :country_code, null: false
t.timestamps
t.index [:created_at]
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240214064403_add_deleted_at_to_cart_products.rb | db/migrate/20240214064403_add_deleted_at_to_cart_products.rb | # frozen_string_literal: true
class AddDeletedAtToCartProducts < ActiveRecord::Migration[7.0]
def change
change_table :cart_products, bulk: true do |t|
t.datetime :deleted_at
t.remove_index [:cart_id, :product_id], unique: true
t.index [:cart_id, :product_id, :deleted_at], unique: true
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120620233206_add_showcaseable_to_links.rb | db/migrate/20120620233206_add_showcaseable_to_links.rb | # frozen_string_literal: true
class AddShowcaseableToLinks < ActiveRecord::Migration
def change
add_column :links, :showcaseable, :boolean, default: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121203174722_add_ip_state_to_events.rb | db/migrate/20121203174722_add_ip_state_to_events.rb | # frozen_string_literal: true
class AddIpStateToEvents < ActiveRecord::Migration
def change
add_column :events, :ip_state, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121128065528_add_custom_fields_to_purchases.rb | db/migrate/20121128065528_add_custom_fields_to_purchases.rb | # frozen_string_literal: true
class AddCustomFieldsToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :custom_fields, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120703181959_add_email_type_to_delayed_emails.rb | db/migrate/20120703181959_add_email_type_to_delayed_emails.rb | # frozen_string_literal: true
class AddEmailTypeToDelayedEmails < ActiveRecord::Migration
def change
add_column :delayed_emails, :email_type, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230506201836_add_validity_columns_to_offer_codes.rb | db/migrate/20230506201836_add_validity_columns_to_offer_codes.rb | # frozen_string_literal: true
class AddValidityColumnsToOfferCodes < ActiveRecord::Migration[7.0]
def change
change_table :offer_codes, bulk: true do |t|
t.datetime :valid_at
t.datetime :expires_at
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150317214940_add_dba_to_user_compliance_info.rb | db/migrate/20150317214940_add_dba_to_user_compliance_info.rb | # frozen_string_literal: true
class AddDbaToUserComplianceInfo < ActiveRecord::Migration
def change
add_column :user_compliance_info, :dba, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210520070731_add_created_updated_fields_to_shipping_destination.rb | db/migrate/20210520070731_add_created_updated_fields_to_shipping_destination.rb | # frozen_string_literal: true
class AddCreatedUpdatedFieldsToShippingDestination < ActiveRecord::Migration[6.1]
def change
change_table :shipping_destinations, bulk: true do |t|
t.datetime :created_at, precision: 6
t.datetime :updated_at, precision: 6
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120720235047_remove_infos.rb | db/migrate/20120720235047_remove_infos.rb | # 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.integer :width
t.integer :height
t.integer :pagelength
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210811063931_remove_content_length_unit_required_from_media_location.rb | db/migrate/20210811063931_remove_content_length_unit_required_from_media_location.rb | # frozen_string_literal: true
class RemoveContentLengthUnitRequiredFromMediaLocation < ActiveRecord::Migration[6.1]
def up
change_table :media_locations, bulk: true do |t|
t.change :content_length, :integer, null: true
t.change :unit, :string, null: true
end
end
def down
change_table :media_locations, bulk: true do |t|
t.change :content_length, :integer, null: false
t.change :unit, :string, null: false
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121004222417_add_purchase_state_index_to_purchases.rb | db/migrate/20121004222417_add_purchase_state_index_to_purchases.rb | # frozen_string_literal: true
class AddPurchaseStateIndexToPurchases < ActiveRecord::Migration
def change
add_index :purchases, :purchase_state
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190906144208_create_devices.rb | db/migrate/20190906144208_create_devices.rb | # frozen_string_literal: true
class CreateDevices < ActiveRecord::Migration
def change
create_table :devices do |t|
t.string :token, null: false, limit: 255
t.string :app_version, limit: 255
t.string :device_type, null: false, default: "ios", limit: 255
t.references :user, foreign_key: { on_delete: :cascade }, null: false, index: true
t.timestamps null: false
end
add_index :devices, :token, unique: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120615195934_add_variants_to_links.rb | db/migrate/20120615195934_add_variants_to_links.rb | # frozen_string_literal: true
class AddVariantsToLinks < ActiveRecord::Migration
def change
add_column :links, :variants, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130227221245_add_published_at_to_installments.rb | db/migrate/20130227221245_add_published_at_to_installments.rb | # frozen_string_literal: true
class AddPublishedAtToInstallments < ActiveRecord::Migration
def change
add_column :installments, :published_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120921224506_add_processor_fee_cents_to_payments.rb | db/migrate/20120921224506_add_processor_fee_cents_to_payments.rb | # frozen_string_literal: true
class AddProcessorFeeCentsToPayments < ActiveRecord::Migration
def change
add_column :payments, :processor_fee_cents, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20141218034906_add_workflow_and_index_to_installments.rb | db/migrate/20141218034906_add_workflow_and_index_to_installments.rb | # frozen_string_literal: true
class AddWorkflowAndIndexToInstallments < ActiveRecord::Migration
def change
add_column :installments, :workflow_id, :integer
add_index :installments, :workflow_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240805153028_add_affiliate_credit_fee_partially_refunded_cents_to_purchases_index.rb | db/migrate/20240805153028_add_affiliate_credit_fee_partially_refunded_cents_to_purchases_index.rb | # frozen_string_literal: true
class AddAffiliateCreditFeePartiallyRefundedCentsToPurchasesIndex < ActiveRecord::Migration[7.1]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
affiliate_credit_fee_partially_refunded_cents: { type: "long" },
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.