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/20240425095407_remove_rich_content_version_from_links.rb | db/migrate/20240425095407_remove_rich_content_version_from_links.rb | # frozen_string_literal: true
class RemoveRichContentVersionFromLinks < ActiveRecord::Migration[7.1]
def up
remove_column :links, :rich_content_version
end
def down
add_column :links, :rich_content_version, :integer, default: 1
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111109225157_default.rb | db/migrate/20111109225157_default.rb | # frozen_string_literal: true
class Default < ActiveRecord::Migration
def up
change_column_default(:links, :price, 1.00)
change_column_default(:links, :length_of_exclusivity, 0)
change_column_default(:links, :number_of_paid_downloads, 0)
change_column_default(:links, :number_of_downloads, 0)
change_column_default(:links, :download_limit, 0)
change_column_default(:links, :number_of_views, 0)
change_column_default(:links, :balance, 0.00)
change_column_default(:users, :balance, 0.00)
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/20230524193841_add_staff_picked_at_to_products_index.rb | db/migrate/20230524193841_add_staff_picked_at_to_products_index.rb | # frozen_string_literal: true
class AddStaffPickedAtToProductsIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
staff_picked_at: { type: "date" }
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231228200056_remove_membership_price_migration_attributes.rb | db/migrate/20231228200056_remove_membership_price_migration_attributes.rb | # frozen_string_literal: true
class RemoveMembershipPriceMigrationAttributes < ActiveRecord::Migration[7.0]
def up
change_table :prices, bulk: true do |t|
t.remove :archived_at
t.remove :base_tier_price
end
end
def down
change_table :prices, bulk: true do |t|
t.column :archived_at, :datetime
t.column :base_tier_price, :boolean
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121203174115_add_ip_state_country_to_purchases.rb | db/migrate/20121203174115_add_ip_state_country_to_purchases.rb | # frozen_string_literal: true
class AddIpStateCountryToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :ip_country, :string
add_column :purchases, :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/20120713193957_add_custom_filetype_to_links.rb | db/migrate/20120713193957_add_custom_filetype_to_links.rb | # frozen_string_literal: true
class AddCustomFiletypeToLinks < ActiveRecord::Migration
def change
add_column :links, :custom_filetype, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150416052056_create_purchase_sales_tax_info.rb | db/migrate/20150416052056_create_purchase_sales_tax_info.rb | # frozen_string_literal: true
class CreatePurchaseSalesTaxInfo < ActiveRecord::Migration
def change
create_table :purchase_sales_tax_infos, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :purchase
t.string :elected_country_code
t.string :card_country_code
t.string :ip_country_code
t.string :country_code
t.string :postal_code
t.string :ip_address
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121108005438_add_error_code_to_purchases.rb | db/migrate/20121108005438_add_error_code_to_purchases.rb | # frozen_string_literal: true
class AddErrorCodeToPurchases < ActiveRecord::Migration
def up
add_column :purchases, :error_code, :string
add_index :purchases, :error_code
end
def down
remove_column :purchases, :error_code
remove_index :purchases, :error_code
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130211200149_create_test_paths_table.rb | db/migrate/20130211200149_create_test_paths_table.rb | # frozen_string_literal: true
class CreateTestPathsTable < ActiveRecord::Migration
def change
create_table :test_paths do |t|
t.string :alternative_name
t.integer :ab_test_id
t.timestamps
end
add_index "test_paths", ["ab_test_id", "alternative_name"], name: "index_assignments_on_ab_test_id_and_alternative_name"
add_index "test_paths", "alternative_name", name: "index_assignments_on_alternative_name"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130730185223_add_index_on_oauth_application_name.rb | db/migrate/20130730185223_add_index_on_oauth_application_name.rb | # frozen_string_literal: true
class AddIndexOnOauthApplicationName < ActiveRecord::Migration
def up
add_index :oauth_applications, :name, unique: true
end
def down
remove_index :oauth_applications, :name
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20131008193413_add_seller_id_to_installments.rb | db/migrate/20131008193413_add_seller_id_to_installments.rb | # frozen_string_literal: true
class AddSellerIdToInstallments < ActiveRecord::Migration
def change
add_column :installments, :seller_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/20220429180649_add_type_to_integrations.rb | db/migrate/20220429180649_add_type_to_integrations.rb | # frozen_string_literal: true
class AddTypeToIntegrations < ActiveRecord::Migration[6.1]
def change
add_column :integrations, :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/20221012115921_change_default_rich_content_version_on_links.rb | db/migrate/20221012115921_change_default_rich_content_version_on_links.rb | # frozen_string_literal: true
class ChangeDefaultRichContentVersionOnLinks < ActiveRecord::Migration[6.1]
def up
change_column_default :links, :rich_content_version, 1
end
def down
change_column_default :links, :rich_content_version, 0
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231219084500_create_charge_purchases.rb | db/migrate/20231219084500_create_charge_purchases.rb | # frozen_string_literal: true
class CreateChargePurchases < ActiveRecord::Migration[7.0]
def change
create_table :charge_purchases do |t|
t.references :charge, null: false
t.references :purchase, 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/20210901054745_set_elasticsearch_indices_mappings_as_strictly_non_dynamic.rb | db/migrate/20210901054745_set_elasticsearch_indices_mappings_as_strictly_non_dynamic.rb | # frozen_string_literal: true
class SetElasticsearchIndicesMappingsAsStrictlyNonDynamic < ActiveRecord::Migration[6.1]
def up
[Link, Balance, Purchase, Installment, ConfirmedFollowerEvent].each do |model|
EsClient.indices.put_mapping(index: model.index_name, body: { dynamic: :strict })
end
end
def down
EsClient.indices.put_mapping(index: Link.index_name, body: { dynamic: true })
[Balance, Purchase, Installment, ConfirmedFollowerEvent].each do |model|
EsClient.indices.put_mapping(index: model.index_name, body: { dynamic: 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/20230803010349_remove_audience_members_multivalued_indexes.rb | db/migrate/20230803010349_remove_audience_members_multivalued_indexes.rb | # frozen_string_literal: true
class RemoveAudienceMembersMultivaluedIndexes < ActiveRecord::Migration[7.0]
def up
change_table :audience_members, bulk: true do |t|
t.remove_index name: :idx_audience_on_seller_and_purchases_countries
t.remove_index name: :idx_audience_on_seller_and_purchases_products_ids
t.remove_index name: :idx_audience_on_seller_and_purchases_variants_ids
end
end
def down
change_table :audience_members, bulk: true do |t|
t.index "`seller_id`, (cast(json_extract(`details`,_utf8mb4'$.purchases[*].country') as char(100) array))", name: "idx_audience_on_seller_and_purchases_countries"
t.index "`seller_id`, (cast(json_extract(`details`,_utf8mb4'$.purchases[*].product_id') as unsigned array))", name: "idx_audience_on_seller_and_purchases_products_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
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240324013211_add_flags_to_orders.rb | db/migrate/20240324013211_add_flags_to_orders.rb | # frozen_string_literal: true
class AddFlagsToOrders < ActiveRecord::Migration[7.1]
def change
add_column :orders, :flags, :bigint, 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/20210624104755_change_oauth_access_grants.rb | db/migrate/20210624104755_change_oauth_access_grants.rb | # frozen_string_literal: true
class ChangeOauthAccessGrants < ActiveRecord::Migration[6.1]
def up
change_column :oauth_access_grants, :scopes, :string, null: false, default: ""
end
def down
change_column :oauth_access_grants, :scopes, :string, 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/20120430183904_remove_language_from_infos.rb | db/migrate/20120430183904_remove_language_from_infos.rb | # frozen_string_literal: true
class RemoveLanguageFromInfos < ActiveRecord::Migration
def up
remove_column :infos, :language
end
def down
add_column :infos, :language, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240402134432_add_is_recommendable_and_is_alive_on_profile_to_products_index.rb | db/migrate/20240402134432_add_is_recommendable_and_is_alive_on_profile_to_products_index.rb | # frozen_string_literal: true
class AddIsRecommendableAndIsAliveOnProfileToProductsIndex < ActiveRecord::Migration[7.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
is_recommendable: { type: "boolean" },
is_alive_on_profile: { 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/20130331010919_index_purchases_on_offer_code_id.rb | db/migrate/20130331010919_index_purchases_on_offer_code_id.rb | # frozen_string_literal: true
class IndexPurchasesOnOfferCodeId < ActiveRecord::Migration
def change
add_index :purchases, :offer_code_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240725195151_add_deleted_at_index_to_product_files_archives.rb | db/migrate/20240725195151_add_deleted_at_index_to_product_files_archives.rb | # frozen_string_literal: true
class AddDeletedAtIndexToProductFilesArchives < ActiveRecord::Migration[7.1]
def up
change_table :product_files_archives, bulk: true do |t|
t.index :deleted_at
t.change :id, :bigint, null: false, auto_increment: true
t.change :link_id, :bigint
t.change :installment_id, :bigint
t.change :variant_id, :bigint
t.change :deleted_at, :datetime, limit: 6
t.change :deleted_from_cdn_at, :datetime, limit: 6
t.change :created_at, :datetime, limit: 6
t.change :updated_at, :datetime, limit: 6
end
end
def down
change_table :product_files_archives, bulk: true do |t|
t.remove_index :deleted_at
t.change :id, :int, null: false, auto_increment: true
t.change :link_id, :int
t.change :installment_id, :int
t.change :variant_id, :bigint
t.change :deleted_at, :datetime, precision: nil
t.change :deleted_from_cdn_at, :datetime, precision: nil
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/20190608225729_add_refund_transaction_id.rb | db/migrate/20190608225729_add_refund_transaction_id.rb | # frozen_string_literal: true
class AddRefundTransactionId < ActiveRecord::Migration
def change
add_column :refunds, :processor_refund_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/20120323213708_add_max_purchase_count_to_links.rb | db/migrate/20120323213708_add_max_purchase_count_to_links.rb | # frozen_string_literal: true
class AddMaxPurchaseCountToLinks < ActiveRecord::Migration
def change
add_column :links, :max_purchase_count, :integer, default: 999999
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20181126170410_add_index_for_reset_password_token.rb | db/migrate/20181126170410_add_index_for_reset_password_token.rb | # frozen_string_literal: true
class AddIndexForResetPasswordToken < ActiveRecord::Migration
def change
add_index :users, :reset_password_token
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140911204600_change_territory_restriction_to_text.rb | db/migrate/20140911204600_change_territory_restriction_to_text.rb | # frozen_string_literal: true
class ChangeTerritoryRestrictionToText < ActiveRecord::Migration
def up
change_column :links, :territory_restriction, :text
end
def down
change_column :links, :territory_restriction, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120226203517_add_height_to_infos.rb | db/migrate/20120226203517_add_height_to_infos.rb | # frozen_string_literal: true
class AddHeightToInfos < ActiveRecord::Migration
def change
add_column :infos, :height, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20181126155352_add_more_indexes_to_link.rb | db/migrate/20181126155352_add_more_indexes_to_link.rb | # frozen_string_literal: true
class AddMoreIndexesToLink < ActiveRecord::Migration
def change
add_index :links, :banned_at
add_index :links, :deleted_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20200110072114_create_sent_email_infos.rb | db/migrate/20200110072114_create_sent_email_infos.rb | # frozen_string_literal: true
class CreateSentEmailInfos < ActiveRecord::Migration
def change
create_table :sent_email_infos do |t|
t.string :key, limit: 40, null: false, index: { unique: true }
t.timestamps 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/20141010065413_add_currency_type_to_offer_codes.rb | db/migrate/20141010065413_add_currency_type_to_offer_codes.rb | # frozen_string_literal: true
class AddCurrencyTypeToOfferCodes < ActiveRecord::Migration
def change
add_column :offer_codes, :currency_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/20140328203457_create_licenses.rb | db/migrate/20140328203457_create_licenses.rb | # frozen_string_literal: true
class CreateLicenses < ActiveRecord::Migration
def change
create_table :licenses, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci" do |t|
t.integer :link_id
t.integer :purchase_id
t.string :serial
t.datetime :trial_expires_at
t.integer :uses, default: 0
t.string :json_data
t.datetime :deleted_at
t.integer :flags
t.timestamps
end
add_index :licenses, :link_id
add_index :licenses, :purchase_id
add_index :licenses, :serial, 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/20250331001118_add_streamable_to_transcoded_videos.rb | db/migrate/20250331001118_add_streamable_to_transcoded_videos.rb | # frozen_string_literal: true
class AddStreamableToTranscodedVideos < ActiveRecord::Migration[7.1]
def change
add_reference :transcoded_videos, :streamable, polymorphic: true, 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/20151128025657_create_service_charges.rb | db/migrate/20151128025657_create_service_charges.rb | # frozen_string_literal: true
class CreateServiceCharges < ActiveRecord::Migration
def change
create_table :service_charges, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.timestamps
t.references :user
t.references :recurring_service
t.integer :charge_cents
t.string :charge_cents_currency, default: "usd"
t.string :state
t.datetime :succeeded_at
t.references :credit_card
t.integer :card_expiry_month
t.integer :card_expiry_year
t.string :card_data_handling_mode
t.string :card_bin
t.string :card_type
t.string :card_country
t.string :card_zip_code
t.string :card_visual
t.string :charge_processor_id
t.integer :charge_processor_fee_cents
t.string :charge_processor_fee_cents_currency, default: "usd"
t.string :charge_processor_transaction_id
t.string :charge_processor_fingerprint
t.string :charge_processor_card_id
t.string :charge_processor_status
t.string :charge_processor_error_code
t.boolean :charge_processor_refunded, default: false, null: false
t.datetime :chargeback_date
t.string :json_data
t.string :error_code
t.references :merchant_account
t.string :browser_guid
t.string :ip_address
t.string :ip_country
t.string :ip_state
t.string :session_id
t.integer :flags, default: 0, null: false
end
add_index :service_charges, :user_id
add_index :service_charges, :created_at
add_index :service_charges, :recurring_service_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150322212519_add_display_name_to_product_files.rb | db/migrate/20150322212519_add_display_name_to_product_files.rb | # frozen_string_literal: true
class AddDisplayNameToProductFiles < ActiveRecord::Migration
def change
add_column :product_files, :display_name, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120113000140_add_payment_notification_to_user.rb | db/migrate/20120113000140_add_payment_notification_to_user.rb | # frozen_string_literal: true
class AddPaymentNotificationToUser < ActiveRecord::Migration
def change
add_column :users, :payment_notification, :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/20150220195633_add_json_data_to_refunds.rb | db/migrate/20150220195633_add_json_data_to_refunds.rb | # frozen_string_literal: true
class AddJsonDataToRefunds < ActiveRecord::Migration
def change
add_column :refunds, :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/20120601004004_add_preview_processed_to_links.rb | db/migrate/20120601004004_add_preview_processed_to_links.rb | # frozen_string_literal: true
class AddPreviewProcessedToLinks < ActiveRecord::Migration
def change
add_column :links, :preview_processed, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130124185954_add_followup_count_to_purchases.rb | db/migrate/20130124185954_add_followup_count_to_purchases.rb | # frozen_string_literal: true
class AddFollowupCountToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :follow_up_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/20121115192149_add_risk_score_to_links.rb | db/migrate/20121115192149_add_risk_score_to_links.rb | # frozen_string_literal: true
class AddRiskScoreToLinks < ActiveRecord::Migration
def change
add_column :links, :risk_score, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240203193839_remove_legacy_profile_section_fields.rb | db/migrate/20240203193839_remove_legacy_profile_section_fields.rb | # frozen_string_literal: true
class RemoveLegacyProfileSectionFields < ActiveRecord::Migration[7.0]
def up
remove_columns :seller_profile_sections, :shown_products, :show_filters, :default_product_sort
end
def down
change_table :seller_profile_sections, bulk: true do |t|
t.text :shown_products
t.boolean :show_filters
t.string :default_product_sort
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240802152405_add_fee_cents_to_affiliate_partial_refunds.rb | db/migrate/20240802152405_add_fee_cents_to_affiliate_partial_refunds.rb | # frozen_string_literal: true
class AddFeeCentsToAffiliatePartialRefunds < ActiveRecord::Migration[7.1]
def change
add_column :affiliate_partial_refunds, :fee_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/20230519055629_create_staff_picked_products.rb | db/migrate/20230519055629_create_staff_picked_products.rb | # frozen_string_literal: true
class CreateStaffPickedProducts < ActiveRecord::Migration[7.0]
def change
create_table :staff_picked_products do |t|
t.references :product, index: { unique: true }, null: false
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/20120328014142_add_webhook_fail_count_to_links.rb | db/migrate/20120328014142_add_webhook_fail_count_to_links.rb | # frozen_string_literal: true
class AddWebhookFailCountToLinks < ActiveRecord::Migration
def change
add_column :links, :webhook_fail_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/20241021182309_remove_null_contraint_from_upsell_name.rb | db/migrate/20241021182309_remove_null_contraint_from_upsell_name.rb | # frozen_string_literal: true
class RemoveNullContraintFromUpsellName < ActiveRecord::Migration[7.1]
def change
change_column_null :upsells, :name, true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150519180244_add_imported_customer_id_to_licenses.rb | db/migrate/20150519180244_add_imported_customer_id_to_licenses.rb | # frozen_string_literal: true
class AddImportedCustomerIdToLicenses < ActiveRecord::Migration
def change
add_column :licenses, :imported_customer_id, :integer
add_index :licenses, :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/20180530162002_add_stamped_pdf_product_file_index.rb | db/migrate/20180530162002_add_stamped_pdf_product_file_index.rb | # frozen_string_literal: true
class AddStampedPdfProductFileIndex < ActiveRecord::Migration
def change
add_index :stamped_pdfs, :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/20190521161425_create_product_review_stats.rb | db/migrate/20190521161425_create_product_review_stats.rb | # frozen_string_literal: true
class CreateProductReviewStats < ActiveRecord::Migration
def up
create_table :product_review_stats do |t|
t.references :link, index: { unique: true }
t.integer :reviews_count, null: false, default: 0
t.float :average_rating, null: false, default: 0.0
t.integer :ratings_of_one_count, default: 0
t.integer :ratings_of_two_count, default: 0
t.integer :ratings_of_three_count, default: 0
t.integer :ratings_of_four_count, default: 0
t.integer :ratings_of_five_count, default: 0
t.timestamps null: false
end
end
def down
drop_table :product_review_stats
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120927010244_add_processor_fee_cents_to_purchases.rb | db/migrate/20120927010244_add_processor_fee_cents_to_purchases.rb | # frozen_string_literal: true
class AddProcessorFeeCentsToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :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/20240528200957_create_purchase_custom_field_files.rb | db/migrate/20240528200957_create_purchase_custom_field_files.rb | # frozen_string_literal: true
class CreatePurchaseCustomFieldFiles < ActiveRecord::Migration[7.1]
def change
create_table :purchase_custom_field_files do |t|
t.string :url
t.references :purchase_custom_field, 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/20190613024006_add_missing_index_on_purchases.rb | db/migrate/20190613024006_add_missing_index_on_purchases.rb | # frozen_string_literal: true
class AddMissingIndexOnPurchases < ActiveRecord::Migration
def up
add_index :purchases, [:link_id, :purchase_state, :created_at]
end
def down
remove_index :purchases, [:link_id, :purchase_state, :created_at]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121115041415_remove_browser_fingerprint_index_from_events.rb | db/migrate/20121115041415_remove_browser_fingerprint_index_from_events.rb | # frozen_string_literal: true
class RemoveBrowserFingerprintIndexFromEvents < ActiveRecord::Migration
def up
remove_index "events", "browser_fingerprint"
end
def down
add_index "events", "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/20120112232019_add_redirects_to_all_purchases.rb | db/migrate/20120112232019_add_redirects_to_all_purchases.rb | # frozen_string_literal: true
class AddRedirectsToAllPurchases < ActiveRecord::Migration
def up
Purchase.find_each do |p|
p.create_url_redirect!
end
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/20220210162200_create_purchase_offer_code_discounts.rb | db/migrate/20220210162200_create_purchase_offer_code_discounts.rb | # frozen_string_literal: true
class CreatePurchaseOfferCodeDiscounts < ActiveRecord::Migration[6.1]
def change
create_table :purchase_offer_code_discounts do |t|
t.references :purchase, index: { unique: true }, null: false
t.references :offer_code, null: false
t.integer :offer_code_amount, null: false
t.boolean :offer_code_is_percent, null: false, default: false
t.integer :pre_discount_minimum_price_cents, 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/20191119061033_remove_type_from_custom_domains.rb | db/migrate/20191119061033_remove_type_from_custom_domains.rb | # frozen_string_literal: true
class RemoveTypeFromCustomDomains < ActiveRecord::Migration
def up
remove_column :custom_domains, :type
end
def down
add_column :custom_domains, :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/20120501233604_migrate_preview_images_on_links.rb | db/migrate/20120501233604_migrate_preview_images_on_links.rb | # frozen_string_literal: true
class MigratePreviewImagesOnLinks < ActiveRecord::Migration
def up
migrate_preview_images
end
def down
# the rollback has no effect!
end
private
# Migrate all the preview images that were generated on Amazon S3 into the
# proper size and format 300x300 PNG and save them again.
def migrate_preview_images
puts("Starting data migration of preview pictures")
batch_size = 4
l_query = Link.where("preview_url is not null").where("preview_url not like ''").
where("preview_url not like '%size300x300%'")
puts("#{l_query.count()} links have preview pics that need a migration")
thread_array = nil
while true do
thread_array = []
# Use a query string parameter to process the previews idempotent
# Fetch items in blocks
all_links = l_query.limit(batch_size)
# Exit condition
break if all_links.size == 0
all_links.each do |a_link|
thread_array << Thread.new { update_preview_for_link(a_link) }
end
# Join all threads together again
thread_array.each do |t|
t.join
end
puts "batch of links completed!"
end
puts "Data migration of preview pictures completed!"
end
def update_preview_for_link(l)
unless l.preview_url_is_image? && l.preview_url.include?("http")
puts "Cleaning up link_id: #{l.id} due to bad URL: #{l.preview_url}"
l.preview_url = nil
l.preview_attachment_id = nil
save_if_valid l
return
end
# Manually save each preview as an attachment by fetching it, storing it
# formatting it, then uploading it S3 again. Latency intensive task!
puts "Migrating link_id: #{l.id} and url: #{l.preview_url}"
# Fetch image and serialize to disk
filename = l.preview_url.split("/")[-1]
# Had problems with PNG extensions before, making sure the extension is
# therefore always lower case, no matter what!!!
parts = filename.split(".")
# Add a specific token into file to ensure idempotency
filename = parts[0..-2].join(".") + "." + parts[-1].downcase
extname = File.extname(filename)
basename = File.basename(filename, extname)
preview_file = Tempfile.new([basename, extname])
preview_file.binmode
begin
# Fetch the file and write it to the disk
preview_file << HTTParty.get(l.preview_url)
# Use PaperClips configuration to resize and save to S3
attachment = PreviewAttachment.new
attachment.file = preview_file
attachment.user = l.user
attachment.save!
# Update DB with the generated S3 link
# Persist the new/updated URL in the Link object.
l.preview_url = attachment.url
l.preview_attachment_id = attachment.id
save_if_valid l
rescue
# If something goes wrong, due to a bad URL etc. we just skipp this record
puts "Processing preview image of link: #{l.id} failed!"
l.preview_url = l.preview_url + "#size300x300"
save_if_valid l
ensure
# Clean up - remove file
preview_file.rewind
preview_file.close true # close and delete/unlink the file
end
end
def save_if_valid(l)
puts "Validation for link_id: #{l.id} failed!" unless l.valid?
l.save(validate: false)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190402003310_add_subscriptions_last_payment_option_id.rb | db/migrate/20190402003310_add_subscriptions_last_payment_option_id.rb | # frozen_string_literal: true
class AddSubscriptionsLastPaymentOptionId < ActiveRecord::Migration
def change
add_column :subscriptions, :last_payment_option_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/20120607044009_add_platform_id_to_users.rb | db/migrate/20120607044009_add_platform_id_to_users.rb | # frozen_string_literal: true
class AddPlatformIdToUsers < ActiveRecord::Migration
def change
add_column :users, :platform_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/20230320185003_add_backtax_agreement_id_to_credits.rb | db/migrate/20230320185003_add_backtax_agreement_id_to_credits.rb | # frozen_string_literal: true
class AddBacktaxAgreementIdToCredits < ActiveRecord::Migration[7.0]
def change
add_column :credits, :backtax_agreement_id, :bigint
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140624210443_add_product_file_id_to_subtitle_file.rb | db/migrate/20140624210443_add_product_file_id_to_subtitle_file.rb | # frozen_string_literal: true
class AddProductFileIdToSubtitleFile < ActiveRecord::Migration
def change
add_column :subtitle_files, :product_file_id, :integer
add_index :subtitle_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/20230724184252_add_product_description_to_dispute_evidences.rb | db/migrate/20230724184252_add_product_description_to_dispute_evidences.rb | # frozen_string_literal: true
class AddProductDescriptionToDisputeEvidences < ActiveRecord::Migration[7.0]
def change
add_column :dispute_evidences, :product_description, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150330045349_add_shipping_cents_to_purchases.rb | db/migrate/20150330045349_add_shipping_cents_to_purchases.rb | # frozen_string_literal: true
class AddShippingCentsToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :shipping_cents, :integer, 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/20131114070727_create_stamped_pdfs.rb | db/migrate/20131114070727_create_stamped_pdfs.rb | # frozen_string_literal: true
class CreateStampedPdfs < ActiveRecord::Migration
def change
create_table :stamped_pdfs do |t|
t.integer :url_redirect_id
t.integer :product_file_id
t.string :url
t.timestamps
end
add_index :stamped_pdfs, :url_redirect_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210603164813_increase_users_flags_to_bigint.rb | db/migrate/20210603164813_increase_users_flags_to_bigint.rb | # frozen_string_literal: true
class IncreaseUsersFlagsToBigint < ActiveRecord::Migration[6.1]
def up
change_column :users, :flags, :bigint, default: 1, null: false
end
def down
change_column :users, :flags, :int, default: 1, 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/20250402175205_create_product_review_videos.rb | db/migrate/20250402175205_create_product_review_videos.rb | # frozen_string_literal: true
class CreateProductReviewVideos < ActiveRecord::Migration[7.1]
def change
create_table :product_review_videos do |t|
t.references :product_review, null: false, foreign_key: false
t.string :approval_status, default: "pending_review"
t.datetime :deleted_at, index: true
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/20150528000824_add_flags_to_base_variants.rb | db/migrate/20150528000824_add_flags_to_base_variants.rb | # frozen_string_literal: true
class AddFlagsToBaseVariants < ActiveRecord::Migration
def change
add_column :base_variants, :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/20220620150418_add_total_fee_cents_to_products_index.rb | db/migrate/20220620150418_add_total_fee_cents_to_products_index.rb | # frozen_string_literal: true
class AddTotalFeeCentsToProductsIndex < ActiveRecord::Migration[6.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
total_fee_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/20121025203207_rename_amount_in_payments.rb | db/migrate/20121025203207_rename_amount_in_payments.rb | # frozen_string_literal: true
class RenameAmountInPayments < ActiveRecord::Migration
def up
remove_column :payments, :amount
add_column :payments, :amount_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/20240918134011_create_discover_search_suggestions.rb | db/migrate/20240918134011_create_discover_search_suggestions.rb | # frozen_string_literal: true
class CreateDiscoverSearchSuggestions < ActiveRecord::Migration[7.1]
def change
create_table :discover_search_suggestions do |t|
t.belongs_to :discover_search
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/20240423190023_standardize_subscriptions.rb | db/migrate/20240423190023_standardize_subscriptions.rb | # frozen_string_literal: true
class StandardizeSubscriptions < ActiveRecord::Migration[7.1]
def up
change_table :subscriptions, bulk: true do |t|
t.change :id, :bigint, null: false, auto_increment: true
t.change :link_id, :bigint
t.change :user_id, :bigint
t.change :cancelled_at, :datetime, limit: 6
t.change :failed_at, :datetime, limit: 6
t.change :created_at, :datetime, limit: 6
t.change :updated_at, :datetime, limit: 6
t.change :flags, :bigint, default: 0, null: false
t.change :user_requested_cancellation_at, :datetime, limit: 6
t.change :ended_at, :datetime, limit: 6
t.change :last_payment_option_id, :bigint
t.change :credit_card_id, :bigint
t.change :deactivated_at, :datetime, limit: 6
t.change :free_trial_ends_at, :datetime, limit: 6
t.remove :purchase_id
end
end
def down
change_table :subscriptions, bulk: true do |t|
t.change :id, :integer, null: false, auto_increment: true
t.change :link_id, :integer
t.change :user_id, :integer
t.change :cancelled_at, :datetime, precision: nil
t.change :failed_at, :datetime, precision: nil
t.change :created_at, :datetime, precision: nil
t.change :updated_at, :datetime, precision: nil
t.change :flags, :integer, default: 0, null: false
t.change :user_requested_cancellation_at, :datetime, precision: nil
t.change :ended_at, :datetime, precision: nil
t.change :last_payment_option_id, :integer
t.change :credit_card_id, :integer
t.change :deactivated_at, :datetime, precision: nil
t.change :free_trial_ends_at, :datetime, precision: nil
t.integer :purchase_id, after: :updated_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/20121107004632_create_blocked_browser_guids.rb | db/migrate/20121107004632_create_blocked_browser_guids.rb | # frozen_string_literal: true
class CreateBlockedBrowserGuids < ActiveRecord::Migration
def change
create_table :blocked_browser_guids do |t|
t.string :browser_guid
t.datetime :blocked_at
t.timestamps
end
add_index :blocked_browser_guids, :browser_guid
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151208102051_add_service_charge_index_to_events.rb | db/migrate/20151208102051_add_service_charge_index_to_events.rb | # frozen_string_literal: true
class AddServiceChargeIndexToEvents < ActiveRecord::Migration
def change
add_index :events, :service_charge_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151018081606_add_json_data_to_zip_tax_rates.rb | db/migrate/20151018081606_add_json_data_to_zip_tax_rates.rb | # frozen_string_literal: true
class AddJsonDataToZipTaxRates < ActiveRecord::Migration
def change
add_column :zip_tax_rates, :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/20150310211530_create_shipments.rb | db/migrate/20150310211530_create_shipments.rb | # frozen_string_literal: true
class CreateShipments < ActiveRecord::Migration
def change
create_table :shipments, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :purchase
t.string :ship_state
t.datetime :shipped_at
t.timestamps
end
add_index :shipments, :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/20120815194340_add_default_to_preview_processed.rb | db/migrate/20120815194340_add_default_to_preview_processed.rb | # frozen_string_literal: true
class AddDefaultToPreviewProcessed < ActiveRecord::Migration
def up
change_column :links, :preview_processed, :boolean, default: true
end
def down
change_column :links, :preview_processed, :boolean, 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/20120531014554_remove_price_cents_from_failed_purchases.rb | db/migrate/20120531014554_remove_price_cents_from_failed_purchases.rb | # frozen_string_literal: true
class RemovePriceCentsFromFailedPurchases < ActiveRecord::Migration
def up
remove_column :failed_purchases, :price_cents
end
def down
add_column :failed_purchases, :price_cents, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231120215114_add_resolution_message_to_purchase_early_fraud_warnings.rb | db/migrate/20231120215114_add_resolution_message_to_purchase_early_fraud_warnings.rb | # frozen_string_literal: true
class AddResolutionMessageToPurchaseEarlyFraudWarnings < ActiveRecord::Migration[7.0]
def change
add_column :purchase_early_fraud_warnings, :resolution_message, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20191014230105_change_installments_events_cache_count_default.rb | db/migrate/20191014230105_change_installments_events_cache_count_default.rb | # frozen_string_literal: true
class ChangeInstallmentsEventsCacheCountDefault < ActiveRecord::Migration
def up
change_column_default :installments, :installment_events_count, 0
end
def down
change_column_default :installments, :installment_events_count, nil
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120113232255_add_historical_data.rb | db/migrate/20120113232255_add_historical_data.rb | # frozen_string_literal: true
class AddHistoricalData < ActiveRecord::Migration
def up
Purchase.update_all(displayed_price_currency_type: "usd")
Purchase.update_all("displayed_price_cents = price_cents")
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/20210624101100_remove_unused_columns_from_merchant_accounts.rb | db/migrate/20210624101100_remove_unused_columns_from_merchant_accounts.rb | # frozen_string_literal: true
class RemoveUnusedColumnsFromMerchantAccounts < ActiveRecord::Migration[6.1]
def up
change_table :merchant_accounts, bulk: true do |t|
t.remove :relationship
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :user_id, :bigint
end
end
def down
change_table :merchant_accounts, bulk: true do |t|
t.string :relationship
t.change :id, :integer, null: false, unique: true, auto_increment: true
t.change :user_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/20120227011227_add_filegroup_to_infos.rb | db/migrate/20120227011227_add_filegroup_to_infos.rb | # frozen_string_literal: true
class AddFilegroupToInfos < ActiveRecord::Migration
def up
add_column :infos, :filegroup, :string
end
def down
remove_column :infos, :filegroup
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121212164255_add_index_to_confirmation_token_in_users.rb | db/migrate/20121212164255_add_index_to_confirmation_token_in_users.rb | # frozen_string_literal: true
class AddIndexToConfirmationTokenInUsers < ActiveRecord::Migration
def change
add_index :users, :confirmation_token
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120703005223_add_banned_to_blocked_ips.rb | db/migrate/20120703005223_add_banned_to_blocked_ips.rb | # frozen_string_literal: true
class AddBannedToBlockedIps < ActiveRecord::Migration
def change
add_column :blocked_ips, :banned, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210921040636_add_purchase_id_to_comments.rb | db/migrate/20210921040636_add_purchase_id_to_comments.rb | # frozen_string_literal: true
class AddPurchaseIdToComments < ActiveRecord::Migration[6.1]
def change
change_table :comments, bulk: true do |t|
t.bigint :purchase_id, null: true
t.index :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/20240305161742_add_bundle_product_to_purchase_custom_fields.rb | db/migrate/20240305161742_add_bundle_product_to_purchase_custom_fields.rb | # frozen_string_literal: true
class AddBundleProductToPurchaseCustomFields < ActiveRecord::Migration[7.1]
def change
add_reference :purchase_custom_fields, :bundle_product, index: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121025212302_add_paypal_email_to_payments.rb | db/migrate/20121025212302_add_paypal_email_to_payments.rb | # frozen_string_literal: true
class AddPaypalEmailToPayments < ActiveRecord::Migration
def up
add_column :payments, :payment_address, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120503214002_add_soundcloud_fields_to_users.rb | db/migrate/20120503214002_add_soundcloud_fields_to_users.rb | # frozen_string_literal: true
class AddSoundcloudFieldsToUsers < ActiveRecord::Migration
def change
add_column :users, :soundcloud_username, :string
add_column :users, :soundcloud_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/20210505194727_remove_installment_events_fk_to_events.rb | db/migrate/20210505194727_remove_installment_events_fk_to_events.rb | # frozen_string_literal: true
class RemoveInstallmentEventsFkToEvents < ActiveRecord::Migration[6.1]
def up
remove_foreign_key :installment_events, :events
end
def down
add_foreign_key :installment_events, :events, name: "_fk_rails_674b6b1780", on_delete: :cascade
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130801203354_create_daily_metrics.rb | db/migrate/20130801203354_create_daily_metrics.rb | # frozen_string_literal: true
class CreateDailyMetrics < ActiveRecord::Migration
def change
create_table :daily_metrics do |t|
t.string :event_name
t.date :events_date
t.integer :event_count
t.integer :user_count
t.timestamps
end
add_index :daily_metrics, [:event_name, :events_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/20240507141925_add_index_on_workflows_workflow_type_and_published_at.rb | db/migrate/20240507141925_add_index_on_workflows_workflow_type_and_published_at.rb | # frozen_string_literal: true
class AddIndexOnWorkflowsWorkflowTypeAndPublishedAt < ActiveRecord::Migration[7.1]
def change
add_index :workflows, [:workflow_type, :published_at]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230404182723_remove_link_view_events.rb | db/migrate/20230404182723_remove_link_view_events.rb | # frozen_string_literal: true
class RemoveLinkViewEvents < ActiveRecord::Migration[7.0]
def up
drop_table :link_view_events
end
def down
create_table "link_view_events", charset: "latin1" do |t|
t.integer "visit_id"
t.string "ip_address"
t.string "event_name"
t.integer "user_id"
t.integer "link_id"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.string "referrer"
t.string "parent_referrer"
t.string "language"
t.string "browser"
t.boolean "is_mobile", default: false
t.string "email"
t.integer "purchase_id"
t.integer "price_cents"
t.integer "credit_card_id"
t.string "card_type"
t.string "card_visual"
t.string "purchase_state"
t.string "billing_zip"
t.boolean "chargeback", default: false
t.boolean "refunded", default: false
t.string "view_url"
t.string "fingerprint"
t.string "ip_country"
t.float "ip_longitude"
t.float "ip_latitude"
t.boolean "is_modal"
t.text "friend_actions"
t.string "browser_fingerprint"
t.string "browser_plugins"
t.string "browser_guid"
t.string "referrer_domain"
t.string "ip_state"
t.string "active_test_path_assignments"
t.integer "service_charge_id"
t.index ["browser_guid"], name: "index_events_on_browser_guid"
t.index ["created_at"], name: "index_events_on_created_at"
t.index ["event_name", "link_id", "created_at"], name: "index_events_on_event_name_and_link_id"
t.index ["ip_address"], name: "index_events_on_ip_address"
t.index ["link_id"], name: "index_events_on_link_id"
t.index ["purchase_id"], name: "index_events_on_purchase_id"
t.index ["service_charge_id"], name: "index_events_on_service_charge_id"
t.index ["user_id"], name: "index_events_on_user_id"
t.index ["visit_id"], name: "index_events_on_visit_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/20111109221929_purchase_attr.rb | db/migrate/20111109221929_purchase_attr.rb | # frozen_string_literal: true
class PurchaseAttr < ActiveRecord::Migration
def up
add_column :users, :name, :string
add_column :users, :payment_address, :string
add_column :users, :create_date, :integer
add_column :users, :balance, :float
add_column :users, :reset_hash, :string
end
def down
remove_column :users, :name
remove_column :users, :payment_address
remove_column :users, :create_date
remove_column :users, :balance
remove_column :users, :reset_hash
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121018222048_add_browser_plugins_to_events_and_visits.rb | db/migrate/20121018222048_add_browser_plugins_to_events_and_visits.rb | # frozen_string_literal: true
class AddBrowserPluginsToEventsAndVisits < ActiveRecord::Migration
def up
add_column :events, :browser_plugins, :string
end
def down
remove_column :events, :browser_plugins
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240218085253_add_seller_id_and_indexes_to_subscriptions.rb | db/migrate/20240218085253_add_seller_id_and_indexes_to_subscriptions.rb | # frozen_string_literal: true
class AddSellerIdAndIndexesToSubscriptions < ActiveRecord::Migration[7.0]
def change
change_table :subscriptions, bulk: true do |t|
t.bigint :seller_id
t.index [:seller_id, :created_at]
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150917174836_ensure_call_to_action_limits_are_correct.rb | db/migrate/20150917174836_ensure_call_to_action_limits_are_correct.rb | # frozen_string_literal: true
class EnsureCallToActionLimitsAreCorrect < ActiveRecord::Migration
def change
change_column(:installments, :call_to_action_text, :string, limit: 2083)
change_column(:installments, :call_to_action_url, :string, limit: 2083)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120718175134_add_size_to_links.rb | db/migrate/20120718175134_add_size_to_links.rb | # frozen_string_literal: true
class AddSizeToLinks < ActiveRecord::Migration
def change
add_column :links, :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/20190603183838_add_link_id_to_product_review.rb | db/migrate/20190603183838_add_link_id_to_product_review.rb | # frozen_string_literal: true
class AddLinkIdToProductReview < ActiveRecord::Migration
def up
add_column :product_reviews, :link_id, :integer
end
def down
remove_column :product_reviews, :link_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230622180003_add_duration_in_months_to_offer_codes.rb | db/migrate/20230622180003_add_duration_in_months_to_offer_codes.rb | # frozen_string_literal: true
class AddDurationInMonthsToOfferCodes < ActiveRecord::Migration[7.0]
def change
change_table :offer_codes, bulk: true do |t|
t.integer :duration_in_months
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120607044631_add_platform_cut_to_users.rb | db/migrate/20120607044631_add_platform_cut_to_users.rb | # frozen_string_literal: true
class AddPlatformCutToUsers < ActiveRecord::Migration
def change
add_column :users, :platform_cut, :float
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20200721210221_record_tiered_pricing_migration.rb | db/migrate/20200721210221_record_tiered_pricing_migration.rb | # frozen_string_literal: true
class RecordTieredPricingMigration < ActiveRecord::Migration[5.1]
# TODO(helen): remove these columns when confident that tiered pricing data
# migration was successful (see https://github.com/gumroad/web/pull/13830)
# Also see note in `Price` model re. `.alive` and `#alive?` methods
def up
add_column :links, :migrated_to_tiered_pricing_at, :datetime
add_column :prices, :archived_at, :datetime
end
def down
remove_column :prices, :archived_at
remove_column :links, :migrated_to_tiered_pricing_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150506234022_create_consumption_events.rb | db/migrate/20150506234022_create_consumption_events.rb | # frozen_string_literal: true
class CreateConsumptionEvents < ActiveRecord::Migration
def change
create_table :consumption_events, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer :product_file_id
t.integer :url_redirect_id
t.integer :purchase_id
t.string :event_type
t.string :platform
t.integer :flags, default: 0, null: false
t.text :json_data
t.timestamps
end
add_index :consumption_events, :product_file_id
add_index :consumption_events, :purchase_id
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.