source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150818073723_add_duration_to_link_and_occurence_to_subscription.rb | Ruby | mit | 8,966 | main | 249 | # frozen_string_literal: true
class AddDurationToLinkAndOccurenceToSubscription < ActiveRecord::Migration
def change
add_column :links, :duration_in_months, :integer
add_column :subscriptions, :charge_occurrence_count, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120424204521_change_card_type_to_type.rb | Ruby | mit | 8,966 | main | 223 | # frozen_string_literal: true
class ChangeCardTypeToType < ActiveRecord::Migration
def up
rename_column :credit_cards, :card_type, :type
end
def down
rename_column :credit_cards, :type, :card_type
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240206111225_create_purchase_custom_fields.rb | Ruby | mit | 8,966 | main | 330 | # frozen_string_literal: true
class CreatePurchaseCustomFields < ActiveRecord::Migration[7.0]
def change
create_table :purchase_custom_fields do |t|
t.belongs_to :purchase, null: false
t.string :field_type, null: false
t.string :name, null: false
t.text :value
t.timestamps
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150922003020_create_import_jobs.rb | Ruby | mit | 8,966 | main | 383 | # frozen_string_literal: true
class CreateImportJobs < ActiveRecord::Migration
def change
create_table :import_jobs, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.string :import_file_url
t.integer :user_id
t.integer :link_id
t.string :state
t.integer :flags,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240423190023_standardize_subscriptions.rb | Ruby | mit | 8,966 | main | 1,757 | # 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, :datetim... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231119190039_drop_delayed_emails.rb | Ruby | mit | 8,966 | main | 446 | # frozen_string_literal: true
class DropDelayedEmails < ActiveRecord::Migration[7.0]
def up
drop_table :delayed_emails
end
def down
create_table "delayed_emails", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.integer "purchase_id"
t.datetime "created_at", precisi... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130419202453_create_preorders.rb | Ruby | mit | 8,966 | main | 438 | # frozen_string_literal: true
class CreatePreorders < ActiveRecord::Migration
def change
create_table :preorders do |t|
t.references :preorder_link, null: false
t.references :seller, null: false
t.references :purchaser
t.string :state, null: false
t.timestamps
end
add_index... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231119164304_drop_correlated_taxonomies.rb | Ruby | mit | 8,966 | main | 550 | # frozen_string_literal: true
class DropCorrelatedTaxonomies < ActiveRecord::Migration[7.0]
def up
drop_table :correlated_taxonomies
end
def down
create_table "correlated_taxonomies", charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.bigint "taxonomy_id", null: false
t.json "relat... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190521161425_create_product_review_stats.rb | Ruby | mit | 8,966 | main | 665 | # 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.intege... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200904153310_change_versions_id_type.rb | Ruby | mit | 8,966 | main | 369 | # frozen_string_literal: true
class ChangeVersionsIdType < ActiveRecord::Migration[5.2]
def up
safety_assured do
change_column :versions, :id, :bigint, null: false, unique: true, auto_increment: true
end
end
def down
safety_assured do
change_column :versions, :id, :int, null: false, uniq... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210121062551_add_missing_indexes_to_user.rb | Ruby | mit | 8,966 | main | 284 | # frozen_string_literal: true
class AddMissingIndexesToUser < ActiveRecord::Migration[6.0]
def change
change_table :users do |t|
t.index :current_sign_in_ip
t.index :last_sign_in_ip
t.index :account_created_ip
t.index :user_risk_state
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210106035128_add_missing_indices_to_purchases.rb | Ruby | mit | 8,966 | main | 7,603 | # frozen_string_literal: true
class AddMissingIndicesToPurchases < ActiveRecord::Migration[6.0]
def up
execute <<~SQL
ALTER TABLE purchases CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
add index index_purchases_on_seller_id_and_succeeded_at (seller_id, succeeded_at),
add index index_purcha... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190725194234_add_index_for_users_payment_address.rb | Ruby | mit | 8,966 | main | 252 | # frozen_string_literal: true
class AddIndexForUsersPaymentAddress < ActiveRecord::Migration
def up
add_index :users, [:payment_address, :user_risk_state]
end
def down
remove_index :users, [:payment_address, :user_risk_state]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150525200251_create_payment_options.rb | Ruby | mit | 8,966 | main | 467 | # frozen_string_literal: true
class CreatePaymentOptions < ActiveRecord::Migration
def change
create_table :payment_options, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :subscription
t.references :price
t.timestamps
t.datetime :deleted_at
t.int... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200111113222_add_sent_email_infos_index_on_created_at.rb | Ruby | mit | 8,966 | main | 227 | # frozen_string_literal: true
class AddSentEmailInfosIndexOnCreatedAt < ActiveRecord::Migration
def up
add_index :sent_email_infos, :created_at
end
def down
remove_index :sent_email_infos, :created_at
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191121171504_add_app_type_to_device.rb | Ruby | mit | 8,966 | main | 330 | # frozen_string_literal: true
class AddAppTypeToDevice < ActiveRecord::Migration
def up
add_column :devices, :app_type, :string, null: false, limit: 255
change_column_default :devices, :app_type, "consumer"
add_index :devices, [:app_type, :user_id]
end
def down
remove_column :devices, :app_type
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230607141143_create_sales_related_products_infos.rb | Ruby | mit | 8,966 | main | 665 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150619185755_create_third_party_analytics.rb | Ruby | mit | 8,966 | main | 500 | # frozen_string_literal: true
class CreateThirdPartyAnalytics < ActiveRecord::Migration
def change
create_table :third_party_analytics, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer :user_id
t.integer :link_id
t.text :analytics_code
t.integer :flags, defau... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201118135156_remove_unused_users_columns_202011.rb | Ruby | mit | 8,966 | main | 1,356 | # frozen_string_literal: true
class RemoveUnusedUsersColumns202011 < ActiveRecord::Migration[6.0]
def up
change_table :users do |t|
t.remove :background_video_url
t.remove :number_of_views
t.remove :absorbed_to_user_id
t.remove :beta
t.remove :soundcloud_username
t.remove :sou... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141203200306_create_installment_rules.rb | Ruby | mit | 8,966 | main | 435 | # frozen_string_literal: true
class CreateInstallmentRules < ActiveRecord::Migration
def change
create_table :installment_rules do |t|
t.integer :installment_id
t.integer :relative_delivery_time
t.datetime :to_be_published_at
t.integer :version, default: 0, null: false
t.datetime :d... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231002212026_remove_shown_on_profile_from_products.rb | Ruby | mit | 8,966 | main | 323 | # frozen_string_literal: true
class RemoveShownOnProfileFromProducts < ActiveRecord::Migration[7.0]
def up
remove_column :links, :shown_on_profile
end
def down
change_table :links, bulk: true do |t|
t.column :shown_on_profile, :boolean, default: true
t.index :shown_on_profile
end
end
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150616175837_rename_oauth_application_owner_id_to_affiliate_user_id.rb | Ruby | mit | 8,966 | main | 623 | # frozen_string_literal: true
class RenameOauthApplicationOwnerIdToAffiliateUserId < ActiveRecord::Migration
def up
remove_index :affiliate_credits, name: "index_affiliate_credits_on_oauth_application_owner_id"
rename_column :affiliate_credits, :oauth_application_owner_id, :affiliate_user_id
add_index :a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230707223804_remove_category_tables.rb | Ruby | mit | 8,966 | main | 1,393 | # frozen_string_literal: true
class RemoveCategoryTables < ActiveRecord::Migration[7.0]
def up
drop_table :categories
drop_table :product_categorizations
drop_table :user_categorizations
end
def down
create_table "categories", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111221011759_change_names_to_original.rb | Ruby | mit | 8,966 | main | 470 | # frozen_string_literal: true
class ChangeNamesToOriginal < ActiveRecord::Migration
def up
Attachment.find_each do |attachment|
puts attachment.id
original_file_name = attachment.file_file_name
next unless original_file_name
# base = File.basename(original_file_name)
ext = File.extn... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141122174615_change_webhooked_url_to_text.rb | Ruby | mit | 8,966 | main | 239 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150616225303_create_affiliates.rb | Ruby | mit | 8,966 | main | 555 | # frozen_string_literal: true
class CreateAffiliates < ActiveRecord::Migration
def change
create_table :affiliates, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer :seller_id
t.integer :affiliate_user_id
t.references :link
t.integer :affiliate_basis_points
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201008081331_add_tax_and_fee_to_purchase_index.rb | Ruby | mit | 8,966 | main | 396 | # frozen_string_literal: true
class AddTaxAndFeeToPurchaseIndex < ActiveRecord::Migration[6.0]
def up
Elasticsearch::Model.client.indices.put_mapping(
index: "purchases_v2",
type: "purchase",
body: {
purchase: {
properties: {
fee_cents: { type: "long" },
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240222000604_add_index_on_media_locations_purchase_file_consumed_at.rb | Ruby | mit | 8,966 | main | 291 | # frozen_string_literal: true
class AddIndexOnMediaLocationsPurchaseFileConsumedAt < ActiveRecord::Migration[7.0]
def change
add_index :media_locations, [:purchase_id, :product_file_id, :consumed_at], name: "index_media_locations_on_purchase_id_product_file_id_consumed_at"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210725083553_change_media_location_ids_to_bigint.rb | Ruby | mit | 8,966 | main | 721 | # frozen_string_literal: true
class ChangeMediaLocationIdsToBigint < ActiveRecord::Migration[6.1]
def up
change_table :media_locations, bulk: true do |t|
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :product_file_id, :bigint
t.change :url_redirect_id, :bigint
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230316123640_add_flags_to_subscription_plan_changes.rb | Ruby | mit | 8,966 | main | 209 | # frozen_string_literal: true
class AddFlagsToSubscriptionPlanChanges < ActiveRecord::Migration[7.0]
def change
add_column :subscription_plan_changes, :flags, :bigint, default: 0, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210106033416_add_missing_indices_to_affiliate_credits.rb | Ruby | mit | 8,966 | main | 405 | # frozen_string_literal: true
class AddMissingIndicesToAffiliateCredits < ActiveRecord::Migration[6.0]
def change
change_table :affiliate_credits do |t|
t.index :affiliate_credit_refund_balance_id
t.index :affiliate_credit_success_balance_id
t.index :affiliate_credit_chargeback_balance_id, name... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211013114048_change_product_folder_name.rb | Ruby | mit | 8,966 | main | 256 | # frozen_string_literal: true
class ChangeProductFolderName < ActiveRecord::Migration[6.1]
def up
change_column :product_folders, :name, :string, null: false
end
def down
change_column :product_folders, :name, :string, null: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121019231317_add_created_at_ip_to_users.rb | Ruby | mit | 8,966 | main | 229 | # frozen_string_literal: true
class AddCreatedAtIpToUsers < ActiveRecord::Migration
def up
add_column :users, :account_created_ip, :string
end
def down
remove_column :users, :account_created_ip, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210819034447_add_purchaser_to_purchase_index.rb | Ruby | mit | 8,966 | main | 379 | # frozen_string_literal: true
class AddPurchaserToPurchaseIndex < ActiveRecord::Migration[6.1]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
purchaser: {
type: :nested,
properties: {
id: { type: :long }
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130717181612_add_tax_cents_to_purchases.rb | Ruby | mit | 8,966 | main | 224 | # frozen_string_literal: true
class AddTaxCentsToPurchases < ActiveRecord::Migration
def up
add_column :purchases, :tax_cents, :integer, default: 0
end
def down
remove_column :purchases, :tax_cents
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120125204636_remove_columns.rb | Ruby | mit | 8,966 | main | 1,032 | # frozen_string_literal: true
class RemoveColumns < ActiveRecord::Migration
def up
remove_column :users, :create_date
remove_column :purchases, :create_date
remove_column :links, :create_date
remove_column :purchases, :owner
remove_column :links, :owner
remove_column :links, :length_of_excl... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120516231444_remove_stripe_disputed_from_purchases.rb | Ruby | mit | 8,966 | main | 235 | # frozen_string_literal: true
class RemoveStripeDisputedFromPurchases < ActiveRecord::Migration
def up
remove_column :purchases, :stripe_disputed
end
def down
add_column :purchases, :stripe_disputed, :boolean
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120518183521_add_attachment_profile_to_user.rb | Ruby | mit | 8,966 | main | 532 | # frozen_string_literal: true
class AddAttachmentProfileToUser < ActiveRecord::Migration
def self.up
add_column :users, :profile_file_name, :string
add_column :users, :profile_content_type, :string
add_column :users, :profile_file_size, :integer
add_column :users, :profile_updated_at, :datetime
end... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130625001834_create_dynamic_product_page_switch_assignments.rb | Ruby | mit | 8,966 | main | 527 | # frozen_string_literal: true
class CreateDynamicProductPageSwitchAssignments < ActiveRecord::Migration
def change
create_table :dynamic_product_page_switch_assignments do |t|
t.references :link
t.references :dynamic_product_page_switch
t.integer :switch_value
t.datetime :deleted_at
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220516205519_make_links_discover_fee_per_thousand_not_null.rb | Ruby | mit | 8,966 | main | 200 | # frozen_string_literal: true
class MakeLinksDiscoverFeePerThousandNotNull < ActiveRecord::Migration[6.1]
def change
change_column_null :links, :discover_fee_per_thousand, false, 100
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200514132253_add_customizable_prices_for_variants.rb | Ruby | mit | 8,966 | main | 360 | # frozen_string_literal: true
class AddCustomizablePricesForVariants < ActiveRecord::Migration[5.1]
def up
add_column :base_variants, :customizable_price, :boolean
add_column :prices, :suggested_price_cents, :integer
end
def down
remove_column :prices, :suggested_price_cents
remove_column :base_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120614180000_remove_currency.rb | Ruby | mit | 8,966 | main | 246 | # frozen_string_literal: true
class RemoveCurrency < ActiveRecord::Migration
def up
drop_table :currencies
end
def down
create_table :currencies do |t|
t.float :currency_rate
t.string :currency_type
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220511094715_change_transcoded_video_key.rb | Ruby | mit | 8,966 | main | 281 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220723200147_recreate_products_index_for_user_id_type_change.rb | Ruby | mit | 8,966 | main | 240 | # frozen_string_literal: true
class RecreateProductsIndexForUserIdTypeChange < ActiveRecord::Migration[6.1]
def up
return unless Rails.env.development?
Link.__elasticsearch__.create_index!(force: true)
Link.import
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191014230105_change_installments_events_cache_count_default.rb | Ruby | mit | 8,966 | main | 284 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210502153119_remove_oauth_fields.rb | Ruby | mit | 8,966 | main | 538 | # frozen_string_literal: true
class RemoveOauthFields < ActiveRecord::Migration[6.1]
def up
change_table :oauth_applications do |t|
t.remove :icon_file_name
t.remove :icon_content_type
t.remove :icon_file_size
t.remove :icon_updated_at
t.remove :icon_guid
end
end
def down
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240503060350_add_index_on_gift_gifter_purchase_id.rb | Ruby | mit | 8,966 | main | 893 | # frozen_string_literal: true
class AddIndexOnGiftGifterPurchaseId < ActiveRecord::Migration[7.1]
def up
change_table :gifts, bulk: true do |t|
t.index :gifter_purchase_id
t.change :id, :bigint, null: false, auto_increment: true
t.change :giftee_purchase_id, :bigint
t.change :gifter_purc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120816213321_add_default_for_filetype.rb | Ruby | mit | 8,966 | main | 365 | # frozen_string_literal: true
class AddDefaultForFiletype < ActiveRecord::Migration
def up
change_column :links, :filetype, :string, default: "link"
change_column :links, :filegroup, :string, default: "url"
end
def down
change_column :links, :filetype, :string, default: nil
change_column :links,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20170418052305_generate_licenses_for_existing_customers.rb | Ruby | mit | 8,966 | main | 304 | # frozen_string_literal: true
class GenerateLicensesForExistingCustomers < ActiveRecord::Migration
def change
# Commented out as it is taking too long to run on production.
# Link.is_licensed.find_each do |link|
# CreateLicensesForExistingCustomers.perform(link.id)
# end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150915174708_increase_length_of_s3_url_fields.rb | Ruby | mit | 8,966 | main | 436 | # frozen_string_literal: true
class IncreaseLengthOfS3UrlFields < ActiveRecord::Migration
def change
change_column(:product_files, :url, :string, limit: 1024)
change_column(:processed_audios, :url, :string, limit: 1024)
change_column(:product_files_archives, :url, :string, limit: 1024)
change_column(... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231021143022_remove_submitted_at_on_dispute_evidences.rb | Ruby | mit | 8,966 | main | 315 | # frozen_string_literal: true
class RemoveSubmittedAtOnDisputeEvidences < ActiveRecord::Migration[7.0]
def up
remove_column :dispute_evidences, :submitted_at
end
def down
change_table :dispute_evidences, bulk: true do |t|
t.datetime :submitted_at
t.index :submitted_at
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230126145540_create_purchasing_power_parity_info.rb | Ruby | mit | 8,966 | main | 272 | # frozen_string_literal: true
class CreatePurchasingPowerParityInfo < ActiveRecord::Migration[7.0]
def change
create_table :purchasing_power_parity_infos do |t|
t.references :purchase, null: false
t.integer :factor
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20241209191839_update_refund_policies.rb | Ruby | mit | 8,966 | main | 487 | # frozen_string_literal: true
class UpdateRefundPolicies < ActiveRecord::Migration[7.1]
def up
add_column :refund_policies, :max_refund_period_in_days, :integer
change_column_null :refund_policies, :title, true
change_column_null :refund_policies, :product_id, true
end
def down
remove_column :re... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150929000001_add_holding_currency_to_balances.rb | Ruby | mit | 8,966 | main | 803 | # frozen_string_literal: true
class AddHoldingCurrencyToBalances < ActiveRecord::Migration
def up
add_column :balances, :currency, :string, default: "usd"
add_column :balances, :holding_currency, :string, default: "usd"
add_column :balances, :holding_amount_cents, :integer, default: 0
add_index :bal... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120430184313_remove_publisher_from_infos.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
class RemovePublisherFromInfos < ActiveRecord::Migration
def up
remove_column :infos, :publisher
end
def down
add_column :infos, :publisher, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121018222140_add_browser_guid_to_events_and_visits.rb | Ruby | mit | 8,966 | main | 308 | # frozen_string_literal: true
class AddBrowserGuidToEventsAndVisits < ActiveRecord::Migration
def up
add_column :events, :browser_guid, :string
add_column :visits, :browser_guid, :string
end
def down
remove_column :events, :browser_guid
remove_column :visits, :browser_guid
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150310211530_create_shipments.rb | Ruby | mit | 8,966 | main | 352 | # 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 :sh... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141007071105_add_user_id_to_offer_codes.rb | Ruby | mit | 8,966 | main | 233 | # frozen_string_literal: true
class AddUserIdToOfferCodes < ActiveRecord::Migration
def change
add_column :offer_codes, :user_id, :integer
add_index :offer_codes, [:user_id], name: "index_offer_codes_on_user_id"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150513231714_create_product_files_archives.rb | Ruby | mit | 8,966 | main | 671 | # frozen_string_literal: true
class CreateProductFilesArchives < ActiveRecord::Migration
def change
create_table :product_files_archives do |t|
t.timestamp :deleted_at
t.belongs_to :link
t.belongs_to :installment
t.attachment :zip_archive_file
t.string :product_files_archive_state
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150506234022_create_consumption_events.rb | Ruby | mit | 8,966 | main | 565 | # 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 :ev... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220308192852_remove_name_from_taxonomies.rb | Ruby | mit | 8,966 | main | 462 | # frozen_string_literal: true
class RemoveNameFromTaxonomies < ActiveRecord::Migration[6.1]
def up
change_table(:taxonomies, bulk: true) do |t|
t.remove :name
t.index "(IFNULL(`parent_id`,0)), `slug`", name: :index_taxonomies_on_parent_id_and_slug, unique: true
end
end
def down
change_ta... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240425113841_create_sent_abandoned_cart_emails.rb | Ruby | mit | 8,966 | main | 283 | # frozen_string_literal: true
class CreateSentAbandonedCartEmails < ActiveRecord::Migration[7.1]
def change
create_table :sent_abandoned_cart_emails do |t|
t.references :cart, null: false
t.references :installment, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231101092721_add_user_compliance_info_requests_index_on_user_id_and_state.rb | Ruby | mit | 8,966 | main | 207 | # frozen_string_literal: true
class AddUserComplianceInfoRequestsIndexOnUserIdAndState < ActiveRecord::Migration[7.0]
def change
add_index :user_compliance_info_requests, [:user_id, :state]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201214172042_add_stripe_sca_columns_to_purchase.rb | Ruby | mit | 8,966 | main | 883 | # frozen_string_literal: true
class AddStripeScaColumnsToPurchase < ActiveRecord::Migration[6.0]
def up
# Using raw SQL due to a bug in departure gem: https://github.com/gumroad/web/pull/17299#issuecomment-786054996
execute <<~SQL
ALTER TABLE purchases
ADD COLUMN processor_payment_intent_id VAR... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130524233006_add_attachment_icon_to_oauth_applications.rb | Ruby | mit | 8,966 | main | 281 | # frozen_string_literal: true
class AddAttachmentIconToOauthApplications < ActiveRecord::Migration
def self.up
change_table :oauth_applications do |t|
t.has_attached_file :icon
end
end
def self.down
drop_attached_file :oauth_applications, :icon
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220210162200_create_purchase_offer_code_discounts.rb | Ruby | mit | 8,966 | main | 497 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140730235200_fix_twitter_user_id.rb | Ruby | mit | 8,966 | main | 222 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230320184956_create_backtax_agreements.rb | Ruby | mit | 8,966 | main | 296 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190520204751_add_megaphone_states.rb | Ruby | mit | 8,966 | main | 284 | # frozen_string_literal: true
class AddMegaphoneStates < ActiveRecord::Migration
def change
create_table :megaphone_states do |t|
t.integer :user_id
t.bigint :flags, null: false, default: 0
end
add_index :megaphone_states, :user_id, unique: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230330021302_add_microseconds_to_products_updated_at.rb | Ruby | mit | 8,966 | main | 268 | # frozen_string_literal: true
class AddMicrosecondsToProductsUpdatedAt < ActiveRecord::Migration[7.0]
def up
change_column :links, :updated_at, :datetime, precision: 6
end
def down
change_column :links, :updated_at, :datetime, precision: nil
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210219002017_migrate_es_indices_document_type.rb | Ruby | mit | 8,966 | main | 333 | # frozen_string_literal: true
class MigrateEsIndicesDocumentType < ActiveRecord::Migration[6.1]
# Original migration: https://github.com/antiwork/gumroad/blob/main/db/migrate/20210219002017_migrate_es_indices_document_type.rb
def up
return if Rails.env.production?
DevTools.delete_all_indices_and_reindex_a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210529190819_create_product_folders.rb | Ruby | mit | 8,966 | main | 267 | # frozen_string_literal: true
class CreateProductFolders < ActiveRecord::Migration[6.1]
def change
create_table :product_folders do |t|
t.bigint :product_id, index: true
t.string :name
t.integer :position
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20131204033717_remove_name_index_from_oauth_applications.rb | Ruby | mit | 8,966 | main | 236 | # frozen_string_literal: true
class RemoveNameIndexFromOauthApplications < ActiveRecord::Migration
def up
remove_index :oauth_applications, :name
end
def down
add_index :oauth_applications, :name, unique: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130531220647_remove_index_on_follows.rb | Ruby | mit | 8,966 | main | 253 | # frozen_string_literal: true
class RemoveIndexOnFollows < ActiveRecord::Migration
def change
remove_index :follows, name: "index_follows_on_follower_id_and_followed_id"
remove_index :follows, name: "index_follows_on_followed_id"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111207004122_change_column_confirm.rb | Ruby | mit | 8,966 | main | 453 | # frozen_string_literal: true
class ChangeColumnConfirm < ActiveRecord::Migration
def up
rename_column :users, :email_verified_at, :confirmed_at
add_column :users, :confirmation_token, :string
add_column :users, :confirmation_sent_at, :datetime
end
def down
rename_column :users, :confirmed_at, :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20241126194353_remove_date_uniqueness_constraint_from_balances.rb | Ruby | mit | 8,966 | main | 582 | # frozen_string_literal: true
class RemoveDateUniquenessConstraintFromBalances < ActiveRecord::Migration[7.1]
def up
change_table :balances, bulk: true do |t|
t.index [:user_id, :merchant_account_id, :date], name: "index_on_user_merchant_account_date"
t.remove_index name: "unique_index"
end
end... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20261119011940_create_scheduled_payouts.rb | Ruby | mit | 8,966 | main | 590 | # frozen_string_literal: true
class CreateScheduledPayouts < ActiveRecord::Migration[7.1]
def change
create_table :scheduled_payouts do |t|
t.references :user, null: false, index: true
t.string :action, null: false
t.integer :delay_days, null: false, default: 21
t.datetime :scheduled_at, ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230612153224_add_minimum_quantity_to_offer_codes.rb | Ruby | mit | 8,966 | main | 214 | # frozen_string_literal: true
class AddMinimumQuantityToOfferCodes < ActiveRecord::Migration[7.0]
def change
change_table :offer_codes, bulk: true do |t|
t.integer "minimum_quantity"
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130224224840_create_follow_join_table.rb | Ruby | mit | 8,966 | main | 349 | # frozen_string_literal: true
class CreateFollowJoinTable < ActiveRecord::Migration
def change
create_table :follows, id: false do |t|
t.references :follower, null: false
t.references :followed, null: false
end
add_index :follows, [:follower_id, :followed_id], unique: true
add_index :fol... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240803162416_create_tips.rb | Ruby | mit | 8,966 | main | 244 | # frozen_string_literal: true
class CreateTips < ActiveRecord::Migration[7.1]
def change
create_table :tips do |t|
t.references :purchase, null: false
t.integer :value_cents, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120521221756_add_preview_guid_to_links.rb | Ruby | mit | 8,966 | main | 208 | # frozen_string_literal: true
class AddPreviewGuidToLinks < ActiveRecord::Migration
def up
add_column :links, :preview_guid, :string
end
def down
remove_column :links, :preview_guid
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115033310_remove_session_id_as_index_on_purchases.rb | Ruby | mit | 8,966 | main | 213 | # frozen_string_literal: true
class RemoveSessionIdAsIndexOnPurchases < ActiveRecord::Migration
def up
remove_index :purchases, :session_id
end
def down
add_index :purchases, :session_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230622131832_create_purchase_taxjar_infos.rb | Ruby | mit | 8,966 | main | 572 | # frozen_string_literal: true
class CreatePurchaseTaxjarInfos < ActiveRecord::Migration[7.0]
def change
create_table :purchase_taxjar_infos do |t|
t.references :purchase, null: false
t.decimal "combined_tax_rate", precision: 8, scale: 7
t.decimal "county_tax_rate", precision: 8, scale: 7
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230127125845_create_blocked_customer_objects.rb | Ruby | mit | 8,966 | main | 576 | # 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_em... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130104072633_create_credits.rb | Ruby | mit | 8,966 | main | 243 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121120001642_create_payments_balances.rb | Ruby | mit | 8,966 | main | 328 | # frozen_string_literal: true
class CreatePaymentsBalances < ActiveRecord::Migration
def change
create_table :payments_balances do |t|
t.references :payment
t.references :balance
t.timestamps
end
add_index :payments_balances, :payment_id
add_index :payments_balances, :balance_id
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220620150418_add_total_fee_cents_to_products_index.rb | Ruby | mit | 8,966 | main | 287 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111109221003_purchase_missing_attr.rb | Ruby | mit | 8,966 | main | 293 | # frozen_string_literal: true
class PurchaseMissingAttr < ActiveRecord::Migration
def up
add_column :purchases, :owner, :string
add_column :purchases, :create_date, :integer
end
def down
remove_column :purchases, :owner
remove_column :purchases, :create_date
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201207040118_remove_import_jobs.rb | Ruby | mit | 8,966 | main | 496 | # frozen_string_literal: true
class RemoveImportJobs < ActiveRecord::Migration[6.0]
def up
drop_table :import_jobs
end
def down
create_table "import_jobs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", force: :cascade do |t|
t.string "import_file_url", ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230216144650_create_product_embeddings.rb | Ruby | mit | 8,966 | main | 307 | # frozen_string_literal: true
class CreateProductEmbeddings < ActiveRecord::Migration[7.0]
def change
create_table :product_embeddings do |t|
t.references :product, null: false, index: { unique: true }
t.text :body, size: :medium
t.json :vector
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250225091231_create_community_chat_messages.rb | Ruby | mit | 8,966 | main | 367 | # frozen_string_literal: true
class CreateCommunityChatMessages < ActiveRecord::Migration[7.1]
def change
create_table :community_chat_messages do |t|
t.references :community, null: false
t.references :user, null: false
t.text :content, null: false, size: :long
t.datetime :deleted_at, ind... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210723152944_drop_fraud_refunds.rb | Ruby | mit | 8,966 | main | 283 | # frozen_string_literal: true
class DropFraudRefunds < ActiveRecord::Migration[6.1]
def up
drop_table :fraud_refunds
end
def down
create_table :fraud_refunds do |t|
t.bigint :refund_id, index: { unique: true }, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191127061350_remove_unique_index_from_custom_domain.rb | Ruby | mit | 8,966 | main | 310 | # frozen_string_literal: true
class RemoveUniqueIndexFromCustomDomain < ActiveRecord::Migration
def up
remove_index :custom_domains, :domain
add_index :custom_domains, :domain
end
def down
remove_index :custom_domains, :domain
add_index :custom_domains, :domain, unique: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230616124032_add_audience_members_purchased_variant_ids.rb | Ruby | mit | 8,966 | main | 775 | # frozen_string_literal: true
class AddAudienceMembersPurchasedVariantIds < ActiveRecord::Migration[7.0]
def up
change_table :audience_members, bulk: true do |t|
t.remove_index name: :idx_audience_on_seller_and_purchases_variants_ids
t.index "`seller_id`, (cast(json_extract(`details`,_utf8mb4'$.purch... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231219083048_create_charges.rb | Ruby | mit | 8,966 | main | 753 | # frozen_string_literal: true
class CreateCharges < ActiveRecord::Migration[7.0]
def change
create_table :charges do |t|
t.references :order, null: false
t.references :seller, null: false
t.string :processor, null: false
t.string :processor_transaction_id, index: { unique: true }
t.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130211200245_create_assignments.rb | Ruby | mit | 8,966 | main | 510 | # frozen_string_literal: true
class CreateAssignments < ActiveRecord::Migration
def change
create_table :assignments do |t|
t.integer :ab_test_id
t.integer :test_path_id
t.string :browser_guid
t.timestamps
end
add_index "assignments", ["browser_guid", "ab_test_id"], name: "index_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210811155205_create_base_variant_integration.rb | Ruby | mit | 8,966 | main | 435 | # frozen_string_literal: true
class CreateBaseVariantIntegration < ActiveRecord::Migration[6.1]
def change
create_table :base_variant_integrations do |t|
t.bigint :base_variant_id, null: false
t.bigint :integration_id, null: false
t.datetime :deleted_at
t.timestamps
end
add_inde... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231219084500_create_charge_purchases.rb | Ruby | mit | 8,966 | main | 265 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141125102727_add_index_on_follower_user_id.rb | Ruby | mit | 8,966 | main | 231 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140722233234_remove_index_from_daily_metrics.rb | Ruby | mit | 8,966 | main | 201 | # frozen_string_literal: true
class RemoveIndexFromDailyMetrics < ActiveRecord::Migration
def up
remove_index :daily_metrics, name: "index_daily_metrics_on_event_name_and_events_date"
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.