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/20130218211025_create_offer_codes.rb | db/migrate/20130218211025_create_offer_codes.rb | # frozen_string_literal: true
class CreateOfferCodes < ActiveRecord::Migration
def change
create_table :offer_codes do |t|
t.references :link
t.string :name
t.integer :amount_cents
t.integer :max_purchase_count
t.datetime :deleted_at
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/20210910115450_add_interruption_timestamps_to_subscriptions.rb | db/migrate/20210910115450_add_interruption_timestamps_to_subscriptions.rb | # frozen_string_literal: true
class AddInterruptionTimestampsToSubscriptions < ActiveRecord::Migration[6.1]
def change
change_table :subscriptions, bulk: true do |t|
t.datetime :last_resubscribed_at, null: true
t.datetime :last_deactivated_at, null: 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/20121029235025_add_twitter_ouath_token_to_users.rb | db/migrate/20121029235025_add_twitter_ouath_token_to_users.rb | # frozen_string_literal: true
class AddTwitterOuathTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :twitter_oauth_token, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240609161156_add_recent_sales_count_to_taxonomy_stats.rb | db/migrate/20240609161156_add_recent_sales_count_to_taxonomy_stats.rb | # frozen_string_literal: true
#
class AddRecentSalesCountToTaxonomyStats < ActiveRecord::Migration[7.1]
def change
add_column :taxonomy_stats, :recent_sales_count, :int, default: 0
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230404185041_remove_messages.rb | db/migrate/20230404185041_remove_messages.rb | # 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", default: 0, null: false
t.string "state", limit: 191
t.text "text"
t.string "title", limit: 191
t.datetime "read_at", precision: nil
t.datetime "responded_at", precision: nil
t.datetime "deleted_at", precision: nil
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.index ["parent_id"], name: "index_messages_on_parent_id"
t.index ["purchase_id"], name: "index_messages_on_purchase_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/20231219083048_create_charges.rb | db/migrate/20231219083048_create_charges.rb | # frozen_string_literal: true
class CreateCharges < ActiveRecord::Migration[7.0]
def change
create_table :charges do |t|
t.references :order, null: false
t.references :seller, null: false
t.string :processor, null: false
t.string :processor_transaction_id, index: { unique: true }
t.string :payment_method_fingerprint
t.references :credit_card
t.references :merchant_account, null: false
t.bigint :amount_cents
t.bigint :gumroad_amount_cents
t.bigint :processor_fee_cents
t.string :processor_fee_currency
t.string :paypal_order_id, index: { unique: true }
t.string :stripe_payment_intent_id
t.string :stripe_setup_intent_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/20121004175839_add_external_css_url_to_users.rb | db/migrate/20121004175839_add_external_css_url_to_users.rb | # frozen_string_literal: true
class AddExternalCssUrlToUsers < ActiveRecord::Migration
def change
add_column :users, :external_css_url, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150128162110_add_gumroad_tax_cents_to_purchase.rb | db/migrate/20150128162110_add_gumroad_tax_cents_to_purchase.rb | # frozen_string_literal: true
class AddGumroadTaxCentsToPurchase < ActiveRecord::Migration
def change
add_column :purchases, :gumroad_tax_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/20220626140322_create_sent_post_emails.rb | db/migrate/20220626140322_create_sent_post_emails.rb | # frozen_string_literal: true
class CreateSentPostEmails < ActiveRecord::Migration[6.1]
def change
create_table :sent_post_emails do |t|
t.bigint :post_id, null: false
t.string :email, null: false
t.timestamps
t.index [:post_id, :email], 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/20250103145344_add_deleted_at_and_disabled_at_to_utm_links.rb | db/migrate/20250103145344_add_deleted_at_and_disabled_at_to_utm_links.rb | # frozen_string_literal: true
class AddDeletedAtAndDisabledAtToUtmLinks < ActiveRecord::Migration[7.1]
def change
change_table :utm_links, bulk: true do |t|
t.datetime :deleted_at, precision: nil, index: true
t.datetime :disabled_at, precision: nil
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120917232121_update_credit_cards_stripe_fingerprint_index.rb | db/migrate/20120917232121_update_credit_cards_stripe_fingerprint_index.rb | # frozen_string_literal: true
class UpdateCreditCardsStripeFingerprintIndex < ActiveRecord::Migration
def up
remove_index :credit_cards, name: "index_credit_cards_on_stripe_fingerprint"
add_index :credit_cards, [:stripe_fingerprint], unique: true, name: "index_credit_cards_on_stripe_fingerprint_unique"
end
def down
remove_index :credit_cards, name: "index_credit_cards_on_stripe_fingerprint_unique"
add_index :credit_cards, [:stripe_fingerprint], name: "index_credit_cards_on_stripe_fingerprint"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230227210525_create_user_recommended_root_taxonomies.rb | db/migrate/20230227210525_create_user_recommended_root_taxonomies.rb | # frozen_string_literal: true
class CreateUserRecommendedRootTaxonomies < ActiveRecord::Migration[7.0]
def change
create_table :user_recommended_root_taxonomies do |t|
t.references :user, null: false, index: false
t.references :taxonomy, null: false, index: false
t.integer :position, null: false
t.timestamps
t.index [:user_id, :position]
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140822200030_add_position_to_product_files.rb | db/migrate/20140822200030_add_position_to_product_files.rb | # frozen_string_literal: true
class AddPositionToProductFiles < ActiveRecord::Migration
def change
add_column :product_files, :position, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140902220133_add_link_id_index_to_base_variants.rb | db/migrate/20140902220133_add_link_id_index_to_base_variants.rb | # frozen_string_literal: true
class AddLinkIdIndexToBaseVariants < ActiveRecord::Migration
def change
add_index :base_variants, :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/20130219215825_add_locale_to_users.rb | db/migrate/20130219215825_add_locale_to_users.rb | # frozen_string_literal: true
class AddLocaleToUsers < ActiveRecord::Migration
def change
add_column :users, :locale, :string, default: "en"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210121062551_add_missing_indexes_to_user.rb | db/migrate/20210121062551_add_missing_indexes_to_user.rb | # frozen_string_literal: true
class AddMissingIndexesToUser < ActiveRecord::Migration[6.0]
def change
change_table :users do |t|
t.index :current_sign_in_ip
t.index :last_sign_in_ip
t.index :account_created_ip
t.index :user_risk_state
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220415204825_add_top_seller_requests_index.rb | db/migrate/20220415204825_add_top_seller_requests_index.rb | # frozen_string_literal: true
class AddTopSellerRequestsIndex < ActiveRecord::Migration[6.1]
def up
if Rails.env.production? || Rails.env.staging?
TopSellerRequest.__elasticsearch__.create_index!(index: "top_seller_requests_v1")
EsClient.indices.put_alias(name: "top_seller_requests", index: "top_seller_requests_v1")
else
TopSellerRequest.__elasticsearch__.create_index!
end
end
def down
if Rails.env.production? || Rails.env.staging?
EsClient.indices.delete_alias(name: "top_seller_requests", index: "top_seller_requests_v1")
TopSellerRequest.__elasticsearch__.delete_index!(index: "top_seller_requests_v1")
else
TopSellerRequest.__elasticsearch__.delete_index!
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230125154851_create_upsells_products.rb | db/migrate/20230125154851_create_upsells_products.rb | # frozen_string_literal: true
class CreateUpsellsProducts < ActiveRecord::Migration[7.0]
def change
create_table :upsells_products do |t|
t.references :upsell, null: false
t.references :product, null: false
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/20121115033310_remove_session_id_as_index_on_purchases.rb | db/migrate/20121115033310_remove_session_id_as_index_on_purchases.rb | # frozen_string_literal: true
class RemoveSessionIdAsIndexOnPurchases < ActiveRecord::Migration
def up
remove_index :purchases, :session_id
end
def down
add_index :purchases, :session_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210106035128_add_missing_indices_to_purchases.rb | db/migrate/20210106035128_add_missing_indices_to_purchases.rb | # frozen_string_literal: true
class AddMissingIndicesToPurchases < ActiveRecord::Migration[6.0]
def up
execute <<~SQL
ALTER TABLE purchases CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
add index index_purchases_on_seller_id_and_succeeded_at (seller_id, succeeded_at),
add index index_purchases_on_seller_id_and_chargeback_date (seller_id, chargeback_date),
add index index_purchases_on_affiliate_id_and_created_at (affiliate_id, created_at),
MODIFY `email` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `displayed_price_currency_type` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT "usd",
MODIFY `rate_converted_to_usd` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `street_address` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `city` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `state` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `zip_code` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `country` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `full_name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `purchaser_type` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT "User",
MODIFY `session_id` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `ip_address` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `stripe_transaction_id` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `stripe_fingerprint` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `stripe_card_id` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `subunsub` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `referrer` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `stripe_status` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `variants` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `card_type` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `card_visual` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `purchase_state` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `card_country` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `stripe_error_code` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `browser_guid` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `error_code` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `card_bin` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `custom_fields` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `ip_country` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `ip_state` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `billing_name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `billing_zip_code` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `credit_card_zipcode` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `json_data` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `card_data_handling_mode` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `charge_processor_id` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY `processor_fee_cents_currency` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT "usd",
MODIFY `paypal_order_id` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
SQL
end
def down
execute <<~SQL
ALTER TABLE purchases CHARACTER SET utf8 COLLATE utf8_unicode_ci,
drop index index_purchases_on_seller_id_and_succeeded_at,
drop index index_purchases_on_seller_id_and_chargeback_date,
drop index index_purchases_on_affiliate_id_and_created_at,
MODIFY `email` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `displayed_price_currency_type` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT "usd",
MODIFY `rate_converted_to_usd` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `street_address` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `city` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `state` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `zip_code` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `country` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `full_name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `purchaser_type` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT "User",
MODIFY `session_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `ip_address` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `stripe_transaction_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `stripe_fingerprint` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `stripe_card_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `subunsub` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `referrer` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `stripe_status` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `variants` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `card_type` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `card_visual` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `purchase_state` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `card_country` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `stripe_error_code` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `browser_guid` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `error_code` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `card_bin` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `custom_fields` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `ip_country` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `ip_state` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `billing_name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `billing_zip_code` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `credit_card_zipcode` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `json_data` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `card_data_handling_mode` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `charge_processor_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
MODIFY `processor_fee_cents_currency` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT "usd",
MODIFY `paypal_order_id` VARCHAR(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci
SQL
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20200525223103_add_position_to_base_variants.rb | db/migrate/20200525223103_add_position_to_base_variants.rb | # frozen_string_literal: true
class AddPositionToBaseVariants < ActiveRecord::Migration
def change
add_column :base_variants, :position_in_category, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240730154256_add_call_start_time_to_cart_products.rb | db/migrate/20240730154256_add_call_start_time_to_cart_products.rb | # frozen_string_literal: true
class AddCallStartTimeToCartProducts < ActiveRecord::Migration[7.1]
def change
add_column :cart_products, :call_start_time, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20200927050534_sync_tables_default_charsets.rb | db/migrate/20200927050534_sync_tables_default_charsets.rb | # 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",
"affiliates_links" => "CHARACTER SET latin1",
"asset_previews" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"balance_transactions" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"balances" => "CHARACTER SET latin1",
"bank_accounts" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"banks" => "CHARACTER SET latin1",
"base_variants" => "CHARACTER SET utf8mb4",
"base_variants_product_files" => "CHARACTER SET latin1",
"base_variants_purchases" => "CHARACTER SET latin1",
"bins" => "CHARACTER SET latin1",
"blocked_ips" => "CHARACTER SET latin1",
"categories" => "CHARACTER SET latin1",
"comments" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"computed_sales_analytics_days" => "CHARACTER SET latin1",
"consumption_events" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"credit_cards" => "CHARACTER SET latin1",
"credits" => "CHARACTER SET latin1",
"custom_domains" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"delayed_emails" => "CHARACTER SET latin1",
"devices" => "CHARACTER SET latin1",
"disputes" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"dropbox_files" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"dynamic_product_page_switch_assignments" => "CHARACTER SET latin1",
"dynamic_product_page_switches" => "CHARACTER SET latin1",
"email_infos" => "CHARACTER SET utf8",
"event_test_path_assignments" => "CHARACTER SET latin1",
"events" => "CHARACTER SET latin1",
"failed_purchases" => "CHARACTER SET latin1",
"followers" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"friendly_id_slugs" => "CHARACTER SET latin1",
"gifts" => "CHARACTER SET utf8mb4",
"import_jobs" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"imported_customers" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"installment_events" => "CHARACTER SET latin1",
"installment_rules" => "CHARACTER SET latin1",
"installments" => "CHARACTER SET utf8mb4",
"invites" => "CHARACTER SET utf8mb4",
"large_sellers" => "CHARACTER SET latin1",
"licenses" => "CHARACTER SET utf8",
"links" => "CHARACTER SET utf8mb4",
"megaphone_states" => "CHARACTER SET latin1",
"merchant_accounts" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"messages" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"oauth_access_grants" => "CHARACTER SET latin1",
"oauth_access_tokens" => "CHARACTER SET latin1",
"oauth_applications" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"offer_codes" => "CHARACTER SET utf8mb4",
"parents_children" => "CHARACTER SET latin1",
"payment_options" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"payments" => "CHARACTER SET latin1",
"payments_balances" => "CHARACTER SET latin1",
"preorder_links" => "CHARACTER SET latin1",
"preorders" => "CHARACTER SET latin1",
"prices" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"processed_audios" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"product_categorizations" => "CHARACTER SET latin1",
"product_files" => "CHARACTER SET utf8mb4",
"product_files_archives" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"product_files_files_archives" => "CHARACTER SET latin1",
"product_review_stats" => "CHARACTER SET latin1",
"product_reviews" => "CHARACTER SET latin1",
"product_taggings" => "CHARACTER SET latin1",
"profile_tags" => "CHARACTER SET latin1",
"purchase_sales_tax_infos" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"purchases" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"recommended_purchase_infos" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"recurring_services" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"refunds" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"resource_subscriptions" => "CHARACTER SET latin1",
"sent_email_infos" => "CHARACTER SET latin1",
"service_charges" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"shipments" => "CHARACTER SET utf8mb4",
"shipping_destinations" => "CHARACTER SET utf8mb4",
"skus_variants" => "CHARACTER SET latin1",
"stamped_pdfs" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"subscriptions" => "CHARACTER SET latin1",
"subtitle_files" => "CHARACTER SET utf8mb4",
"tags" => "CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",
"third_party_analytics" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"tos_agreements" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"transcoded_videos" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"url_redirects" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"user_categorizations" => "CHARACTER SET latin1",
"user_compliance_info" => "CHARACTER SET utf8",
"user_compliance_info_requests" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"users" => "CHARACTER SET utf8mb4",
"variant_categories" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"versions" => "CHARACTER SET latin1",
"workflows" => "CHARACTER SET utf8mb4",
"zip_tax_rates" => "CHARACTER SET utf8 COLLATE utf8_unicode_ci"
}
safety_assured do
table_changes.each do |target_table_name, change_snippet|
exec_query "ALTER TABLE #{target_table_name} CONVERT TO #{change_snippet}"
end
exec_query "ALTER TABLE product_files_archives CHANGE url url varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT ''"
exec_query "ALTER TABLE transcoded_videos CHANGE original_video_key original_video_key varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT ''"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120420214602_drop_receipts_table.rb | db/migrate/20120420214602_drop_receipts_table.rb | # frozen_string_literal: true
class DropReceiptsTable < ActiveRecord::Migration
def up
drop_table :receipts
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/20150818073723_add_duration_to_link_and_occurence_to_subscription.rb | db/migrate/20150818073723_add_duration_to_link_and_occurence_to_subscription.rb | # frozen_string_literal: true
class AddDurationToLinkAndOccurenceToSubscription < ActiveRecord::Migration
def change
add_column :links, :duration_in_months, :integer
add_column :subscriptions, :charge_occurrence_count, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190427212700_remove_unused_tables.rb | db/migrate/20190427212700_remove_unused_tables.rb | # frozen_string_literal: true
class RemoveUnusedTables < ActiveRecord::Migration
def up
drop_table :ab_tests
drop_table :api_sessions
drop_table :assignments
drop_table :audit_tasks
drop_table :blocked_browser_guids
drop_table :daily_metrics
drop_table :purchase_codes
drop_table :sxsw_meetings
drop_table :test_paths
drop_table :twitter_merchants
drop_table :twitter_orders
drop_table :visits
end
def down
create_table "ab_tests", force: :cascade do |t|
t.string "name", limit: 191
t.string "page_name", limit: 191
t.boolean "is_active", default: false
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "ab_tests", ["name", "page_name"], name: "index_ab_tests_on_name_and_page_name", using: :btree
add_index "ab_tests", ["page_name"], name: "index_ab_tests_on_page_name", using: :btree
###
create_table "api_sessions", force: :cascade do |t|
t.integer "user_id", limit: 4
t.string "token", limit: 191
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "deleted_at"
end
add_index "api_sessions", ["token"], name: "index_api_sessions_on_token", using: :btree
add_index "api_sessions", ["user_id"], name: "index_api_sessions_on_user_id", using: :btree
###
create_table "assignments", force: :cascade do |t|
t.integer "ab_test_id", limit: 4
t.integer "test_path_id", limit: 4
t.string "browser_guid", limit: 191
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "assignments", ["browser_guid", "ab_test_id"], name: "index_assignments_on_browser_guid_and_ab_test_id", unique: true, using: :btree
add_index "assignments", ["test_path_id", "browser_guid"], name: "index_assignments_on_test_path_id_and_browser_guid", using: :btree
###
create_table "audit_tasks", force: :cascade do |t|
t.string "name", limit: 191
t.integer "owner_id", limit: 4
t.date "due_date"
t.string "status", limit: 191
t.integer "recurrence_days", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "audit_tasks", ["due_date"], name: "index_audit_tasks_on_due_date", using: :btree
add_index "audit_tasks", ["owner_id"], name: "index_audit_tasks_on_owner_id", using: :btree
add_index "audit_tasks", ["status"], name: "index_audit_tasks_on_status", using: :btree
###
create_table "blocked_browser_guids", force: :cascade do |t|
t.string "browser_guid", limit: 191
t.datetime "blocked_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "blocked_browser_guids", ["browser_guid"], name: "index_blocked_browser_guids_on_browser_guid", using: :btree
###
create_table "daily_metrics", force: :cascade do |t|
t.string "event_name", limit: 191
t.date "events_date"
t.integer "event_count", limit: 4
t.integer "user_count", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "source_type", limit: 191, default: "all"
end
add_index "daily_metrics", ["event_name", "events_date", "source_type"], name: "index_daily_metrics_on_event_name_events_date_and_source_type", unique: true, using: :btree
###
create_table "purchase_codes", force: :cascade do |t|
t.string "token", limit: 191
t.datetime "used_at"
t.datetime "expires_at"
t.integer "url_redirect_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "subscription_id", limit: 4
t.integer "purchase_id", limit: 4
end
add_index "purchase_codes", ["purchase_id"], name: "index_purchase_codes_on_purchase_id", using: :btree
add_index "purchase_codes", ["subscription_id"], name: "index_purchase_codes_on_subscription_id", using: :btree
add_index "purchase_codes", ["token"], name: "index_purchase_codes_on_token", using: :btree
add_index "purchase_codes", ["url_redirect_id"], name: "index_purchase_codes_on_url_redirect_id", using: :btree
###
create_table "sxsw_meetings", force: :cascade do |t|
t.string "email", limit: 191
t.string "name", limit: 191
t.integer "time_slot", limit: 4
t.boolean "confirmed"
t.text "message", limit: 65535
t.string "guest_name", limit: 191
t.string "guest_email", limit: 191
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
###
create_table "test_paths", force: :cascade do |t|
t.string "alternative_name", limit: 191
t.integer "ab_test_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "test_paths", ["ab_test_id", "alternative_name"], name: "index_assignments_on_ab_test_id_and_alternative_name", using: :btree
add_index "test_paths", ["alternative_name"], name: "index_assignments_on_alternative_name", using: :btree
###
create_table "twitter_merchants", force: :cascade do |t|
t.integer "user_id", limit: 4
t.string "email", limit: 191
t.string "name", limit: 191
t.string "support_email", limit: 191
t.string "domains", limit: 191
t.string "twitter_assigned_merchant_id", limit: 191
t.integer "flags", limit: 4, default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "twitter_merchants", ["twitter_assigned_merchant_id"], name: "index_twitter_merchants_on_twitter_assigned_merchant_id", using: :btree
add_index "twitter_merchants", ["user_id"], name: "index_twitter_merchants_on_user_id", using: :btree
###
create_table "twitter_orders", force: :cascade do |t|
t.integer "purchase_id", limit: 4
t.string "twitter_order_id", limit: 191
t.integer "order_timestamp", limit: 8
t.string "stripe_transaction_id", limit: 191
t.integer "charge_amount_micro_currency", limit: 4
t.string "charge_state", limit: 191
t.integer "tax_micro_currency", limit: 4
t.string "sku_id", limit: 191
t.string "tax_category", limit: 191
t.integer "sku_price_micro_currency", limit: 4
t.integer "quantity", limit: 4
t.string "twitter_handle", limit: 191
t.string "twitter_user_id", limit: 191
t.string "email", limit: 191
t.string "ip_address", limit: 191
t.string "device_id", limit: 191
t.string "full_name", limit: 191
t.string "street_address_1", limit: 191
t.string "street_address_2", limit: 191
t.string "city", limit: 191
t.string "zip_code", limit: 191
t.string "state", limit: 191
t.string "country", limit: 191
t.integer "tweet_view_timestamp", limit: 8
t.string "tweet_id", limit: 191
t.integer "flags", limit: 4, default: 0, null: false
t.text "json_data", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "user_agent", limit: 191
end
add_index "twitter_orders", ["email"], name: "index_twitter_orders_on_email", using: :btree
add_index "twitter_orders", ["purchase_id"], name: "index_twitter_orders_on_purchase_id", using: :btree
add_index "twitter_orders", ["sku_id"], name: "index_twitter_orders_on_sku_id", using: :btree
add_index "twitter_orders", ["tweet_id"], name: "index_twitter_orders_on_tweet_id", using: :btree
add_index "twitter_orders", ["twitter_order_id"], name: "index_twitter_orders_on_twitter_order_id", using: :btree
###
create_table "visits", force: :cascade do |t|
t.string "ip_address", limit: 191
t.datetime "created_at"
t.string "entry_point", limit: 191
t.datetime "updated_at"
t.string "fingerprint", limit: 191
t.integer "user_id", limit: 4
t.boolean "is_modal"
t.string "browser_fingerprint", limit: 191
t.string "browser_guid", limit: 191
end
add_index "visits", ["browser_fingerprint"], name: "index_visits_on_browser_fingerprint", using: :btree
add_index "visits", ["browser_guid"], name: "index_visits_on_browser_guid", using: :btree
add_index "visits", ["created_at"], name: "index_visits_on_created_at", using: :btree
add_index "visits", ["entry_point"], name: "index_visits_on_entry_point", using: :btree
add_index "visits", ["fingerprint"], name: "index_visits_on_fingerprint", using: :btree
add_index "visits", ["ip_address"], name: "index_visits_on_ip_address", using: :btree
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20211222010343_create_sales_export_chunks.rb | db/migrate/20211222010343_create_sales_export_chunks.rb | # 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, default: false, null: false
t.string :revision
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/20111201183301_disabled_at.rb | db/migrate/20111201183301_disabled_at.rb | # frozen_string_literal: true
class DisabledAt < ActiveRecord::Migration
def up
add_column :links, :purchase_disabled_at, :datetime
end
def down
remove_column :links, :purchase_disabled_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/20210609090425_drop_blocked_ip.rb | db/migrate/20210609090425_drop_blocked_ip.rb | # frozen_string_literal: true
class DropBlockedIp < ActiveRecord::Migration[6.1]
def up
drop_table :blocked_ips
end
def down
create_table "blocked_ips", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.string "ip_address"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "banned"
t.datetime "banned_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/20150402215254_add_tracking_number_and_carrier_to_shipment.rb | db/migrate/20150402215254_add_tracking_number_and_carrier_to_shipment.rb | # frozen_string_literal: true
class AddTrackingNumberAndCarrierToShipment < ActiveRecord::Migration
def change
add_column :shipments, :tracking_number, :string
add_column :shipments, :carrier, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111206214227_user_verification.rb | db/migrate/20111206214227_user_verification.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20211213122919_add_asset_previews_index_to_deleted_at.rb | db/migrate/20211213122919_add_asset_previews_index_to_deleted_at.rb | # frozen_string_literal: true
class AddAssetPreviewsIndexToDeletedAt < ActiveRecord::Migration[6.1]
def up
change_table :asset_previews, bulk: true do |t|
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :link_id, :bigint
t.index :deleted_at
end
end
def down
change_table :asset_previews, bulk: true do |t|
t.change :id, :integer, null: false, unique: true, auto_increment: true
t.change :link_id, :integer
t.remove_index :deleted_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/20150709201644_create_custom_domains.rb | db/migrate/20150709201644_create_custom_domains.rb | # frozen_string_literal: true
class CreateCustomDomains < ActiveRecord::Migration
def change
create_table :custom_domains, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :user
t.string :domain
t.string :type
t.timestamps
end
add_index :custom_domains, :user_id
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/20150909000000_create_disputes.rb | db/migrate/20150909000000_create_disputes.rb | # frozen_string_literal: true
class CreateDisputes < ActiveRecord::Migration
def change
create_table :disputes, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :purchase
t.string :charge_processor_id
t.string :charge_processor_dispute_id
t.string :reason
t.string :state
t.datetime :initiated_at
t.datetime :closed_at
t.datetime :formalized_at
t.datetime :won_at
t.datetime :lost_at
end
add_index :disputes, :purchase_id
add_column :credits, :dispute_id, :integer
add_index :credits, :dispute_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190715141316_add_vat_id_to_purchase_sales_tax_infos.rb | db/migrate/20190715141316_add_vat_id_to_purchase_sales_tax_infos.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220608012107_remove_links_index_purchase_disabled_at.rb | db/migrate/20220608012107_remove_links_index_purchase_disabled_at.rb | # frozen_string_literal: true
class RemoveLinksIndexPurchaseDisabledAt < ActiveRecord::Migration[6.1]
def up
remove_index :links, :purchase_disabled_at
end
def down
add_index :links, :purchase_disabled_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130625001834_create_dynamic_product_page_switch_assignments.rb | db/migrate/20130625001834_create_dynamic_product_page_switch_assignments.rb | # frozen_string_literal: true
class CreateDynamicProductPageSwitchAssignments < ActiveRecord::Migration
def change
create_table :dynamic_product_page_switch_assignments do |t|
t.references :link
t.references :dynamic_product_page_switch
t.integer :switch_value
t.datetime :deleted_at
t.timestamps
end
add_index :dynamic_product_page_switch_assignments, [:link_id, :dynamic_product_page_switch_id], name: "index_dynamic_product_page_assignments_on_link_id_and_switch_id"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240206135412_create_cart_products.rb | db/migrate/20240206135412_create_cart_products.rb | # frozen_string_literal: true
class CreateCartProducts < ActiveRecord::Migration[7.0]
def change
create_table :cart_products do |t|
t.references :cart, null: false
t.references :product, null: false
t.references :option, index: false
t.references :affiliate, index: false
t.references :accepted_offer, index: false
t.bigint :price, null: false
t.integer :quantity, null: false
t.string :recurrence
t.string :recommended_by
t.boolean :rent, default: false, null: false
t.json :url_parameters
t.text :referrer, size: :long, null: false
t.string :recommender_model_name
t.timestamps
end
add_index :cart_products, [:cart_id, :product_id], 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/20240408073222_make_charge_processor_and_merchant_account_id_nullable.rb | db/migrate/20240408073222_make_charge_processor_and_merchant_account_id_nullable.rb | # frozen_string_literal: true
class MakeChargeProcessorAndMerchantAccountIdNullable < ActiveRecord::Migration[7.1]
def up
change_table :charges, bulk: true do |t|
t.change :processor, :string, null: true
t.change :merchant_account_id, :bigint, null: true
end
end
def down
change_table :charges, bulk: true do |t|
t.change :processor, :string, null: false
t.change :merchant_account_id, :bigint, 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/20150520200000_add_merchant_id_to_balances.rb | db/migrate/20150520200000_add_merchant_id_to_balances.rb | # 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
remove_index :balances, column: [:user_id, :date]
end
def down
remove_column :balances, :merchant_account_id
remove_index :balances, column: [:user_id, :merchant_account_id, :date]
add_index :balances, [:user_id, :date], 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/20150805170243_create_base_variants_product_files_join_table.rb | db/migrate/20150805170243_create_base_variants_product_files_join_table.rb | # 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 :base_variants_product_files, :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/20121018221916_add_browser_fingerprint_to_events_and_visits.rb | db/migrate/20121018221916_add_browser_fingerprint_to_events_and_visits.rb | # 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_fingerprint
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210405195451_add_free_trial_ends_at_to_subscriptions.rb | db/migrate/20210405195451_add_free_trial_ends_at_to_subscriptions.rb | # frozen_string_literal: true
class AddFreeTrialEndsAtToSubscriptions < ActiveRecord::Migration[6.1]
def change
add_column :subscriptions, :free_trial_ends_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/20131204033717_remove_name_index_from_oauth_applications.rb | db/migrate/20131204033717_remove_name_index_from_oauth_applications.rb | # frozen_string_literal: true
class RemoveNameIndexFromOauthApplications < ActiveRecord::Migration
def up
remove_index :oauth_applications, :name
end
def down
add_index :oauth_applications, :name, 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/20150709181910_fix_processed_audio_charset.rb | db/migrate/20150709181910_fix_processed_audio_charset.rb | # frozen_string_literal: true
class FixProcessedAudioCharset < ActiveRecord::Migration
def change
execute("ALTER TABLE processed_audios CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;")
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230517152234_remove_users_recommendation_type_default.rb | db/migrate/20230517152234_remove_users_recommendation_type_default.rb | # frozen_string_literal: true
class RemoveUsersRecommendationTypeDefault < ActiveRecord::Migration[7.0]
def up
Alterity.disable do
change_column_default :users, :recommendation_type, nil
end
end
def down
Alterity.disable do
change_column_default :users, :recommendation_type, "same_creator_products"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210723170128_create_media_location.rb | db/migrate/20210723170128_create_media_location.rb | # frozen_string_literal: true
class CreateMediaLocation < ActiveRecord::Migration[6.1]
def change
create_table :media_locations do |t|
t.integer :product_file_id, null: false
t.integer :url_redirect_id, null: false
t.integer :purchase_id, null: false
t.integer :link_id, null: false
t.datetime :consumed_at
t.string :platform
t.integer :location, null: false
t.integer :content_length, null: false
t.string :unit, null: false
t.timestamps
end
add_index :media_locations, :product_file_id
add_index :media_locations, :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/20181026094910_add_search_indexes.rb | db/migrate/20181026094910_add_search_indexes.rb | # frozen_string_literal: true
class AddSearchIndexes < ActiveRecord::Migration
def change
add_index :users, :name
add_index :gifts, :giftee_email
add_index :purchases, :full_name
add_index :subscriptions, :cancelled_at
add_index :subscriptions, :failed_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111118195144_add_guid_to_attachment.rb | db/migrate/20111118195144_add_guid_to_attachment.rb | # frozen_string_literal: true
class AddGuidToAttachment < ActiveRecord::Migration
def change
add_column :attachments, :file_guid, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20131023021154_create_affiliate_credits.rb | db/migrate/20131023021154_create_affiliate_credits.rb | # frozen_string_literal: true
class CreateAffiliateCredits < ActiveRecord::Migration
def change
create_table :affiliate_credits do |t|
t.references :oauth_application
t.integer :basis_points
t.integer :amount_cents
t.integer :oauth_application_owner_id
t.integer :seller_id
t.integer :purchase_id
t.integer :link_id
t.integer :affiliate_credit_success_balance_id
t.integer :affiliate_credit_chargeback_balance_id
t.integer :affiliate_credit_refund_balance_id
t.timestamps
end
add_index :affiliate_credits, :purchase_id
add_index :affiliate_credits, :oauth_application_owner_id
add_index :affiliate_credits, :seller_id
add_index :affiliate_credits, :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/20210225132913_add_otp_secret_key_to_users.rb | db/migrate/20210225132913_add_otp_secret_key_to_users.rb | # frozen_string_literal: true
class AddOtpSecretKeyToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :otp_secret_key, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240615052751_add_total_usd_cents_to_product_cached_value.rb | db/migrate/20240615052751_add_total_usd_cents_to_product_cached_value.rb | # frozen_string_literal: true
class AddTotalUsdCentsToProductCachedValue < ActiveRecord::Migration[7.1]
def change
add_column :product_cached_values, :total_usd_cents, :bigint, default: 0
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120124192926_create_api_sessions.rb | db/migrate/20120124192926_create_api_sessions.rb | # frozen_string_literal: true
class CreateApiSessions < ActiveRecord::Migration
def change
create_table :api_sessions do |t|
t.integer :user_id
t.string :token
t.timestamps
end
add_index :api_sessions, :user_id
add_index :api_sessions, :token
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230616124032_add_audience_members_purchased_variant_ids.rb | db/migrate/20230616124032_add_audience_members_purchased_variant_ids.rb | # frozen_string_literal: true
class AddAudienceMembersPurchasedVariantIds < ActiveRecord::Migration[7.0]
def up
change_table :audience_members, bulk: true do |t|
t.remove_index name: :idx_audience_on_seller_and_purchases_variants_ids
t.index "`seller_id`, (cast(json_extract(`details`,_utf8mb4'$.purchases[*].variant_ids[*]') as unsigned array))", name: "idx_audience_on_seller_and_purchases_variants_ids"
end
end
def down
change_table :audience_members, bulk: true do |t|
t.remove_index name: :idx_audience_on_seller_and_purchases_variants_ids
t.index "`seller_id`, (cast(json_extract(`details`,_utf8mb4'$.purchases[*].variant_id') as unsigned array))", name: "idx_audience_on_seller_and_purchases_variants_ids"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240423133545_add_fractional_seconds_to_papertrail_created_at.rb | db/migrate/20240423133545_add_fractional_seconds_to_papertrail_created_at.rb | # frozen_string_literal: true
class AddFractionalSecondsToPapertrailCreatedAt < ActiveRecord::Migration[7.1]
def up
change_column :versions, :created_at, :datetime, limit: 6
end
def down
change_column :versions, :created_at, :datetime, precision: nil
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231021143022_remove_submitted_at_on_dispute_evidences.rb | db/migrate/20231021143022_remove_submitted_at_on_dispute_evidences.rb | # frozen_string_literal: true
class RemoveSubmittedAtOnDisputeEvidences < ActiveRecord::Migration[7.0]
def up
remove_column :dispute_evidences, :submitted_at
end
def down
change_table :dispute_evidences, bulk: true do |t|
t.datetime :submitted_at
t.index :submitted_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/20150812000000_add_is_business_publicly_traded_to_user_compliance_info.rb | db/migrate/20150812000000_add_is_business_publicly_traded_to_user_compliance_info.rb | # frozen_string_literal: true
class AddIsBusinessPubliclyTradedToUserComplianceInfo < ActiveRecord::Migration
def change
add_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/20230414060233_create_post_email_blasts.rb | db/migrate/20230414060233_create_post_email_blasts.rb | # frozen_string_literal: true
class CreatePostEmailBlasts < ActiveRecord::Migration[7.0]
def change
create_table :post_email_blasts do |t|
t.references :post, null: false, index: false
t.references :seller, null: false, index: false
t.datetime :requested_at, index: true
t.datetime :started_at
t.datetime :first_email_delivered_at
t.datetime :last_email_delivered_at
t.integer :delivery_count, default: 0
t.timestamps
t.index [:seller_id, :requested_at]
t.index [:post_id, :requested_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/20120628181932_add_referrer_to_purchases.rb | db/migrate/20120628181932_add_referrer_to_purchases.rb | # frozen_string_literal: true
class AddReferrerToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :referrer, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20241008140243_remove_unique_index_constraint_from_refunds_processor_refund_id.rb | db/migrate/20241008140243_remove_unique_index_constraint_from_refunds_processor_refund_id.rb | # frozen_string_literal: true
class RemoveUniqueIndexConstraintFromRefundsProcessorRefundId < ActiveRecord::Migration[7.1]
def up
change_table :refunds, bulk: true do |t|
t.remove_index :processor_refund_id
t.index :processor_refund_id
end
end
def down
change_table :refunds, bulk: true do |t|
t.remove_index :processor_refund_id
t.index :processor_refund_id, 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/20231025113632_add_first_published_at_to_workflows.rb | db/migrate/20231025113632_add_first_published_at_to_workflows.rb | # frozen_string_literal: true
class AddFirstPublishedAtToWorkflows < ActiveRecord::Migration[7.0]
def change
add_column :workflows, :first_published_at, :datetime, precision: nil
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210605062909_drop_audience_landing_page_view_events.rb | db/migrate/20210605062909_drop_audience_landing_page_view_events.rb | # frozen_string_literal: true
class DropAudienceLandingPageViewEvents < ActiveRecord::Migration[6.1]
def up
drop_table :audience_landing_page_view_events
end
def down
create_table "audience_landing_page_view_events", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.string "ip_address"
t.bigint "user_id"
t.bigint "link_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "referrer"
t.string "parent_referrer"
t.string "language"
t.string "browser"
t.boolean "is_mobile", default: false
t.string "email"
t.integer "price_cents"
t.string "view_url"
t.string "fingerprint"
t.string "ip_country"
t.float "ip_longitude"
t.float "ip_latitude"
t.boolean "is_modal"
t.string "browser_fingerprint"
t.string "browser_plugins"
t.string "browser_guid"
t.string "referrer_domain"
t.string "ip_state"
t.bigint "visited_user_id"
t.index ["browser_guid"], name: "index_browser_guid"
t.index ["created_at"], name: "index_created_at"
t.index ["ip_address"], name: "index_ip_address"
t.index ["link_id", "created_at"], name: "index_link_id_and_created_at"
t.index ["user_id"], name: "index_user_id"
t.index ["visited_user_id", "created_at"], name: "index_visited_user_id_and_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/20120117000944_add_rate_purchase.rb | db/migrate/20120117000944_add_rate_purchase.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120528234055_add_country_to_users.rb | db/migrate/20120528234055_add_country_to_users.rb | # frozen_string_literal: true
class AddCountryToUsers < ActiveRecord::Migration
def change
add_column :users, :country, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220223153011_add_unsplash_url_to_thumbnail.rb | db/migrate/20220223153011_add_unsplash_url_to_thumbnail.rb | # frozen_string_literal: true
class AddUnsplashUrlToThumbnail < ActiveRecord::Migration[6.1]
def change
add_column :thumbnails, :unsplash_url, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140507034709_add_card_data_handling_to_credit_card.rb | db/migrate/20140507034709_add_card_data_handling_to_credit_card.rb | # frozen_string_literal: true
class AddCardDataHandlingToCreditCard < ActiveRecord::Migration
def change
add_column :credit_cards, :card_data_handling_mode, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210529190819_create_product_folders.rb | db/migrate/20210529190819_create_product_folders.rb | # frozen_string_literal: true
class CreateProductFolders < ActiveRecord::Migration[6.1]
def change
create_table :product_folders do |t|
t.bigint :product_id, index: true
t.string :name
t.integer :position
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/20230706124923_remove_link_id_from_affiliates.rb | db/migrate/20230706124923_remove_link_id_from_affiliates.rb | # frozen_string_literal: true
class RemoveLinkIdFromAffiliates < ActiveRecord::Migration[7.0]
def up
remove_column :affiliates, :link_id
end
def down
change_table :affiliates, bulk: true do |t|
t.bigint :link_id
t.index :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/20191006031318_add_installments_events_cache_count.rb | db/migrate/20191006031318_add_installments_events_cache_count.rb | # frozen_string_literal: true
class AddInstallmentsEventsCacheCount < ActiveRecord::Migration
def up
add_column :installments, :installment_events_count, :integer
end
def down
remove_column :installments, :installment_events_count
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190513150807_remove_flags_from_import_jobs_and_third_party_analytics.rb | db/migrate/20190513150807_remove_flags_from_import_jobs_and_third_party_analytics.rb | # frozen_string_literal: true
class RemoveFlagsFromImportJobsAndThirdPartyAnalytics < ActiveRecord::Migration
def change
remove_column :import_jobs, :flags
remove_column :third_party_analytics, :flags
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231101092721_add_user_compliance_info_requests_index_on_user_id_and_state.rb | db/migrate/20231101092721_add_user_compliance_info_requests_index_on_user_id_and_state.rb | # frozen_string_literal: true
class AddUserComplianceInfoRequestsIndexOnUserIdAndState < ActiveRecord::Migration[7.0]
def change
add_index :user_compliance_info_requests, [:user_id, :state]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121231043404_add_customized_file_url_to_url_redirects.rb | db/migrate/20121231043404_add_customized_file_url_to_url_redirects.rb | # frozen_string_literal: true
class AddCustomizedFileUrlToUrlRedirects < ActiveRecord::Migration
def change
add_column :url_redirects, :customized_file_url, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230303073007_drop_product_embeddings.rb | db/migrate/20230303073007_drop_product_embeddings.rb | # frozen_string_literal: true
class DropProductEmbeddings < ActiveRecord::Migration[7.0]
def up
drop_table :product_embeddings
end
def down
create_table "product_embeddings", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.bigint "product_id", null: false
t.text "body", size: :medium
t.json "vector"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["product_id"], name: "index_product_embeddings_on_product_id", 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/20230411194853_remove_unbannable_from_users.rb | db/migrate/20230411194853_remove_unbannable_from_users.rb | # frozen_string_literal: true
class RemoveUnbannableFromUsers < ActiveRecord::Migration[7.0]
def change
remove_column :users, :unbannable, :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/20190112220320_add_deleted_from_cdn_at_to_product_files_archive.rb | db/migrate/20190112220320_add_deleted_from_cdn_at_to_product_files_archive.rb | # frozen_string_literal: true
class AddDeletedFromCdnAtToProductFilesArchive < ActiveRecord::Migration
def change
add_column :product_files_archives, :deleted_from_cdn_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/20130109002305_add_subscription_id_to_url_redirects.rb | db/migrate/20130109002305_add_subscription_id_to_url_redirects.rb | # frozen_string_literal: true
class AddSubscriptionIdToUrlRedirects < ActiveRecord::Migration
def change
add_column :url_redirects, :subscription_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/20120703060331_create_delayed_emails.rb | db/migrate/20120703060331_create_delayed_emails.rb | # frozen_string_literal: true
class CreateDelayedEmails < ActiveRecord::Migration
def change
create_table :delayed_emails do |t|
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/20130516174229_add_owner_to_application.rb | db/migrate/20130516174229_add_owner_to_application.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150527232652_add_subscription_id_to_purchase_codes.rb | db/migrate/20150527232652_add_subscription_id_to_purchase_codes.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111110203904_add_index_to_permalink.rb | db/migrate/20111110203904_add_index_to_permalink.rb | # frozen_string_literal: true
class AddIndexToPermalink < ActiveRecord::Migration
def up
add_index :links, :unique_permalink
end
def down
remove_index :links, :unique_permalink
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120330211428_add_purchaser_id_and_credit_card_id_to_purchases.rb | db/migrate/20120330211428_add_purchaser_id_and_credit_card_id_to_purchases.rb | # frozen_string_literal: true
class AddPurchaserIdAndCreditCardIdToPurchases < ActiveRecord::Migration
def change
change_table :purchases do |t|
t.references :credit_card
t.rename :user_id, :seller_id
t.references :purchaser, polymorphic: { default: "User" }
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150129045401_add_total_transaction_cents_to_refunds.rb | db/migrate/20150129045401_add_total_transaction_cents_to_refunds.rb | # frozen_string_literal: true
class AddTotalTransactionCentsToRefunds < ActiveRecord::Migration
def change
add_column :refunds, :total_transaction_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/20210723152944_drop_fraud_refunds.rb | db/migrate/20210723152944_drop_fraud_refunds.rb | # frozen_string_literal: true
class DropFraudRefunds < ActiveRecord::Migration[6.1]
def up
drop_table :fraud_refunds
end
def down
create_table :fraud_refunds do |t|
t.bigint :refund_id, index: { unique: true }, null: false
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/20230203130729_create_gumroad_daily_analytics.rb | db/migrate/20230203130729_create_gumroad_daily_analytics.rb | # frozen_string_literal: true
class CreateGumroadDailyAnalytics < ActiveRecord::Migration[7.0]
def change
create_table :gumroad_daily_analytics do |t|
t.datetime :period_ended_at, null: false
t.integer :gumroad_price_cents, null: false
t.integer :gumroad_fee_cents, null: false
t.integer :creators_with_sales, null: false
t.integer :gumroad_discover_price_cents, null: false
t.timestamps
t.index :period_ended_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/20210618181618_remove_followers_cancelled_at.rb | db/migrate/20210618181618_remove_followers_cancelled_at.rb | # frozen_string_literal: true
class RemoveFollowersCancelledAt < ActiveRecord::Migration[6.1]
def up
remove_column :followers, :cancelled_at
end
def down
add_column :followers, :cancelled_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/20230716005121_create_dispute_evidences.rb | db/migrate/20230716005121_create_dispute_evidences.rb | # frozen_string_literal: true
class CreateDisputeEvidences < ActiveRecord::Migration[7.0]
def change
create_table :dispute_evidences do |t|
t.references :dispute, null: false, index: { unique: true }
t.datetime :purchased_at
t.string :customer_purchase_ip
t.string :customer_email
t.string :customer_name
t.string :billing_address
t.string :shipping_address
t.string :shipped_at
t.string :shipping_carrier
t.string :shipping_tracking_number
t.text :uncategorized_text
t.datetime :submitted_at
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/20211115120503_add_refund_id_to_credits.rb | db/migrate/20211115120503_add_refund_id_to_credits.rb | # frozen_string_literal: true
class AddRefundIdToCredits < ActiveRecord::Migration[6.1]
def change
add_column :credits, :refund_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/20120113223706_add_currency_to_link.rb | db/migrate/20120113223706_add_currency_to_link.rb | # frozen_string_literal: true
class AddCurrencyToLink < ActiveRecord::Migration
def change
add_column :links, :price_currency_type, :string, default: :usd
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140707165710_add_charge_processor_id_to_purchase.rb | db/migrate/20140707165710_add_charge_processor_id_to_purchase.rb | # frozen_string_literal: true
class AddChargeProcessorIdToPurchase < ActiveRecord::Migration
def up
add_column :purchases, :charge_processor_id, :string
Purchase.update_all({ charge_processor_id: "stripe" }, "stripe_transaction_id IS NOT NULL")
end
def down
remove_column :purchases, :charge_processor_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150128210138_add_zip_tax_rate_association_to_purchases.rb | db/migrate/20150128210138_add_zip_tax_rate_association_to_purchases.rb | # frozen_string_literal: true
class AddZipTaxRateAssociationToPurchases < ActiveRecord::Migration
def change
change_table :purchases do |t|
t.belongs_to :zip_tax_rate
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20221103083945_add_missing_analytics_fields_to_purchases_index.rb | db/migrate/20221103083945_add_missing_analytics_fields_to_purchases_index.rb | # frozen_string_literal: true
class AddMissingAnalyticsFieldsToPurchasesIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
# new fields
ip_country: { type: "keyword" },
ip_state: { type: "keyword" },
referrer_domain: { type: "keyword" },
# flattened nested fields
affiliate_credit_id: { type: "long" },
affiliate_credit_affiliate_user_id: { type: "long" },
affiliate_credit_amount_cents: { type: "long" },
affiliate_credit_amount_partially_refunded_cents: { type: "long" },
product_id: { type: "long" },
product_unique_permalink: { type: "keyword" },
product_name: { type: "text", analyzer: "product_name", search_analyzer: "search_product_name" },
product_description: { type: "text" },
seller_id: { type: "long" },
seller_name: { type: "text", analyzer: "full_name", search_analyzer: "search_full_name" },
purchaser_id: { type: "long" },
subscription_id: { type: "long" },
subscription_cancelled_at: { type: "date" },
subscription_deactivated_at: { type: "date" }
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150514183650_create_prices.rb | db/migrate/20150514183650_create_prices.rb | # 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 :recurrence
t.timestamps
t.datetime :deleted_at
t.integer :flags, default: 0, null: false
end
add_index :prices, :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/20241031173126_add_deletable_stamped_pdfs.rb | db/migrate/20241031173126_add_deletable_stamped_pdfs.rb | # frozen_string_literal: true
class AddDeletableStampedPdfs < ActiveRecord::Migration[7.1]
def up
change_table :stamped_pdfs, bulk: true do |t|
# new columns / indexes
t.datetime :deleted_at, index: true
t.datetime :deleted_from_cdn_at, index: true
t.index :url
t.index :created_at
# standardization
t.change :id, :bigint, null: false, auto_increment: true
t.change :url_redirect_id, :bigint
t.change :product_file_id, :bigint
t.change :created_at, :datetime, limit: 6
t.change :updated_at, :datetime, limit: 6
end
end
def down
change_table :stamped_pdfs, bulk: true do |t|
t.remove :deleted_at
t.remove :deleted_from_cdn_at
t.remove_index :url
t.remove_index :created_at
t.change :id, :int, null: false, auto_increment: true
t.change :url_redirect_id, :int
t.change :product_file_id, :int
t.change :created_at, :datetime, precision: nil
t.change :updated_at, :datetime, precision: nil
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231031032827_add_is_bundle_to_products_index.rb | db/migrate/20231031032827_add_is_bundle_to_products_index.rb | # frozen_string_literal: true
class AddIsBundleToProductsIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
is_bundle: { type: "boolean" }
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111109221003_purchase_missing_attr.rb | db/migrate/20111109221003_purchase_missing_attr.rb | # frozen_string_literal: true
class PurchaseMissingAttr < ActiveRecord::Migration
def up
add_column :purchases, :owner, :string
add_column :purchases, :create_date, :integer
end
def down
remove_column :purchases, :owner
remove_column :purchases, :create_date
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130119005540_add_billing_name_and_zip_to_purchases.rb | db/migrate/20130119005540_add_billing_name_and_zip_to_purchases.rb | # frozen_string_literal: true
class AddBillingNameAndZipToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :billing_name, :string
add_column :purchases, :billing_zip_code, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20131008204429_add_installment_type_to_installments.rb | db/migrate/20131008204429_add_installment_type_to_installments.rb | # frozen_string_literal: true
class AddInstallmentTypeToInstallments < ActiveRecord::Migration
def change
add_column :installments, :installment_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/20111122005846_purchase_change_create_at_type.rb | db/migrate/20111122005846_purchase_change_create_at_type.rb | # frozen_string_literal: true
class PurchaseChangeCreateAtType < ActiveRecord::Migration
def change
change_column(:purchases, :created_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/20121115040801_remove_fingerprint_index_from_events.rb | db/migrate/20121115040801_remove_fingerprint_index_from_events.rb | # frozen_string_literal: true
class RemoveFingerprintIndexFromEvents < ActiveRecord::Migration
def up
remove_index "events", "fingerprint"
end
def down
add_index "events", "fingerprint"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240803162416_create_tips.rb | db/migrate/20240803162416_create_tips.rb | # frozen_string_literal: true
class CreateTips < ActiveRecord::Migration[7.1]
def change
create_table :tips do |t|
t.references :purchase, null: false
t.integer :value_cents, null: false
t.timestamps
end
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.