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/20240725140931_add_fee_cents_to_affiliate_credits.rb | db/migrate/20240725140931_add_fee_cents_to_affiliate_credits.rb | # frozen_string_literal: true
class AddFeeCentsToAffiliateCredits < ActiveRecord::Migration[7.1]
def change
add_column :affiliate_credits, :fee_cents, :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/20200713002040_create_computed_sales_analytics_days.rb | db/migrate/20200713002040_create_computed_sales_analytics_days.rb | # frozen_string_literal: true
class CreateComputedSalesAnalyticsDays < ActiveRecord::Migration
def change
create_table :computed_sales_analytics_days do |t|
t.string :key, null: false, index: { unique: true }
t.text :data, limit: 10.megabytes # mediumtext
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/20211129142053_remove_featured_posts.rb | db/migrate/20211129142053_remove_featured_posts.rb | # frozen_string_literal: true
class RemoveFeaturedPosts < ActiveRecord::Migration[6.1]
def up
drop_table :featured_posts
end
def down
create_table :featured_posts do |t|
t.integer :post_id, null: false, index: true
t.string :category, null: false, index: { unique: true }, limit: 191
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/20120914215239_add_failed_to_purchases.rb | db/migrate/20120914215239_add_failed_to_purchases.rb | # frozen_string_literal: true
class AddFailedToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :failed, :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/20191101163724_add_refund_purchase_index.rb | db/migrate/20191101163724_add_refund_purchase_index.rb | # frozen_string_literal: true
class AddRefundPurchaseIndex < ActiveRecord::Migration
def up
add_index :refunds, :purchase_id
end
def down
remove_index :refunds, :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/20111201185846_link_soft_delete.rb | db/migrate/20111201185846_link_soft_delete.rb | # frozen_string_literal: true
class LinkSoftDelete < ActiveRecord::Migration
def up
add_column :links, :deleted_at, :datetime
end
def down
remove_column :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/20201223160647_remove_twitter_and_balance_columns_from_user.rb | db/migrate/20201223160647_remove_twitter_and_balance_columns_from_user.rb | # frozen_string_literal: true
class RemoveTwitterAndBalanceColumnsFromUser < ActiveRecord::Migration[6.0]
def up
change_table :users do |t|
t.remove :twitter_verified, :twitter_location, :balance_cents
end
end
def down
change_table :users do |t|
t.string :twitter_verified
t.string :twitter_location
t.integer :balance_cents, default: 0
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120111204623_create_url_redirects.rb | db/migrate/20120111204623_create_url_redirects.rb | # frozen_string_literal: true
class CreateUrlRedirects < ActiveRecord::Migration
def change
create_table :url_redirects do |t|
t.integer :uses
t.integer :link_id
t.datetime :expires_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/20131115164302_add_product_file_id_to_transcoded_videos.rb | db/migrate/20131115164302_add_product_file_id_to_transcoded_videos.rb | # frozen_string_literal: true
class AddProductFileIdToTranscodedVideos < ActiveRecord::Migration
def change
add_column :transcoded_videos, :product_file_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/20120528234130_add_city_to_users.rb | db/migrate/20120528234130_add_city_to_users.rb | # frozen_string_literal: true
class AddCityToUsers < ActiveRecord::Migration
def change
add_column :users, :city, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190528190659_backfill_megaphone_states_datetimes.rb | db/migrate/20190528190659_backfill_megaphone_states_datetimes.rb | # frozen_string_literal: true
class BackfillMegaphoneStatesDatetimes < ActiveRecord::Migration
def up
MegaphoneState.find_in_batches do |records|
now = Time.current
MegaphoneState.where(id: records.map(&:id)).update_all(created_at: now, updated_at: now)
sleep(0.1)
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210622061943_remove_unused_columns_from_transcoded_videos.rb | db/migrate/20210622061943_remove_unused_columns_from_transcoded_videos.rb | # frozen_string_literal: true
class RemoveUnusedColumnsFromTranscodedVideos < ActiveRecord::Migration[6.1]
def up
change_table :transcoded_videos, bulk: true do |t|
t.remove :transcoder_preset_key
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :link_id, :bigint
t.change :product_file_id, :bigint
end
end
def down
change_table :transcoded_videos, bulk: true do |t|
t.string :transcoder_preset_key
t.change :id, :integer, null: false, unique: true, auto_increment: true
t.change :link_id, :integer
t.change :product_file_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/20120530050147_add_bad_email_counter_to_links.rb | db/migrate/20120530050147_add_bad_email_counter_to_links.rb | # frozen_string_literal: true
class AddBadEmailCounterToLinks < ActiveRecord::Migration
def change
add_column :links, :bad_email_counter, :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/20120510192114_add_stripe_charge_attributes_to_purchases.rb | db/migrate/20120510192114_add_stripe_charge_attributes_to_purchases.rb | # frozen_string_literal: true
class AddStripeChargeAttributesToPurchases < ActiveRecord::Migration
def change
# Additional flags to keep track if something has been refunded, disputed etc.
add_column :purchases, :amount_refunded_cents, :integer
add_column :purchases, :stripe_disputed, :boolean
add_column :purchases, :stripe_refunded, :boolean
# Actually transaction information from Stripe
add_column :purchases, :stripe_transaction_id, :string
add_column :purchases, :stripe_fingerprint, :string
add_column :purchases, :stripe_card_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/20141125102727_add_index_on_follower_user_id.rb | db/migrate/20141125102727_add_index_on_follower_user_id.rb | # frozen_string_literal: true
class AddIndexOnFollowerUserId < ActiveRecord::Migration
def change
add_index :followers, [:followed_id, :follower_user_id]
add_index :followers, [:follower_user_id, :followed_id]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230320184956_create_backtax_agreements.rb | db/migrate/20230320184956_create_backtax_agreements.rb | # frozen_string_literal: true
class CreateBacktaxAgreements < ActiveRecord::Migration[7.0]
def change
create_table :backtax_agreements do |t|
t.references :user, index: true, null: false
t.string "jurisdiction"
t.string "signature"
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/20150617000000_create_user_compliance_info_request.rb | db/migrate/20150617000000_create_user_compliance_info_request.rb | # frozen_string_literal: true
class CreateUserComplianceInfoRequest < ActiveRecord::Migration
def change
create_table :user_compliance_info_requests, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.timestamps
t.references :user
t.string :field_needed
t.datetime :due_at
t.string :state
t.datetime :provided_at
t.text :json_data
t.integer :flags, default: 0, 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/20120913183233_remove_uniqueness_index_from_failed_purchases.rb | db/migrate/20120913183233_remove_uniqueness_index_from_failed_purchases.rb | # frozen_string_literal: true
class RemoveUniquenessIndexFromFailedPurchases < ActiveRecord::Migration
def up
remove_index :failed_purchases, name: "by_link_and_stripe_fingerprint"
end
def down
add_index :failed_purchases, [:link_id, :stripe_fingerprint], unique: true, name: "by_link_and_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/20120225012853_add_customizable_price_flag_to_link.rb | db/migrate/20120225012853_add_customizable_price_flag_to_link.rb | # frozen_string_literal: true
class AddCustomizablePriceFlagToLink < ActiveRecord::Migration
def change
add_column :links, :customizable_price, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20201023151726_create_active_storage_tables.active_storage.rb | db/migrate/20201023151726_create_active_storage_tables.active_storage.rb | # frozen_string_literal: true
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
t.text :metadata
t.bigint :byte_size, null: false
t.string :checksum, null: false
t.datetime :created_at, null: false
t.index [:key], unique: true
end
create_table :active_storage_attachments do |t|
t.string :name, null: false
t.references :record, null: false, polymorphic: true, index: false
t.references :blob, null: false
t.datetime :created_at, null: false
t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_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/20121227045239_add_pdf_stamp_enabled_to_links.rb | db/migrate/20121227045239_add_pdf_stamp_enabled_to_links.rb | # frozen_string_literal: true
class AddPdfStampEnabledToLinks < ActiveRecord::Migration
def change
add_column :links, :pdf_stamp_enabled, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230127125845_create_blocked_customer_objects.rb | db/migrate/20230127125845_create_blocked_customer_objects.rb | # frozen_string_literal: true
class CreateBlockedCustomerObjects < ActiveRecord::Migration[7.0]
def change
create_table :blocked_customer_objects do |t|
t.references :seller, index: true, null: false
t.string :object_type, null: false
t.string :object_value, null: false
t.string :buyer_email, index: true
t.datetime :blocked_at
t.timestamps
end
add_index :blocked_customer_objects, [:seller_id, :object_type, :object_value], name: "idx_blocked_customer_objects_on_seller_and_object_type_and_value", 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/20140311222528_change_size_to_bigint_in_product_files.rb | db/migrate/20140311222528_change_size_to_bigint_in_product_files.rb | # frozen_string_literal: true
class ChangeSizeToBigintInProductFiles < ActiveRecord::Migration
def up
change_column :product_files, :size, :bigint
end
def down
change_column :product_files, :size, :int
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120912011119_add_webhook_failed_to_purchases.rb | db/migrate/20120912011119_add_webhook_failed_to_purchases.rb | # frozen_string_literal: true
class AddWebhookFailedToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :webhook_failed, :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/20191025150241_add_ssl_certificate_issued_at_to_custom_domain.rb | db/migrate/20191025150241_add_ssl_certificate_issued_at_to_custom_domain.rb | # frozen_string_literal: true
class AddSslCertificateIssuedAtToCustomDomain < ActiveRecord::Migration
def change
add_column :custom_domains, :ssl_certificate_issued_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/20230607141143_create_sales_related_products_infos.rb | db/migrate/20230607141143_create_sales_related_products_infos.rb | # frozen_string_literal: true
class CreateSalesRelatedProductsInfos < ActiveRecord::Migration[7.0]
def change
create_table :sales_related_products_infos do |t|
t.bigint :smaller_product_id, null: false
t.bigint :larger_product_id, null: false
t.integer :sales_count, default: 0, null: false
t.timestamps
t.index [:smaller_product_id, :larger_product_id], name: :index_smaller_and_larger_product_ids, unique: true
t.index [:smaller_product_id, :sales_count], name: :index_smaller_product_id_and_sales_count
t.index [:larger_product_id, :sales_count], name: :index_larger_product_id_and_sales_count
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130218221821_add_offer_code_id_to_purchases.rb | db/migrate/20130218221821_add_offer_code_id_to_purchases.rb | # frozen_string_literal: true
class AddOfferCodeIdToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :offer_code_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/20230825141116_remove_null_constraint_subscription_plan_change_tier.rb | db/migrate/20230825141116_remove_null_constraint_subscription_plan_change_tier.rb | # frozen_string_literal: true
class RemoveNullConstraintSubscriptionPlanChangeTier < ActiveRecord::Migration[7.0]
def change
change_column_null :subscription_plan_changes, :base_variant_id, true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20221107130525_add_new_offer_code_fields.rb | db/migrate/20221107130525_add_new_offer_code_fields.rb | # frozen_string_literal: true
class AddNewOfferCodeFields < ActiveRecord::Migration[7.0]
def change
change_table :offer_codes, bulk: true do |t|
t.string :code
t.boolean :universal, default: false, null: false
t.index [:code, :link_id], name: "index_offer_codes_on_code_and_link_id", length: { name: 191 }
t.index [:universal], name: "index_offer_codes_on_universal"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120516185425_add_ip_address_to_purchases.rb | db/migrate/20120516185425_add_ip_address_to_purchases.rb | # frozen_string_literal: true
class AddIpAddressToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :ip_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/20120501232218_add_profile_picture_url_to_users.rb | db/migrate/20120501232218_add_profile_picture_url_to_users.rb | # frozen_string_literal: true
class AddProfilePictureUrlToUsers < ActiveRecord::Migration
def up
unless column_exists? :users, :profile_picture_url
add_column :users, :profile_picture_url, :string
end
migrate_avatar_pictures
end
def down
remove_column :users, :profile_picture_url
end
private
# Data migration to migrate all the existing FB and Twitter Avatar profile
# pictures from their columns out into the new profile_picture_url column.
def migrate_avatar_pictures
# Note: Twitter pics get preference before Facebook pictures.
# Ensure idempotency so that we can rerun this migration without processing
# all the data gain.
# We have about 5000 records to update in total. Each of about 50 kbytes in size
# so max. 250 MB of RAM. We should be fine doing this sequentially, since
# image processing and network transfer time will exceed DB Update time.
puts("Starting data migration of profile pictures")
# Fetch all users with Twitter photos first
all_users = User.where("(twitter_pic IS NOT NULL and twitter_pic not like '')").
where("(profile_picture_url IS NULL or profile_picture_url like '')")
puts("#{all_users.size} users need twitter pic to be migrated")
all_users.each do |u|
# note, the user.save_profile_pic_on_s3 hook will resize/convert/upload.
puts("Migrating user_id: #{u.id} and url: #{u.twitter_pic}")
u.profile_picture_url = u.twitter_pic
u.save!
end
# Fetch all users with Facebook photo second
all_users = User.where("(facebook_pic_large IS NOT NULL and facebook_pic_large not like '')").
where("(twitter_pic IS NULL or twitter_pic like '')").
where("(profile_picture_url IS NULL or profile_picture_url like '')")
puts("#{all_users.size} users need facebook pic to be migrated")
all_users.each do |u|
# note, the user.save_profile_pic_on_s3 hook will resize/convert/upload.
puts("Migrating user_id: #{u.id} and url: #{u.facebook_pic_large}")
u.profile_picture_url = u.facebook_pic_large
u.save!
end
puts("Data migration of profile pictures completed!")
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220420204744_add_discover_fee_to_product_index.rb | db/migrate/20220420204744_add_discover_fee_to_product_index.rb | # frozen_string_literal: true
class AddDiscoverFeeToProductIndex < ActiveRecord::Migration[6.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
discover_fee_per_thousand: { type: "integer" }
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130104072633_create_credits.rb | db/migrate/20130104072633_create_credits.rb | # frozen_string_literal: true
class CreateCredits < ActiveRecord::Migration
def change
create_table :credits do |t|
t.integer :user_id
t.integer :amount_cents
t.integer :balance_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/20130722195210_add_external_mapping_id_to_links.rb | db/migrate/20130722195210_add_external_mapping_id_to_links.rb | # frozen_string_literal: true
class AddExternalMappingIdToLinks < ActiveRecord::Migration
def change
add_column :links, :external_mapping_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/20150730230100_add_purchase_id_index_to_purchase_sales_tax_infos.rb | db/migrate/20150730230100_add_purchase_id_index_to_purchase_sales_tax_infos.rb | # frozen_string_literal: true
class AddPurchaseIdIndexToPurchaseSalesTaxInfos < ActiveRecord::Migration
def change
add_index :purchase_sales_tax_infos, :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/20220322124013_make_integration_api_key_nullable.rb | db/migrate/20220322124013_make_integration_api_key_nullable.rb | # frozen_string_literal: true
class MakeIntegrationApiKeyNullable < ActiveRecord::Migration[6.1]
def change
change_column_null :integrations, :api_key, true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230125154905_create_upsell_variants.rb | db/migrate/20230125154905_create_upsell_variants.rb | # frozen_string_literal: true
class CreateUpsellVariants < ActiveRecord::Migration[7.0]
def change
create_table :upsell_variants do |t|
t.references :upsell, null: false
t.references :selected_variant, null: false
t.references :offered_variant, 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/20231228165738_create_wishlist_products.rb | db/migrate/20231228165738_create_wishlist_products.rb | # frozen_string_literal: true
class CreateWishlistProducts < ActiveRecord::Migration[7.0]
def change
create_table :wishlist_products do |t|
t.references :wishlist, null: false
t.references :product, null: false
t.references :variant
t.string :recurrence
t.integer :quantity, null: false
t.boolean :rent, 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/20130513235232_create_transcoded_videos.rb | db/migrate/20130513235232_create_transcoded_videos.rb | # frozen_string_literal: true
class CreateTranscodedVideos < ActiveRecord::Migration
def change
create_table :transcoded_videos do |t|
t.references :link
t.string :original_video_key
t.string :transcoded_video_key
t.string :transcoder_preset_key
t.string :job_id
t.string :state
t.timestamps
end
add_index :transcoded_videos, :link_id
add_index :transcoded_videos, :job_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220103095839_add_deleted_at_to_product_folders.rb | db/migrate/20220103095839_add_deleted_at_to_product_folders.rb | # frozen_string_literal: true
class AddDeletedAtToProductFolders < ActiveRecord::Migration[6.1]
def change
add_column :product_folders, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121005041429_change_hightlight_color_to_highlight_color.rb | db/migrate/20121005041429_change_hightlight_color_to_highlight_color.rb | # frozen_string_literal: true
class ChangeHightlightColorToHighlightColor < ActiveRecord::Migration
def up
rename_column :users, :hightlight_color, :highlight_color
end
def down
rename_column :users, :highlight_color, :hightlight_color
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130529185015_add_created_at_index_to_oauth_access_grants.rb | db/migrate/20130529185015_add_created_at_index_to_oauth_access_grants.rb | # frozen_string_literal: true
class AddCreatedAtIndexToOauthAccessGrants < ActiveRecord::Migration
def self.up
add_index :oauth_access_grants, :created_at
end
def self.down
remove_index :oauth_access_grants, :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/20140703212413_prepare_base_variant.rb | db/migrate/20140703212413_prepare_base_variant.rb | # frozen_string_literal: true
class PrepareBaseVariant < ActiveRecord::Migration
def change
rename_table :variants, :base_variants
rename_table :purchases_variants, :base_variants_purchases
rename_column :base_variants_purchases, :variant_id, :base_variant_id
add_column :base_variants, :type, :string, default: "Variant"
add_column :base_variants, :link_id, :integer
create_table :skus_variants do |t|
t.integer :variant_id
t.integer :sku_id
end
add_index :skus_variants, :variant_id
add_index :skus_variants, :sku_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120605012619_remove_number_of_paid_download_from_links.rb | db/migrate/20120605012619_remove_number_of_paid_download_from_links.rb | # frozen_string_literal: true
class RemoveNumberOfPaidDownloadFromLinks < ActiveRecord::Migration
def up
remove_column :links, :number_of_paid_downloads
end
def down
add_column :links, :number_of_paid_downloads, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120628221758_add_custom_receipt_to_links.rb | db/migrate/20120628221758_add_custom_receipt_to_links.rb | # frozen_string_literal: true
class AddCustomReceiptToLinks < ActiveRecord::Migration
def change
add_column :links, :custom_receipt, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20201221053736_remove_some_fb_columns_from_user.rb | db/migrate/20201221053736_remove_some_fb_columns_from_user.rb | # frozen_string_literal: true
class RemoveSomeFbColumnsFromUser < ActiveRecord::Migration[6.0]
def up
change_table :users do |t|
t.remove :facebook_gender, :facebook_verified
end
end
def down
change_table :users do |t|
t.string :facebook_gender, limit: 255
t.string :facebook_verified, limit: 255
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250816055312_make_offer_code_user_id_non_nullable.rb | db/migrate/20250816055312_make_offer_code_user_id_non_nullable.rb | # frozen_string_literal: true
class MakeOfferCodeUserIdNonNullable < ActiveRecord::Migration[7.1]
def change
change_column_null :offer_codes, :user_id, false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121029235109_add_twitter_oauth_secret_to_users.rb | db/migrate/20121029235109_add_twitter_oauth_secret_to_users.rb | # frozen_string_literal: true
class AddTwitterOauthSecretToUsers < ActiveRecord::Migration
def change
add_column :users, :twitter_oauth_secret, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240716153656_create_product_review_responses.rb | db/migrate/20240716153656_create_product_review_responses.rb | # frozen_string_literal: true
class CreateProductReviewResponses < ActiveRecord::Migration[7.1]
def change
create_table :product_review_responses do |t|
t.belongs_to :user, null: false
t.belongs_to :product_review, null: false
t.text :message
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/20120305044807_add_twitter_columns_to_user.rb | db/migrate/20120305044807_add_twitter_columns_to_user.rb | # frozen_string_literal: true
class AddTwitterColumnsToUser < ActiveRecord::Migration
def up
add_column :users, :bio, :string
add_column :users, :twitter_handle, :string
add_column :users, :twitter_verified, :string
add_column :users, :twitter_location, :string
add_column :users, :twitter_pic, :string
end
def down
remove_column :users, :bio
remove_column :users, :twitter_handle
remove_column :users, :twitter_verified
remove_column :users, :twitter_location
remove_column :users, :twitter_pic
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121105203548_add_banned_at_to_links.rb | db/migrate/20121105203548_add_banned_at_to_links.rb | # frozen_string_literal: true
class AddBannedAtToLinks < ActiveRecord::Migration
def change
add_column :links, :banned_at, :timestamp
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150430233010_add_first_name_last_name_to_user_compliance_info.rb | db/migrate/20150430233010_add_first_name_last_name_to_user_compliance_info.rb | # frozen_string_literal: true
class AddFirstNameLastNameToUserComplianceInfo < ActiveRecord::Migration
def change
add_column :user_compliance_info, :first_name, :string
add_column :user_compliance_info, :last_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/20231228165212_create_wishlists.rb | db/migrate/20231228165212_create_wishlists.rb | # frozen_string_literal: true
class CreateWishlists < ActiveRecord::Migration[7.0]
def change
create_table :wishlists do |t|
t.references :user, null: false
t.string :name, 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/20140730235200_fix_twitter_user_id.rb | db/migrate/20140730235200_fix_twitter_user_id.rb | # frozen_string_literal: true
class FixTwitterUserId < ActiveRecord::Migration
def up
change_column :users, :twitter_user_id, :string
end
def down
change_column :users, :twitter_user_id, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150504050000_add_braintree_customer_id_to_credit_card.rb | db/migrate/20150504050000_add_braintree_customer_id_to_credit_card.rb | # frozen_string_literal: true
class AddBraintreeCustomerIdToCreditCard < ActiveRecord::Migration
def change
add_column :credit_cards, :braintree_customer_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/20150119235522_add_country_to_zip_tax_rate.rb | db/migrate/20150119235522_add_country_to_zip_tax_rate.rb | # frozen_string_literal: true
class AddCountryToZipTaxRate < ActiveRecord::Migration
def change
add_column :zip_tax_rates, :country, :string, 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/20120113231359_add_displayed_cost.rb | db/migrate/20120113231359_add_displayed_cost.rb | # frozen_string_literal: true
class AddDisplayedCost < ActiveRecord::Migration
def change
add_column :purchases, :displayed_price_cents, :integer
add_column :purchases, :displayed_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/20231025175124_add_access_activity_log_to_dispute_evidences.rb | db/migrate/20231025175124_add_access_activity_log_to_dispute_evidences.rb | # frozen_string_literal: true
class AddAccessActivityLogToDisputeEvidences < ActiveRecord::Migration[7.0]
def change
add_column :dispute_evidences, :access_activity_log, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210720171856_create_fraud_refunds.rb | db/migrate/20210720171856_create_fraud_refunds.rb | # frozen_string_literal: true
class CreateFraudRefunds < ActiveRecord::Migration[6.1]
def change
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/20210824191719_add_url_to_base_variants.rb | db/migrate/20210824191719_add_url_to_base_variants.rb | # frozen_string_literal: true
class AddUrlToBaseVariants < ActiveRecord::Migration[6.1]
def change
add_column :base_variants, :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/20240125071935_add_disputes_seller_id.rb | db/migrate/20240125071935_add_disputes_seller_id.rb | # frozen_string_literal: true
class AddDisputesSellerId < ActiveRecord::Migration[7.0]
def change
change_table :disputes, bulk: true do |t|
t.bigint :seller_id
t.datetime :event_created_at
t.index [:seller_id, :event_created_at]
t.index [:seller_id, :won_at]
t.index [:seller_id, :lost_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/20150309165638_add_purchase_type_and_rental_price_cents_to_links.rb | db/migrate/20150309165638_add_purchase_type_and_rental_price_cents_to_links.rb | # frozen_string_literal: true
class AddPurchaseTypeAndRentalPriceCentsToLinks < ActiveRecord::Migration
def change
add_column :links, :rental_price_cents, :integer
rename_column :links, :number_of_views, :purchase_type
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230708062915_add_purchasing_power_parity_limit_to_users.rb | db/migrate/20230708062915_add_purchasing_power_parity_limit_to_users.rb | # frozen_string_literal: true
class AddPurchasingPowerParityLimitToUsers < ActiveRecord::Migration[7.0]
def change
change_table :users, bulk: true do |t|
t.integer :purchasing_power_parity_limit
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230719132348_create_order_purchases.rb | db/migrate/20230719132348_create_order_purchases.rb | # frozen_string_literal: true
class CreateOrderPurchases < ActiveRecord::Migration[7.0]
def change
create_table :order_purchases do |t|
t.references :order, null: false
t.references :purchase, null: false
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121004174142_add_background_image_url_to_users.rb | db/migrate/20121004174142_add_background_image_url_to_users.rb | # frozen_string_literal: true
class AddBackgroundImageUrlToUsers < ActiveRecord::Migration
def change
add_column :users, :background_image_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/20191122205121_add_position_to_asset_previews.rb | db/migrate/20191122205121_add_position_to_asset_previews.rb | # frozen_string_literal: true
class AddPositionToAssetPreviews < ActiveRecord::Migration
def change
add_column :asset_previews, :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/20111123010637_attachment_add_user_id.rb | db/migrate/20111123010637_attachment_add_user_id.rb | # frozen_string_literal: true
class AttachmentAddUserId < ActiveRecord::Migration
def change
add_column :attachments, :user_id, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130924001509_add_deleted_at_to_resource_subscriptions.rb | db/migrate/20130924001509_add_deleted_at_to_resource_subscriptions.rb | # frozen_string_literal: true
class AddDeletedAtToResourceSubscriptions < ActiveRecord::Migration
def change
add_column :resource_subscriptions, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111208220204_add_preview_width_to_link.rb | db/migrate/20111208220204_add_preview_width_to_link.rb | # frozen_string_literal: true
class AddPreviewWidthToLink < ActiveRecord::Migration
def change
add_column :links, :preview_attachment_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/20240617133026_create_yearly_stats.rb | db/migrate/20240617133026_create_yearly_stats.rb | # frozen_string_literal: true
class CreateYearlyStats < ActiveRecord::Migration[7.1]
def change
create_table :yearly_stats do |t|
t.bigint :user_id, null: false, index: { unique: true }
t.json :analytics_data, 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/20200514132135_add_variant_id_to_prices.rb | db/migrate/20200514132135_add_variant_id_to_prices.rb | # frozen_string_literal: true
class AddVariantIdToPrices < ActiveRecord::Migration[5.1]
def up
add_reference :prices, :variant, index: true, type: :integer
end
def down
remove_reference :prices, :variant
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20160105231848_add_service_charge_to_disputes.rb | db/migrate/20160105231848_add_service_charge_to_disputes.rb | # frozen_string_literal: true
class AddServiceChargeToDisputes < ActiveRecord::Migration
def change
add_column :disputes, :service_charge_id, :integer
add_index :disputes, :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/20220303121239_alter_consumption_events_to_utf8mb4.rb | db/migrate/20220303121239_alter_consumption_events_to_utf8mb4.rb | # frozen_string_literal: true
class AlterConsumptionEventsToUtf8mb4 < ActiveRecord::Migration[6.1]
def up
execute alter_query(charset: "utf8mb4", int_type: "bigint")
end
def down
execute alter_query(charset: "utf8", int_type: "int")
end
private
def alter_query(charset:, int_type:)
<<~SQL
ALTER TABLE consumption_events
CHARACTER SET #{charset} COLLATE #{charset}_unicode_ci,
CHANGE `id` `id` #{int_type} NOT NULL AUTO_INCREMENT,
CHANGE `product_file_id` `product_file_id` #{int_type} DEFAULT NULL,
CHANGE `url_redirect_id` `url_redirect_id` #{int_type} DEFAULT NULL,
CHANGE `purchase_id` `purchase_id` #{int_type} DEFAULT NULL,
CHANGE `link_id` `link_id` #{int_type} DEFAULT NULL,
MODIFY `event_type` VARCHAR(255) CHARACTER SET #{charset} COLLATE #{charset}_unicode_ci DEFAULT NULL,
MODIFY `platform` VARCHAR(255) CHARACTER SET #{charset} COLLATE #{charset}_unicode_ci DEFAULT NULL,
MODIFY `json_data` TEXT CHARACTER SET #{charset} COLLATE #{charset}_unicode_ci DEFAULT NULL
SQL
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190930000937_add_installments_index_on_seller_and_product.rb | db/migrate/20190930000937_add_installments_index_on_seller_and_product.rb | # frozen_string_literal: true
class AddInstallmentsIndexOnSellerAndProduct < ActiveRecord::Migration
def change
add_index :installments, [:seller_id, :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/20140218061738_index_purchase_variants.rb | db/migrate/20140218061738_index_purchase_variants.rb | # frozen_string_literal: true
class IndexPurchaseVariants < ActiveRecord::Migration
def change
add_index :purchases_variants, :purchase_id
add_index :purchases_variants, :variant_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120531013446_create_failed_purchases.rb | db/migrate/20120531013446_create_failed_purchases.rb | # frozen_string_literal: true
class CreateFailedPurchases < ActiveRecord::Migration
def change
create_table :failed_purchases do |t|
# what to buy
t.integer :link_id
t.integer :price_cents
# who tries to buy
t.text :email
t.string :ip_address
# Card data
t.string :stripe_fingerprint
t.string :stripe_card_id
t.string :card_type
t.boolean :cvc_check
t.string :card_country
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/20130522000413_add_json_data_to_links.rb | db/migrate/20130522000413_add_json_data_to_links.rb | # frozen_string_literal: true
class AddJsonDataToLinks < ActiveRecord::Migration
def change
add_column :links, :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/20191102103149_add_fee_cents_to_refunds.rb | db/migrate/20191102103149_add_fee_cents_to_refunds.rb | # frozen_string_literal: true
class AddFeeCentsToRefunds < ActiveRecord::Migration
def up
add_column :refunds, :fee_cents, :integer
end
def down
remove_column :refunds, :fee_cents
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240928021009_drop_admin_action_call_infos_table.rb | db/migrate/20240928021009_drop_admin_action_call_infos_table.rb | # frozen_string_literal: true
class DropAdminActionCallInfosTable < ActiveRecord::Migration[7.1]
def up
drop_table :admin_action_call_infos
end
def down
create_table :admin_action_call_infos do |t|
t.string :controller_name, null: false
t.string :action_name, null: false
t.integer :call_count, default: 0, null: false
t.timestamps
end
add_index :admin_action_call_infos, [:controller_name, :action_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/20201228043940_add_stripe_transfer_id_index_on_payments.rb | db/migrate/20201228043940_add_stripe_transfer_id_index_on_payments.rb | # frozen_string_literal: true
class AddStripeTransferIdIndexOnPayments < ActiveRecord::Migration[6.0]
def change
add_index :payments, :stripe_transfer_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220511094715_change_transcoded_video_key.rb | db/migrate/20220511094715_change_transcoded_video_key.rb | # frozen_string_literal: true
class ChangeTranscodedVideoKey < ActiveRecord::Migration[6.1]
def up
change_column :transcoded_videos, :transcoded_video_key, :string, limit: 2048
end
def down
change_column :transcoded_videos, :transcoded_video_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/20120113003204_add_currency_type_to_user.rb | db/migrate/20120113003204_add_currency_type_to_user.rb | # frozen_string_literal: true
class AddCurrencyTypeToUser < ActiveRecord::Migration
def change
add_column :users, :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/20230622201742_add_duration_in_months_to_purchase_offer_code_discounts.rb | db/migrate/20230622201742_add_duration_in_months_to_purchase_offer_code_discounts.rb | # frozen_string_literal: true
class AddDurationInMonthsToPurchaseOfferCodeDiscounts < ActiveRecord::Migration[7.0]
def change
change_table :purchase_offer_code_discounts, 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/20231117094332_product_native_type_not_null.rb | db/migrate/20231117094332_product_native_type_not_null.rb | # frozen_string_literal: true
class ProductNativeTypeNotNull < ActiveRecord::Migration[7.0]
def change
change_column_null :links, :native_type, false, Link::NATIVE_TYPE_DIGITAL
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130222060954_add_flags_to_users.rb | db/migrate/20130222060954_add_flags_to_users.rb | # frozen_string_literal: true
class AddFlagsToUsers < ActiveRecord::Migration
def change
add_column :users, :flags, :integer, 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/20121003035232_add_deleted_at_index_to_links.rb | db/migrate/20121003035232_add_deleted_at_index_to_links.rb | # frozen_string_literal: true
class AddDeletedAtIndexToLinks < ActiveRecord::Migration
def change
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/20251124133549_add_abandoned_cart_indexes.rb | db/migrate/20251124133549_add_abandoned_cart_indexes.rb | # frozen_string_literal: true
class AddAbandonedCartIndexes < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
add_index :carts, [:deleted_at, :updated_at]
add_index :cart_products, [:deleted_at, :cart_id]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20200814224423_add_highlighted_membership_to_users.rb | db/migrate/20200814224423_add_highlighted_membership_to_users.rb | # frozen_string_literal: true
class AddHighlightedMembershipToUsers < ActiveRecord::Migration[5.0]
def change
add_reference :users, :highlighted_membership
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20141122174615_change_webhooked_url_to_text.rb | db/migrate/20141122174615_change_webhooked_url_to_text.rb | # frozen_string_literal: true
class ChangeWebhookedUrlToText < ActiveRecord::Migration
def up
change_column :url_redirects, :webhooked_url, :text
end
def down
change_column :url_redirects, :webhooked_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/20230719161044_add_flags_to_upsells.rb | db/migrate/20230719161044_add_flags_to_upsells.rb | # frozen_string_literal: true
class AddFlagsToUpsells < ActiveRecord::Migration[7.0]
def change
change_table :upsells, bulk: true do |t|
t.integer :flags, default: 0, null: false
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240626144207_create_commissions.rb | db/migrate/20240626144207_create_commissions.rb | # frozen_string_literal: true
class CreateCommissions < ActiveRecord::Migration[7.1]
def change
create_table :commissions do |t|
t.string :status
t.references :deposit_purchase
t.references :completion_purchase
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/20230211144911_create_seller_profile.rb | db/migrate/20230211144911_create_seller_profile.rb | # frozen_string_literal: true
class CreateSellerProfile < ActiveRecord::Migration[7.0]
def change
create_table :seller_profiles do |t|
t.references :seller, index: true, null: false
t.string :highlight_color
t.string :background_color
t.string :font
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/20240208204727_add_json_data_to_credit_cards.rb | db/migrate/20240208204727_add_json_data_to_credit_cards.rb | # frozen_string_literal: true
class AddJsonDataToCreditCards < ActiveRecord::Migration[7.0]
def change
add_column :credit_cards, :json_data, :json
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250122100830_rename_utm_link_driven_sales_order_id_to_purchase_id.rb | db/migrate/20250122100830_rename_utm_link_driven_sales_order_id_to_purchase_id.rb | # frozen_string_literal: true
class RenameUtmLinkDrivenSalesOrderIdToPurchaseId < ActiveRecord::Migration[7.1]
def change
change_table :utm_link_driven_sales, bulk: true do |t|
t.remove_index [:utm_link_visit_id, :order_id], unique: true
t.remove_index :order_id
t.rename :order_id, :purchase_id
t.index [:utm_link_visit_id, :purchase_id], unique: 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/20150501185757_add_asset_previews.rb | db/migrate/20150501185757_add_asset_previews.rb | # frozen_string_literal: true
class AddAssetPreviews < ActiveRecord::Migration
def change
create_table :asset_previews, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.belongs_to :link
t.attachment :attachment
t.string :guid
t.text :oembed
t.timestamps
t.datetime :deleted_at
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/20130219014757_add_deleted_at_to_variants.rb | db/migrate/20130219014757_add_deleted_at_to_variants.rb | # frozen_string_literal: true
class AddDeletedAtToVariants < ActiveRecord::Migration
def change
add_column :variants, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150513164427_add_recommendation_type_to_users.rb | db/migrate/20150513164427_add_recommendation_type_to_users.rb | # frozen_string_literal: true
class AddRecommendationTypeToUsers < ActiveRecord::Migration
def change
add_column :users, :recommendation_type, :string, default: User::RecommendationType::SAME_CREATOR_PRODUCTS, 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/20230905142104_change_product_files_archives_json_data_type.rb | db/migrate/20230905142104_change_product_files_archives_json_data_type.rb | # frozen_string_literal: true
class ChangeProductFilesArchivesJsonDataType < ActiveRecord::Migration[7.0]
def up
change_column :product_files_archives, :json_data, :mediumtext
end
def down
change_column :product_files_archives, :json_data, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190803211425_add_shown_on_profile_to_product_taggings.rb | db/migrate/20190803211425_add_shown_on_profile_to_product_taggings.rb | # frozen_string_literal: true
class AddShownOnProfileToProductTaggings < ActiveRecord::Migration
def up
add_column :product_taggings, :shown_on_profile, :boolean
change_column_default :product_taggings, :shown_on_profile, true
end
def down
remove_column :product_taggings, :shown_on_profile
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240218091437_add_seller_id_and_indexes_to_subscription_events.rb | db/migrate/20240218091437_add_seller_id_and_indexes_to_subscription_events.rb | # frozen_string_literal: true
class AddSellerIdAndIndexesToSubscriptionEvents < ActiveRecord::Migration[7.0]
def change
change_table :subscription_events, bulk: true do |t|
t.bigint :seller_id
t.index [:seller_id, :occurred_at]
end
end
end
| 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.