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/20210902085559_change_comment_ids_to_bigints_and_change_its_content_limit_and_add_deleted_at.rb | Ruby | mit | 8,966 | main | 737 | # frozen_string_literal: true
class ChangeCommentIdsToBigintsAndChangeItsContentLimitAndAddDeletedAt < ActiveRecord::Migration[6.1]
def up
change_table :comments, bulk: true do |t|
# Added
t.datetime :deleted_at, null: true
# Changed
t.change :id, :bigint, null: false, unique: true, auto... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220726011222_add_rated_as_adult_to_products_index.rb | Ruby | mit | 8,966 | main | 288 | # frozen_string_literal: true
class AddRatedAsAdultToProductsIndex < ActiveRecord::Migration[6.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
rated_as_adult: { type: "boolean" }
}
}
)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121113061128_add_balance_ids_to_purchases.rb | Ruby | mit | 8,966 | main | 311 | # frozen_string_literal: true
class AddBalanceIdsToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :purchase_success_balance_id, :integer
add_column :purchases, :purchase_chargeback_balance_id, :integer
add_column :purchases, :purchase_refund_balance_id, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140917180234_create_audit_tasks.rb | Ruby | mit | 8,966 | main | 406 | # frozen_string_literal: true
class CreateAuditTasks < ActiveRecord::Migration
def change
create_table :audit_tasks do |t|
t.string :name
t.references :owner
t.date :due_date
t.string :status
t.integer :recurrence_days
t.timestamps
end
add_index :audit_tasks, :owner_i... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200615140849_add_confidential_to_applications.rb | Ruby | mit | 8,966 | main | 502 | # frozen_string_literal: true
class AddConfidentialToApplications < ActiveRecord::Migration
def up
# Default generated is true. We set this to false for backwards compat
# https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions#database-changes-1
add_column :oauth_applications, :con... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240512134634_create_call_availabilities.rb | Ruby | mit | 8,966 | main | 282 | # frozen_string_literal: true
class CreateCallAvailabilities < ActiveRecord::Migration[7.1]
def change
create_table :call_availabilities do |t|
t.references :call, null: false
t.datetime :start_time
t.datetime :end_time
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220302222428_add_taxonomy_id_to_products_index.rb | Ruby | mit | 8,966 | main | 281 | # frozen_string_literal: true
class AddTaxonomyIdToProductsIndex < ActiveRecord::Migration[6.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
taxonomy_id: { type: "long" },
}
}
)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240724013512_add_deleted_at_index_to_product_files.rb | Ruby | mit | 8,966 | main | 1,090 | # frozen_string_literal: true
class AddDeletedAtIndexToProductFiles < ActiveRecord::Migration[7.1]
def up
change_table :product_files, bulk: true do |t|
t.index :deleted_at
t.change :id, :bigint, null: false, auto_increment: true
t.change :link_id, :bigint
t.change :installment_id, :bigi... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141008215224_create_user_compliance_info.rb | Ruby | mit | 8,966 | main | 688 | # frozen_string_literal: true
class CreateUserComplianceInfo < ActiveRecord::Migration
def change
create_table :user_compliance_info, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci" do |t|
t.references :user
t.string :full_name
t.string :street_address
t.string :city
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250331001118_add_streamable_to_transcoded_videos.rb | Ruby | mit | 8,966 | main | 204 | # frozen_string_literal: true
class AddStreamableToTranscodedVideos < ActiveRecord::Migration[7.1]
def change
add_reference :transcoded_videos, :streamable, polymorphic: true, null: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201207034544_remove_unused_parents_chidren.rb | Ruby | mit | 8,966 | main | 580 | # frozen_string_literal: true
class RemoveUnusedParentsChidren < ActiveRecord::Migration[6.0]
def up
drop_table :parents_children
end
def down
create_table "parents_children", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", force: :cascade do |t|
t.integer "... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210101171009_add_processor_payment_intent_id_to_service_charges.rb | Ruby | mit | 8,966 | main | 553 | # frozen_string_literal: true
class AddProcessorPaymentIntentIdToServiceCharges < 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 service_charges
ADD COLUMN processor_p... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220430143223_remove_default_from_affiliates_type.rb | Ruby | mit | 8,966 | main | 202 | # frozen_string_literal: true
class RemoveDefaultFromAffiliatesType < ActiveRecord::Migration[6.1]
def change
change_column_default :affiliates, :type, from: "DirectAffiliate", to: nil
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211129142053_remove_featured_posts.rb | Ruby | mit | 8,966 | main | 362 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220913190940_create_team_memberships.rb | Ruby | mit | 8,966 | main | 409 | # frozen_string_literal: true
class CreateTeamMemberships < ActiveRecord::Migration[6.1]
def change
create_table :team_memberships do |t|
t.bigint :seller_id, null: false
t.bigint :user_id, null: false
t.string :role, null: false
t.datetime :last_accessed_at
t.datetime :deleted_at
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20181009174700_remove_other_category.rb | Ruby | mit | 8,966 | main | 241 | # frozen_string_literal: true
class RemoveOtherCategory < ActiveRecord::Migration
def up
Category.where(name: "other").destroy_all
end
def down
category = Category.new
category.name = "other"
category.save!
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230414060233_create_post_email_blasts.rb | Ruby | mit | 8,966 | main | 573 | # frozen_string_literal: true
class CreatePostEmailBlasts < ActiveRecord::Migration[7.0]
def change
create_table :post_email_blasts do |t|
t.references :post, null: false, index: false
t.references :seller, null: false, index: false
t.datetime :requested_at, index: true
t.datetime :starte... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120113232255_add_historical_data.rb | Ruby | mit | 8,966 | main | 243 | # frozen_string_literal: true
class AddHistoricalData < ActiveRecord::Migration
def up
Purchase.update_all(displayed_price_currency_type: "usd")
Purchase.update_all("displayed_price_cents = price_cents")
end
def down
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201103221330_remove_applied_at_from_subscription_plan_changes.rb | Ruby | mit | 8,966 | main | 291 | # frozen_string_literal: true
class RemoveAppliedAtFromSubscriptionPlanChanges < ActiveRecord::Migration[6.0]
def up
safety_assured { remove_column :subscription_plan_changes, :applied_at }
end
def down
add_column :subscription_plan_changes, :applied_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141031182759_add_installment_id_to_product_file.rb | Ruby | mit | 8,966 | main | 219 | # frozen_string_literal: true
class AddInstallmentIdToProductFile < ActiveRecord::Migration
def change
add_column :product_files, :installment_id, :integer
add_index :product_files, :installment_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130211200121_create_ab_tests_table.rb | Ruby | mit | 8,966 | main | 456 | # frozen_string_literal: true
class CreateAbTestsTable < ActiveRecord::Migration
def change
create_table :ab_tests do |t|
t.string :name
t.string :page_name
t.boolean :is_active, default: false
t.datetime "deleted_at"
t.timestamps
end
add_index "ab_tests", ["name", "page_na... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250225090016_create_communities.rb | Ruby | mit | 8,966 | main | 402 | # frozen_string_literal: true
class CreateCommunities < ActiveRecord::Migration[7.1]
def change
create_table :communities do |t|
t.references :resource, polymorphic: true, null: false
t.references :seller, null: false
t.datetime :deleted_at, index: true
t.timestamps
t.index [:reso... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20221125144458_add_new_third_party_analytic_fields.rb | Ruby | mit | 8,966 | main | 255 | # frozen_string_literal: true
class AddNewThirdPartyAnalyticFields < ActiveRecord::Migration[7.0]
def change
change_table :third_party_analytics, bulk: true do |t|
t.string :name
t.string :location, default: "receipt"
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141120190256_add_facebook_and_image_conversion_tracking_to_users.rb | Ruby | mit | 8,966 | main | 259 | # frozen_string_literal: true
class AddFacebookAndImageConversionTrackingToUsers < ActiveRecord::Migration
def change
add_column :users, :conversion_tracking_facebook_id, :string
add_column :users, :conversion_tracking_image_url, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230227210525_create_user_recommended_root_taxonomies.rb | Ruby | mit | 8,966 | main | 395 | # frozen_string_literal: true
class CreateUserRecommendedRootTaxonomies < ActiveRecord::Migration[7.0]
def change
create_table :user_recommended_root_taxonomies do |t|
t.references :user, null: false, index: false
t.references :taxonomy, null: false, index: false
t.integer :position, null: fals... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211020222413_create_product_page_view_index.rb | Ruby | mit | 8,966 | main | 737 | # frozen_string_literal: true
class CreateProductPageViewIndex < ActiveRecord::Migration[6.1]
def up
if Rails.env.production? || Rails.env.staging?
ProductPageView.__elasticsearch__.create_index!(index: "product_page_views_v1")
EsClient.indices.put_alias(name: "product_page_views", index: "product_pa... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250331004347_create_video_files.rb | Ruby | mit | 8,966 | main | 909 | # frozen_string_literal: true
class CreateVideoFiles < ActiveRecord::Migration[7.1]
def change
create_table :video_files do |t|
t.references :record, polymorphic: true, null: false
t.string :url # S3 URL of the original file
t.string :filetype # File extension (e.g... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201026060716_add_split_payment_by_cents_to_users.rb | Ruby | mit | 8,966 | main | 242 | # frozen_string_literal: true
class AddSplitPaymentByCentsToUsers < ActiveRecord::Migration[6.0]
def up
add_column :users, :split_payment_by_cents, :integer
end
def down
remove_column :users, :split_payment_by_cents
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150601000000_add_stripe_bank_account_id_to_bank_accounts.rb | Ruby | mit | 8,966 | main | 247 | # frozen_string_literal: true
class AddStripeBankAccountIdToBankAccounts < ActiveRecord::Migration
def change
add_column :bank_accounts, :stripe_bank_account_id, :string
add_column :bank_accounts, :stripe_fingerprint, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210519182305_create_purchase_wallet_types.rb | Ruby | mit | 8,966 | main | 293 | # frozen_string_literal: true
class CreatePurchaseWalletTypes < ActiveRecord::Migration[6.1]
def change
create_table :purchase_wallet_types do |t|
t.references :purchase, index: { unique: true }, null: false
t.string :wallet_type, index: true, null: false
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210920213746_add_product_and_seller_names_to_purchase_mapping.rb | Ruby | mit | 8,966 | main | 1,546 | # frozen_string_literal: true
class AddProductAndSellerNamesToPurchaseMapping < ActiveRecord::Migration[6.1]
def up
EsClient.indices.close(index: Purchase.index_name)
EsClient.indices.put_settings(
index: Purchase.index_name,
body: {
settings: {
index: {
analysis: {
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210502193415_drop_preview_columns.rb | Ruby | mit | 8,966 | main | 1,060 | # frozen_string_literal: true
class DropPreviewColumns < ActiveRecord::Migration[6.1]
def up
change_table :links do |t|
t.remove "preview_file_name"
t.remove "preview_content_type"
t.remove "preview_file_size"
t.remove "preview_updated_at"
t.remove "preview_guid"
t.remove "att... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220420204744_add_discover_fee_to_product_index.rb | Ruby | mit | 8,966 | main | 297 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231101082733_add_merchant_accounts_index_on_charge_processor_merchant_id.rb | Ruby | mit | 8,966 | main | 207 | # frozen_string_literal: true
class AddMerchantAccountsIndexOnChargeProcessorMerchantId < ActiveRecord::Migration[7.0]
def change
add_index :merchant_accounts, :charge_processor_merchant_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130417235936_create_zip_tax_rates.rb | Ruby | mit | 8,966 | main | 537 | # frozen_string_literal: true
class CreateZipTaxRates < ActiveRecord::Migration
def change
create_table :zip_tax_rates do |t|
t.decimal :combined_rate, precision: 8, scale: 7
t.decimal :county_rate, precision: 8, scale: 7
t.decimal :special_rate, precision: 8, scale: 7
t.string :state
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240626160241_create_calls.rb | Ruby | mit | 8,966 | main | 285 | # frozen_string_literal: true
class CreateCalls < ActiveRecord::Migration[7.1]
def change
create_table :calls do |t|
t.references :purchase
t.string :call_url, limit: 1024
t.datetime :start_time
t.datetime :end_time
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115040149_add_price_cents_index_to_purchases.rb | Ruby | mit | 8,966 | main | 219 | # frozen_string_literal: true
class AddPriceCentsIndexToPurchases < ActiveRecord::Migration
def up
add_index "purchases", ["price_cents"]
end
def down
remove_index "purchases", ["price_cents"]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150818004412_rename_media_location_to_media_location_percentage.rb | Ruby | mit | 8,966 | main | 315 | # frozen_string_literal: true
class RenameMediaLocationToMediaLocationPercentage < ActiveRecord::Migration
def up
rename_column :consumption_events, :media_location, :media_location_basis_points
end
def down
rename_column :consumption_events, :media_location_basis_points, :media_location
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130513235232_create_transcoded_videos.rb | Ruby | mit | 8,966 | main | 471 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231217195245_add_flags_to_seller_profile_sections.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
class AddFlagsToSellerProfileSections < ActiveRecord::Migration[7.0]
def change
add_column :seller_profile_sections, :flags, :bigint, default: 0, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20241102102125_expire_transcoded_videos.rb | Ruby | mit | 8,966 | main | 483 | # frozen_string_literal: true
class ExpireTranscodedVideos < ActiveRecord::Migration[7.1]
def up
change_table :transcoded_videos, bulk: true do |t|
t.datetime :deleted_at, index: true
t.datetime :last_accessed_at, index: true
t.index :transcoded_video_key
end
end
def down
change_ta... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121005041429_change_hightlight_color_to_highlight_color.rb | Ruby | mit | 8,966 | main | 262 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150909000001_add_timestamps_to_disputes.rb | Ruby | mit | 8,966 | main | 208 | # frozen_string_literal: true
class AddTimestampsToDisputes < ActiveRecord::Migration
def change
add_column :disputes, :created_at, :datetime
add_column :disputes, :updated_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120815194340_add_default_to_preview_processed.rb | Ruby | mit | 8,966 | main | 268 | # frozen_string_literal: true
class AddDefaultToPreviewProcessed < ActiveRecord::Migration
def up
change_column :links, :preview_processed, :boolean, default: true
end
def down
change_column :links, :preview_processed, :boolean, default: nil
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210624093649_remove_unused_columns_from_users.rb | Ruby | mit | 8,966 | main | 873 | # frozen_string_literal: true
class RemoveUnusedColumnsFromUsers < ActiveRecord::Migration[6.1]
def up
change_table :users, bulk: true do |t|
t.remove :reset_hash
t.remove :password_salt
t.remove :relationship
t.remove :theme
t.remove :platform_id
t.change :id, :bigint, null: ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151027195941_recreate_product_tags.rb | Ruby | mit | 8,966 | main | 439 | # frozen_string_literal: true
class RecreateProductTags < ActiveRecord::Migration
def change
create_table(:tags) do |t|
t.string(:name, limit: 100)
t.timestamps
end
add_index(:tags, :name)
create_table(:product_taggings) do |t|
t.belongs_to(:tag)
t.belongs_to(:product)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201001091435_create_link_view_events.rb | Ruby | mit | 8,966 | main | 2,341 | # frozen_string_literal: true
class CreateLinkViewEvents < ActiveRecord::Migration[6.0]
def change
# https://dev.mysql.com/doc/refman/5.6/en/integer-types.html
starting_id = 2147483648 # INT maximum value signed + 1
create_table "link_view_events", options: "ENGINE=InnoDB AUTO_INCREMENT=#{starting_id} DE... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130920180213_create_resource_subscriptions.rb | Ruby | mit | 8,966 | main | 584 | # frozen_string_literal: true
class CreateResourceSubscriptions < ActiveRecord::Migration
def change
create_table :resource_subscriptions do |t|
t.references :oauth_application, null: false
t.references :user, null: false
t.string :resource_name, null: false
t.string :post_url
t.ti... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230303073007_drop_product_embeddings.rb | Ruby | mit | 8,966 | main | 560 | # frozen_string_literal: true
class DropProductEmbeddings < ActiveRecord::Migration[7.0]
def up
drop_table :product_embeddings
end
def down
create_table "product_embeddings", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.bigint "product_id", null: false
t.text... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150928999999_create_balance_transactions.rb | Ruby | mit | 8,966 | main | 1,104 | # frozen_string_literal: true
class CreateBalanceTransactions < ActiveRecord::Migration
def change
create_table :balance_transactions, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.timestamps
t.references :user
t.references :merchant_account
t.references :balance... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210520070731_add_created_updated_fields_to_shipping_destination.rb | Ruby | mit | 8,966 | main | 289 | # frozen_string_literal: true
class AddCreatedUpdatedFieldsToShippingDestination < ActiveRecord::Migration[6.1]
def change
change_table :shipping_destinations, bulk: true do |t|
t.datetime :created_at, precision: 6
t.datetime :updated_at, precision: 6
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111122002403_create_receipts.rb | Ruby | mit | 8,966 | main | 212 | # frozen_string_literal: true
class CreateReceipts < ActiveRecord::Migration
def change
create_table :receipts do |t|
t.text :email
t.integer :purchase_id
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150128193618_add_tax_fields_to_refunds.rb | Ruby | mit | 8,966 | main | 216 | # frozen_string_literal: true
class AddTaxFieldsToRefunds < ActiveRecord::Migration
def change
add_column :refunds, :creator_tax_cents, :integer
add_column :refunds, :gumroad_tax_cents, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130626020421_add_card_expiry_to_purchases.rb | Ruby | mit | 8,966 | main | 222 | # frozen_string_literal: true
class AddCardExpiryToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :card_expiry_month, :integer
add_column :purchases, :card_expiry_year, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121106231436_add_browser_guid_to_purchase.rb | Ruby | mit | 8,966 | main | 302 | # frozen_string_literal: true
class AddBrowserGuidToPurchase < ActiveRecord::Migration
def up
add_column :purchases, :browser_guid, :string
add_index :purchases, :browser_guid
end
def down
remove_column :purchases, :browser_guid
remove_index :purchases, :browser_guid
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150617000000_create_user_compliance_info_request.rb | Ruby | mit | 8,966 | main | 487 | # 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 ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121018222852_add_index_to_browser_fingerprint.rb | Ruby | mit | 8,966 | main | 277 | # frozen_string_literal: true
class AddIndexToBrowserFingerprint < ActiveRecord::Migration
def change
add_index :events, :browser_guid
add_index :visits, :browser_guid
add_index :events, :browser_fingerprint
add_index :visits, :browser_fingerprint
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140707165710_add_charge_processor_id_to_purchase.rb | Ruby | mit | 8,966 | main | 335 | # frozen_string_literal: true
class AddChargeProcessorIdToPurchase < ActiveRecord::Migration
def up
add_column :purchases, :charge_processor_id, :string
Purchase.update_all({ charge_processor_id: "stripe" }, "stripe_transaction_id IS NOT NULL")
end
def down
remove_column :purchases, :charge_processo... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231205052856_add_canada_tax_rates_to_purchase_taxjar_infos.rb | Ruby | mit | 8,966 | main | 359 | # frozen_string_literal: true
class AddCanadaTaxRatesToPurchaseTaxjarInfos < ActiveRecord::Migration[7.0]
def change
change_table :purchase_taxjar_infos, bulk: true do |t|
t.decimal :gst_tax_rate, precision: 8, scale: 7
t.decimal :pst_tax_rate, precision: 8, scale: 7
t.decimal :qst_tax_rate, pr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120124192926_create_api_sessions.rb | Ruby | mit | 8,966 | main | 292 | # frozen_string_literal: true
class CreateApiSessions < ActiveRecord::Migration
def change
create_table :api_sessions do |t|
t.integer :user_id
t.string :token
t.timestamps
end
add_index :api_sessions, :user_id
add_index :api_sessions, :token
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240918134011_create_discover_search_suggestions.rb | Ruby | mit | 8,966 | main | 269 | # frozen_string_literal: true
class CreateDiscoverSearchSuggestions < ActiveRecord::Migration[7.1]
def change
create_table :discover_search_suggestions do |t|
t.belongs_to :discover_search
t.datetime :deleted_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191031114536_create_affiliate_partial_refund.rb | Ruby | mit | 8,966 | main | 826 | # frozen_string_literal: true
class CreateAffiliatePartialRefund < ActiveRecord::Migration
def change
create_table :affiliate_partial_refunds do |t|
t.integer :amount_cents, default: 0
t.integer :purchase_id, null: false
t.integer :total_credit_cents, default: 0
t.integer :affiliate_user_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151019000000_add_alive_at_charge_processor_at_to_merchant_account.rb | Ruby | mit | 8,966 | main | 204 | # frozen_string_literal: true
class AddAliveAtChargeProcessorAtToMerchantAccount < ActiveRecord::Migration
def change
add_column :merchant_accounts, :charge_processor_alive_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130419202455_add_preorder_id_to_credit_cards.rb | Ruby | mit | 8,966 | main | 208 | # frozen_string_literal: true
class AddPreorderIdToCreditCards < ActiveRecord::Migration
def change
add_column :credit_cards, :preorder_id, :integer
add_index :credit_cards, :preorder_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151014232700_add_user_id_and_deleted_at_to_zip_tax_rates.rb | Ruby | mit | 8,966 | main | 266 | # frozen_string_literal: true
class AddUserIdAndDeletedAtToZipTaxRates < ActiveRecord::Migration
def change
add_column :zip_tax_rates, :user_id, :integer
add_column :zip_tax_rates, :deleted_at, :datetime
add_index :zip_tax_rates, [:user_id]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120627225210_remove_attachments_table.rb | Ruby | mit | 8,966 | main | 505 | # frozen_string_literal: true
class RemoveAttachmentsTable < ActiveRecord::Migration
def up
drop_table :attachments
end
def down
create_table :attachments do |t|
t.string :blob_key
t.string :file_name
t.integer :date
t.string :unique_permalink
t.string :file_type
t.s... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120226203341_change_bitrate_to_integer.rb | Ruby | mit | 8,966 | main | 212 | # frozen_string_literal: true
class ChangeBitrateToInteger < ActiveRecord::Migration
def up
change_column :infos, :bitrate, :integer
end
def down
change_column :infos, :bitrate, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111201183301_disabled_at.rb | Ruby | mit | 8,966 | main | 226 | # frozen_string_literal: true
class DisabledAt < ActiveRecord::Migration
def up
add_column :links, :purchase_disabled_at, :datetime
end
def down
remove_column :links, :purchase_disabled_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111116194231_remove_assets.rb | Ruby | mit | 8,966 | main | 327 | # frozen_string_literal: true
class RemoveAssets < ActiveRecord::Migration
def up
drop_table :assets
end
def down
create_table :assets do |t|
t.string :blob_key
t.string :file_name
t.integer :date
t.string :unique_permalink
t.string :file_type
t.timestamps
end
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240319164216_add_token_and_token_expires_at_to_subscriptions.rb | Ruby | mit | 8,966 | main | 248 | # frozen_string_literal: true
class AddTokenAndTokenExpiresAtToSubscriptions < ActiveRecord::Migration[7.1]
def change
change_table :subscriptions, bulk: true do |t|
t.string :token
t.datetime :token_expires_at
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190613024033_add_missing_index_on_imported_customers.rb | Ruby | mit | 8,966 | main | 262 | # frozen_string_literal: true
class AddMissingIndexOnImportedCustomers < ActiveRecord::Migration
def up
add_index :imported_customers, [:link_id, :purchase_date]
end
def down
remove_index :imported_customers, [:link_id, :purchase_date]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120531054131_remove_card_id_and_cvc_check_from_failed_purchases.rb | Ruby | mit | 8,966 | main | 358 | # frozen_string_literal: true
class RemoveCardIdAndCvcCheckFromFailedPurchases < ActiveRecord::Migration
def up
remove_column :failed_purchases, :stripe_card_id
remove_column :failed_purchases, :cvc_check
end
def down
add_column :failed_purchases, :stripe_card_id, :string
add_column :failed_purc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231031174049_create_purchase_early_fraud_warnings.rb | Ruby | mit | 8,966 | main | 599 | # frozen_string_literal: true
class CreatePurchaseEarlyFraudWarnings < ActiveRecord::Migration[7.0]
def change
create_table :purchase_early_fraud_warnings do |t|
t.bigint :purchase_id, null: false
t.string :processor_id, null: false
t.bigint :dispute_id
t.bigint :refund_id
t.string ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120706001915_change_preview_url_to_text.rb | Ruby | mit | 8,966 | main | 215 | # frozen_string_literal: true
class ChangePreviewUrlToText < ActiveRecord::Migration
def up
change_column :links, :preview_url, :text
end
def down
change_column :links, :preview_url, :text
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200512043527_add_subscriptions_deactivated_at.rb | Ruby | mit | 8,966 | main | 367 | # frozen_string_literal: true
class AddSubscriptionsDeactivatedAt < ActiveRecord::Migration
def up
add_column :subscriptions, :deactivated_at, :datetime
add_index :subscriptions, :deactivated_at
add_index :subscriptions, :ended_at
end
def down
remove_column :subscriptions, :deactivated_at
re... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191119061033_remove_type_from_custom_domains.rb | Ruby | mit | 8,966 | main | 216 | # frozen_string_literal: true
class RemoveTypeFromCustomDomains < ActiveRecord::Migration
def up
remove_column :custom_domains, :type
end
def down
add_column :custom_domains, :type, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220608012107_remove_links_index_purchase_disabled_at.rb | Ruby | mit | 8,966 | main | 231 | # frozen_string_literal: true
class RemoveLinksIndexPurchaseDisabledAt < ActiveRecord::Migration[6.1]
def up
remove_index :links, :purchase_disabled_at
end
def down
add_index :links, :purchase_disabled_at
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190910183250_create_friendly_id_slugs.rb | Ruby | mit | 8,966 | main | 652 | # frozen_string_literal: true
class CreateFriendlyIdSlugs < ActiveRecord::Migration
def change
create_table :friendly_id_slugs do |t|
t.string :slug, null: false
t.integer :sluggable_id, null: false
t.string :sluggable_type, limit: 50
t.string :scope
t.datetime :c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150913230710_add_call_to_action_to_updates.rb | Ruby | mit | 8,966 | main | 259 | # frozen_string_literal: true
class AddCallToActionToUpdates < ActiveRecord::Migration
def change
add_column(:installments, :call_to_action_text, :string, limit: 2083)
add_column(:installments, :call_to_action_url, :string, limit: 2083)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130117015615_create_purchases_variants.rb | Ruby | mit | 8,966 | main | 219 | # frozen_string_literal: true
class CreatePurchasesVariants < ActiveRecord::Migration
def change
create_table :purchases_variants do |t|
t.integer :purchase_id
t.integer :variant_id
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150329165612_make_dropbox_url_longer.rb | Ruby | mit | 8,966 | main | 240 | # frozen_string_literal: true
class MakeDropboxUrlLonger < ActiveRecord::Migration
def change
change_column :dropbox_files, :dropbox_url, :string, limit: 2000
change_column :dropbox_files, :s3_url, :string, limit: 2000
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20251121152058_add_offer_codes_to_products_index.rb | Ruby | mit | 8,966 | main | 444 | # frozen_string_literal: true
class AddOfferCodesToProductsIndex < ActiveRecord::Migration[7.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
offer_codes: {
type: "text",
fields: {
code: {
typ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151016000000_add_deleted_at_charge_processor_at_to_merchant_account.rb | Ruby | mit | 8,966 | main | 208 | # frozen_string_literal: true
class AddDeletedAtChargeProcessorAtToMerchantAccount < ActiveRecord::Migration
def change
add_column :merchant_accounts, :charge_processor_deleted_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150723011703_add_source_to_followers.rb | Ruby | mit | 8,966 | main | 207 | # frozen_string_literal: true
class AddSourceToFollowers < ActiveRecord::Migration
def change
add_column :followers, :source, :string
add_column :followers, :source_product_id, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120817014544_remove_chargebacked_from_purchases.rb | Ruby | mit | 8,966 | main | 243 | # frozen_string_literal: true
class RemoveChargebackedFromPurchases < ActiveRecord::Migration
def up
remove_column :purchases, :chargebacked
end
def down
add_column :purchases, :chargebacked, :boolean, default: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211110051320_create_signup_events.rb | Ruby | mit | 8,966 | main | 1,826 | # frozen_string_literal: true
class CreateSignupEvents < ActiveRecord::Migration[6.1]
def change
create_table :signup_events, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
t.integer "visit_id"
t.string "ip_address", limit: 255
t.integer "user_id"
t.datetime "created_at"
t.d... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190911184143_create_installment_events.rb | Ruby | mit | 8,966 | main | 395 | # frozen_string_literal: true
class CreateInstallmentEvents < ActiveRecord::Migration
def up
create_table :installment_events do |t|
t.references :event, index: { unique: true }, foreign_key: { on_delete: :cascade }
t.references :installment, index: { unique: true }, foreign_key: { on_delete: :cascad... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220303121239_alter_consumption_events_to_utf8mb4.rb | Ruby | mit | 8,966 | main | 1,089 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120225190810_create_infos.rb | Ruby | mit | 8,966 | main | 333 | # frozen_string_literal: true
class CreateInfos < ActiveRecord::Migration
def change
create_table :infos do |t|
t.string :type
t.integer :size
t.integer :duration
t.integer :bitrate
t.integer :framerate
t.string :resolution
t.integer :pagelength
t.timestamps
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210618181618_remove_followers_cancelled_at.rb | Ruby | mit | 8,966 | main | 228 | # frozen_string_literal: true
class RemoveFollowersCancelledAt < ActiveRecord::Migration[6.1]
def up
remove_column :followers, :cancelled_at
end
def down
add_column :followers, :cancelled_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20171218105118_add_column_confirmed_at_to_followers.rb | Ruby | mit | 8,966 | main | 345 | # frozen_string_literal: true
class AddColumnConfirmedAtToFollowers < ActiveRecord::Migration
def change
add_column :followers, :confirmed_at, :datetime
reversible do |direction|
direction.up do
Follower.reset_column_information
Follower.alive.update_all(confirmed_at: Time.current)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140328203457_create_licenses.rb | Ruby | mit | 8,966 | main | 570 | # frozen_string_literal: true
class CreateLicenses < ActiveRecord::Migration
def change
create_table :licenses, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci" do |t|
t.integer :link_id
t.integer :purchase_id
t.string :serial
t.datetime :trial_expires_at
t.integer :use... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20221107074039_create_offer_codes_products.rb | Ruby | mit | 8,966 | main | 249 | # frozen_string_literal: true
class CreateOfferCodesProducts < ActiveRecord::Migration[7.0]
def change
create_table :offer_codes_products do |t|
t.references :offer_code
t.references :product
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191201174402_add_rental_expired_to_purchases.rb | Ruby | mit | 8,966 | main | 269 | # frozen_string_literal: true
class AddRentalExpiredToPurchases < ActiveRecord::Migration
def up
add_column :purchases, :rental_expired, :boolean
add_index :purchases, :rental_expired
end
def down
remove_column :purchases, :rental_expired
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230509105457_add_title_and_position_to_rich_contents.rb | Ruby | mit | 8,966 | main | 257 | # frozen_string_literal: true
class AddTitleAndPositionToRichContents < ActiveRecord::Migration[7.0]
def change
change_table :rich_contents, bulk: true do |t|
t.string :title
t.integer :position, default: 0, null: false
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210609090425_drop_blocked_ip.rb | Ruby | mit | 8,966 | main | 419 | # frozen_string_literal: true
class DropBlockedIp < ActiveRecord::Migration[6.1]
def up
drop_table :blocked_ips
end
def down
create_table "blocked_ips", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.string "ip_address"
t.datetime "created_at"
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20131209172904_create_comments.rb | Ruby | mit | 8,966 | main | 407 | # frozen_string_literal: true
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.belongs_to :commentable, polymorphic: true
t.integer :author_id
t.string :author_name
t.text :content
t.string :comment_type
t.text :json_data
t.times... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20141218034906_add_workflow_and_index_to_installments.rb | Ruby | mit | 8,966 | main | 215 | # frozen_string_literal: true
class AddWorkflowAndIndexToInstallments < ActiveRecord::Migration
def change
add_column :installments, :workflow_id, :integer
add_index :installments, :workflow_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130731034033_index_url_redirects_on_subscription_id_and_installment_id.rb | Ruby | mit | 8,966 | main | 229 | # frozen_string_literal: true
class IndexUrlRedirectsOnSubscriptionIdAndInstallmentId < ActiveRecord::Migration
def change
add_index :url_redirects, :installment_id
add_index :url_redirects, :subscription_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151020214443_make_product_tags_not_unique.rb | Ruby | mit | 8,966 | main | 206 | # frozen_string_literal: true
class MakeProductTagsNotUnique < ActiveRecord::Migration
def change
remove_index :product_tags, [:link_id, :tag]
add_index :product_tags, [:link_id, :tag]
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.