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/20240206105114_create_carts.rb | Ruby | mit | 8,966 | main | 485 | # frozen_string_literal: true
class CreateCarts < ActiveRecord::Migration[7.0]
def change
create_table :carts do |t|
t.references :user
t.references :order, index: false
t.string :email, null: false, index: true
t.text :return_url, size: :long
t.json :discount_codes, size: :long
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130628203022_create_gifts.rb | Ruby | mit | 8,966 | main | 360 | # frozen_string_literal: true
class CreateGifts < ActiveRecord::Migration
def change
create_table :gifts do |t|
t.integer :giftee_purchase_id
t.integer :gifter_purchase_id
t.integer :link_id
t.string :state
t.string :gift_note
t.string :giftee_email
t.string :gifter_emai... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120605012619_remove_number_of_paid_download_from_links.rb | Ruby | mit | 8,966 | main | 247 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120501233604_migrate_preview_images_on_links.rb | Ruby | mit | 8,966 | main | 3,449 | # frozen_string_literal: true
class MigratePreviewImagesOnLinks < ActiveRecord::Migration
def up
migrate_preview_images
end
def down
# the rollback has no effect!
end
private
# Migrate all the preview images that were generated on Amazon S3 into the
# proper size and format 300x300 PNG an... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120305024409_change_description_to_text.rb | Ruby | mit | 8,966 | main | 218 | # frozen_string_literal: true
class ChangeDescriptionToText < ActiveRecord::Migration
def up
change_column :links, :description, :text
end
def down
change_column :links, :description, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150416000000_create_tos_agreements.rb | Ruby | mit | 8,966 | main | 342 | # frozen_string_literal: true
class CreateTosAgreements < ActiveRecord::Migration
def change
create_table :tos_agreements, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :user
t.string :ip
t.column :created_at, :datetime
end
add_index :tos_agreement... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151007212137_create_recommended_purchase_info.rb | Ruby | mit | 8,966 | main | 603 | # frozen_string_literal: true
class CreateRecommendedPurchaseInfo < ActiveRecord::Migration
def change
create_table :recommended_purchase_infos, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.timestamps
t.references :purchase
t.integer :recommended_link_id
t.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130529185015_add_created_at_index_to_oauth_access_grants.rb | Ruby | mit | 8,966 | main | 246 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130218211025_create_offer_codes.rb | Ruby | mit | 8,966 | main | 309 | # frozen_string_literal: true
class CreateOfferCodes < ActiveRecord::Migration
def change
create_table :offer_codes do |t|
t.references :link
t.string :name
t.integer :amount_cents
t.integer :max_purchase_count
t.datetime :deleted_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130109001636_create_subscriptions.rb | Ruby | mit | 8,966 | main | 295 | # frozen_string_literal: true
class CreateSubscriptions < ActiveRecord::Migration
def change
create_table :subscriptions do |t|
t.integer :link_id
t.integer :user_id
t.datetime :cancelled_at
t.datetime :failed_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140624205931_create_subtitle_files.rb | Ruby | mit | 8,966 | main | 219 | # frozen_string_literal: true
class CreateSubtitleFiles < ActiveRecord::Migration
def change
create_table :subtitle_files do |t|
t.string :url
t.string :language
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200513124526_fix_json_data_in_user_compliance_info.rb | Ruby | mit | 8,966 | main | 394 | # frozen_string_literal: true
class FixJsonDataInUserComplianceInfo < ActiveRecord::Migration
def up
UserComplianceInfo.where(json_data: nil).find_in_batches(batch_size: 5000) do |relation|
print "."
UserComplianceInfo.where(id: relation.map(&:id)).update_all(json_data: {})
sleep(0.01)
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20180627111725_add_more_indexes_in_purchases.rb | Ruby | mit | 8,966 | main | 279 | # frozen_string_literal: true
class AddMoreIndexesInPurchases < ActiveRecord::Migration
def change
add_index :purchases, :purchase_refund_balance_id
add_index :purchases, :purchase_chargeback_balance_id
add_index :purchases, :purchase_success_balance_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120531180320_add_index_to_failed_purchases.rb | Ruby | mit | 8,966 | main | 391 | # frozen_string_literal: true
class AddIndexToFailedPurchases < ActiveRecord::Migration
def change
# Composite Key to enforce uniqueness and speed up searches.
add_index :failed_purchases, [:link_id, :stripe_fingerprint], unique: true, name: "by_link_and_stripe_fingerprint"
add_index :failed_purchases, :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120827162606_remove_email_required_from_users.rb | Ruby | mit | 8,966 | main | 238 | # frozen_string_literal: true
class RemoveEmailRequiredFromUsers < ActiveRecord::Migration
def up
change_column :users, :email, :string, null: true
end
def down
change_column :users, :email, :string, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150316205500_add_quantity_and_merchant_id_to_purchases.rb | Ruby | mit | 8,966 | main | 252 | # frozen_string_literal: true
class AddQuantityAndMerchantIdToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :quantity, :integer, default: 1, null: false
add_column :purchases, :merchant_account_id, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230519055629_create_staff_picked_products.rb | Ruby | mit | 8,966 | main | 286 | # frozen_string_literal: true
class CreateStaffPickedProducts < ActiveRecord::Migration[7.0]
def change
create_table :staff_picked_products do |t|
t.references :product, index: { unique: true }, null: false
t.datetime :deleted_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231231000023_add_json_data_to_seller_profile_sections.rb | Ruby | mit | 8,966 | main | 442 | # frozen_string_literal: true
class AddJsonDataToSellerProfileSections < ActiveRecord::Migration[7.0]
def change
change_table :seller_profile_sections, bulk: true do |t|
t.column :json_data, :json
t.column :type, :string, null: false, default: "SellerProfileProductsSection"
t.change_null :shown... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20201010080412_add_refunded_amount_cents_to_purchase_index.rb | Ruby | mit | 8,966 | main | 377 | # frozen_string_literal: true
class AddRefundedAmountCentsToPurchaseIndex < ActiveRecord::Migration[6.0]
def up
Elasticsearch::Model.client.indices.put_mapping(
index: "purchases_v2",
type: "purchase",
body: {
purchase: {
properties: {
amount_refunded_cents: { type... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150623223829_create_affiliates_links.rb | Ruby | mit | 8,966 | main | 323 | # frozen_string_literal: true
class CreateAffiliatesLinks < ActiveRecord::Migration
def change
create_table :affiliates_links do |t|
t.references :affiliate
t.references :link
t.timestamps
end
add_index :affiliates_links, :affiliate_id
add_index :affiliates_links, :link_id
end
e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150909000000_create_disputes.rb | Ruby | mit | 8,966 | main | 626 | # frozen_string_literal: true
class CreateDisputes < ActiveRecord::Migration
def change
create_table :disputes, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :purchase
t.string :charge_processor_id
t.string :charge_processor_dispute_id
t.string :reason
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140619000635_change_twitter_ids_to_strings.rb | Ruby | mit | 8,966 | main | 291 | # frozen_string_literal: true
class ChangeTwitterIdsToStrings < ActiveRecord::Migration
def up
change_column :twitter_merchants, :twitter_assigned_merchant_id, :string
end
def down
change_column :twitter_merchants, :twitter_assigned_merchant_id, :integer, limit: 8
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210622061943_remove_unused_columns_from_transcoded_videos.rb | Ruby | mit | 8,966 | main | 652 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151208202555_create_messages.rb | Ruby | mit | 8,966 | main | 577 | # frozen_string_literal: true
class CreateMessages < ActiveRecord::Migration
def change
create_table :messages, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.belongs_to :parent
t.belongs_to :purchase
t.integer :flags, default: 0, null: false
t.string :state... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120927080346_change_status_to_state_in_payments.rb | Ruby | mit | 8,966 | main | 220 | # frozen_string_literal: true
class ChangeStatusToStateInPayments < ActiveRecord::Migration
def up
rename_column :payments, :status, :state
end
def down
rename_column :payments, :state, :status
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240617133026_create_yearly_stats.rb | Ruby | mit | 8,966 | main | 279 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130419202454_create_preorder_links.rb | Ruby | mit | 8,966 | main | 374 | # frozen_string_literal: true
class CreatePreorderLinks < ActiveRecord::Migration
def change
create_table :preorder_links do |t|
t.references :link
t.string :state
t.datetime :release_at
t.string :url
t.string :attachment_guid
t.string :custom_filetype
t.timestamps
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210306103539_reindex_dev_es_records.rb | Ruby | mit | 8,966 | main | 620 | # frozen_string_literal: true
class ReindexDevEsRecords < ActiveRecord::Migration[6.1]
# For developer convenience, we reindex everything since we're now using a new ES server, with no data.
def up
return if Rails.env.production?
if EsClient.info["version"]["number"].starts_with?("6.")
error_messag... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230803151640_create_backtax_collections.rb | Ruby | mit | 8,966 | main | 431 | # frozen_string_literal: true
class CreateBacktaxCollections < ActiveRecord::Migration[7.0]
def change
create_table :backtax_collections do |t|
t.references :user, index: true, null: false
t.references :backtax_agreement, index: true, null: false
t.integer "amount_cents"
t.integer "amount... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150709201644_create_custom_domains.rb | Ruby | mit | 8,966 | main | 400 | # frozen_string_literal: true
class CreateCustomDomains < ActiveRecord::Migration
def change
create_table :custom_domains, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :user
t.string :domain
t.string :type
t.timestamps
end
add_index :custom_d... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121018222048_add_browser_plugins_to_events_and_visits.rb | Ruby | mit | 8,966 | main | 229 | # frozen_string_literal: true
class AddBrowserPluginsToEventsAndVisits < ActiveRecord::Migration
def up
add_column :events, :browser_plugins, :string
end
def down
remove_column :events, :browser_plugins
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191105224621_add_index_on_users_for_twitter_o_auth_token.rb | Ruby | mit | 8,966 | main | 225 | # frozen_string_literal: true
class AddIndexOnUsersForTwitterOAuthToken < ActiveRecord::Migration
def up
add_index :users, :twitter_oauth_token
end
def down
remove_index :users, :twitter_oauth_token
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140311222528_change_size_to_bigint_in_product_files.rb | Ruby | mit | 8,966 | main | 228 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210811141027_create_integration.rb | Ruby | mit | 8,966 | main | 282 | # frozen_string_literal: true
class CreateIntegration < ActiveRecord::Migration[6.1]
def change
create_table :integrations do |t|
t.string :api_key, null: false
t.string :integration_type, null: false
t.text :json_data
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111109220139_links_missing_attr.rb | Ruby | mit | 8,966 | main | 379 | # frozen_string_literal: true
class LinksMissingAttr < ActiveRecord::Migration
def up
add_column :links, :owner, :string
add_column :links, :length_of_exclusivity, :integer
add_column :links, :create_date, :integer
end
def down
remove_column :links, :owner
remove_column :links, :length_of_ex... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210413120934_change_transcoded_videos_original_video_key_limit.rb | Ruby | mit | 8,966 | main | 296 | # frozen_string_literal: true
class ChangeTranscodedVideosOriginalVideoKeyLimit < ActiveRecord::Migration[6.1]
def up
change_column :transcoded_videos, :original_video_key, :string, limit: 1024
end
def down
change_column :transcoded_videos, :original_video_key, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20131209234409_index_offer_codes_on_link_id.rb | Ruby | mit | 8,966 | main | 201 | # frozen_string_literal: true
class IndexOfferCodesOnLinkId < ActiveRecord::Migration
def up
add_index :offer_codes, :link_id
end
def down
remove_index :offer_codes, :link_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240528200957_create_purchase_custom_field_files.rb | Ruby | mit | 8,966 | main | 278 | # frozen_string_literal: true
class CreatePurchaseCustomFieldFiles < ActiveRecord::Migration[7.1]
def change
create_table :purchase_custom_field_files do |t|
t.string :url
t.references :purchase_custom_field, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20170511111723_populate_link_ids_to_refund.rb | Ruby | mit | 8,966 | main | 236 | # frozen_string_literal: true
class PopulateLinkIdsToRefund < ActiveRecord::Migration
def change
Refund.find_each do |refund|
refund.link_id = refund.purchase.link_id if refund.purchase
refund.save!
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250328062708_create_collaborator_invitations.rb | Ruby | mit | 8,966 | main | 290 | # frozen_string_literal: true
class CreateCollaboratorInvitations < ActiveRecord::Migration[7.1]
def change
create_table :collaborator_invitations do |t|
t.belongs_to :collaborator, null: false, foreign_key: false, index: { unique: true }
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191006031318_add_installments_events_cache_count.rb | Ruby | mit | 8,966 | main | 257 | # frozen_string_literal: true
class AddInstallmentsEventsCacheCount < ActiveRecord::Migration
def up
add_column :installments, :installment_events_count, :integer
end
def down
remove_column :installments, :installment_events_count
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231120215114_add_resolution_message_to_purchase_early_fraud_warnings.rb | Ruby | mit | 8,966 | main | 216 | # frozen_string_literal: true
class AddResolutionMessageToPurchaseEarlyFraudWarnings < ActiveRecord::Migration[7.0]
def change
add_column :purchase_early_fraud_warnings, :resolution_message, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20170125203547_create_oauth_authorizations.rb | Ruby | mit | 8,966 | main | 401 | # frozen_string_literal: true
class CreateOauthAuthorizations < ActiveRecord::Migration
def change
create_table :oauth_authorizations do |t|
t.integer :user_id, index: true
t.integer :provider
t.string :access_token
t.string :refresh_token
t.datetime :expires_at
t.string :prov... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150814212030_add_consumed_at_and_media_location_to_consumption_events.rb | Ruby | mit | 8,966 | main | 257 | # frozen_string_literal: true
class AddConsumedAtAndMediaLocationToConsumptionEvents < ActiveRecord::Migration
def change
add_column :consumption_events, :consumed_at, :datetime
add_column :consumption_events, :media_location, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20241021212931_remove_null_constraint_from_selected_product_id_upsell_purchases.rb | Ruby | mit | 8,966 | main | 217 | # frozen_string_literal: true
class RemoveNullConstraintFromSelectedProductIdUpsellPurchases < ActiveRecord::Migration[7.1]
def change
change_column_null :upsell_purchases, :selected_product_id, true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250402175205_create_product_review_videos.rb | Ruby | mit | 8,966 | main | 361 | # frozen_string_literal: true
class CreateProductReviewVideos < ActiveRecord::Migration[7.1]
def change
create_table :product_review_videos do |t|
t.references :product_review, null: false, foreign_key: false
t.string :approval_status, default: "pending_review"
t.datetime :deleted_at, index: tr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190724010533_add_gifter_email_index_on_gifts.rb | Ruby | mit | 8,966 | main | 202 | # frozen_string_literal: true
class AddGifterEmailIndexOnGifts < ActiveRecord::Migration
def up
add_index :gifts, :gifter_email
end
def down
remove_index :gifts, :gifter_email
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250217233404_add_deleted_at_to_installment_plans.rb | Ruby | mit | 8,966 | main | 364 | # frozen_string_literal: true
class AddDeletedAtToInstallmentPlans < ActiveRecord::Migration[7.1]
def change
change_table :product_installment_plans, bulk: true do |t|
t.datetime :deleted_at, default: nil, null: true
t.index :deleted_at
end
add_belongs_to :payment_options, :product_installme... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250425212934_add_back_admin_action_call_infos.rb | Ruby | mit | 8,966 | main | 523 | # frozen_string_literal: true
class AddBackAdminActionCallInfos < ActiveRecord::Migration[7.1]
def change
create_table :admin_action_call_infos, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.string :controller_name, null: false
t.string :action_name, null: false
t.integer :call_c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240725140931_add_fee_cents_to_affiliate_credits.rb | Ruby | mit | 8,966 | main | 201 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250225094113_create_community_notification_settings.rb | Ruby | mit | 8,966 | main | 387 | # frozen_string_literal: true
class CreateCommunityNotificationSettings < ActiveRecord::Migration[7.1]
def change
create_table :community_notification_settings do |t|
t.references :user, null: false
t.references :seller, null: false
t.string :recap_frequency, index: true
t.timestamps
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210503141445_remove_link_columns.rb | Ruby | mit | 8,966 | main | 925 | # frozen_string_literal: true
class RemoveLinkColumns < ActiveRecord::Migration[6.1]
def up
change_table :links do |t|
t.remove :territory_restriction
t.remove :preview_automatically_generated
t.remove :bad_email_counter
t.remove :preview_processed
t.remove :webhook_fail_count
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230912033854_add_product_to_custom_domains.rb | Ruby | mit | 8,966 | main | 218 | # frozen_string_literal: true
class AddProductToCustomDomains < ActiveRecord::Migration[7.0]
def change
change_table :custom_domains, bulk: true do |t|
t.references :product, index: true
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20221121182709_add_email_domain_to_purchases_index.rb | Ruby | mit | 8,966 | main | 339 | # frozen_string_literal: true
class AddEmailDomainToPurchasesIndex < ActiveRecord::Migration[7.0]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
email_domain: { type: "text", analyzer: "email", search_analyzer: "search_email" }
}
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130730185223_add_index_on_oauth_application_name.rb | Ruby | mit | 8,966 | main | 230 | # frozen_string_literal: true
class AddIndexOnOauthApplicationName < ActiveRecord::Migration
def up
add_index :oauth_applications, :name, unique: true
end
def down
remove_index :oauth_applications, :name
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231016051957_drop_json_data_from_product_files_archive.rb | Ruby | mit | 8,966 | main | 203 | # frozen_string_literal: true
class DropJsonDataFromProductFilesArchive < ActiveRecord::Migration[7.0]
def change
remove_column :product_files_archives, :json_data, :text, size: :medium
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20181009184808_create_new_categories.rb | Ruby | mit | 8,966 | main | 475 | # frozen_string_literal: true
class CreateNewCategories < ActiveRecord::Migration
CATEGORY_NAMES = %w(comics drawing animation audio games photography comedy crafts food design dance sports)
def up
CATEGORY_NAMES.each do |category_name|
category = Category.new
category.name = category_name
c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230506201836_add_validity_columns_to_offer_codes.rb | Ruby | mit | 8,966 | main | 235 | # frozen_string_literal: true
class AddValidityColumnsToOfferCodes < ActiveRecord::Migration[7.0]
def change
change_table :offer_codes, bulk: true do |t|
t.datetime :valid_at
t.datetime :expires_at
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111207025721_add_attachment_meta.rb | Ruby | mit | 8,966 | main | 208 | # frozen_string_literal: true
class AddAttachmentMeta < ActiveRecord::Migration
def up
add_column :attachments, :file_meta, :text
end
def down
remove_column :attachments, :file_meta
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150203184911_create_dropbox_files.rb | Ruby | mit | 8,966 | main | 536 | # frozen_string_literal: true
class CreateDropboxFiles < ActiveRecord::Migration
def change
create_table :dropbox_files do |t|
t.string :state
t.string :dropbox_url
t.datetime :expires_at
t.datetime :deleted_at
t.integer :user_id
t.integer :product_file_id
t.integer :lin... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210921040636_add_purchase_id_to_comments.rb | Ruby | mit | 8,966 | main | 236 | # frozen_string_literal: true
class AddPurchaseIdToComments < ActiveRecord::Migration[6.1]
def change
change_table :comments, bulk: true do |t|
t.bigint :purchase_id, null: true
t.index :purchase_id
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240615052751_add_total_usd_cents_to_product_cached_value.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
class AddTotalUsdCentsToProductCachedValue < ActiveRecord::Migration[7.1]
def change
add_column :product_cached_values, :total_usd_cents, :bigint, default: 0
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230404182723_remove_link_view_events.rb | Ruby | mit | 8,966 | main | 1,995 | # frozen_string_literal: true
class RemoveLinkViewEvents < ActiveRecord::Migration[7.0]
def up
drop_table :link_view_events
end
def down
create_table "link_view_events", charset: "latin1" do |t|
t.integer "visit_id"
t.string "ip_address"
t.string "event_name"
t.integer "user_id"
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240626150102_create_commission_files.rb | Ruby | mit | 8,966 | main | 260 | # frozen_string_literal: true
class CreateCommissionFiles < ActiveRecord::Migration[7.1]
def change
create_table :commission_files do |t|
t.string :url, limit: 1024
t.references :commission, null: false
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20260316000000_create_totp_credentials.rb | Ruby | mit | 8,966 | main | 391 | # frozen_string_literal: true
class CreateTotpCredentials < ActiveRecord::Migration[7.1]
def change
create_table :totp_credentials do |t|
t.references :user, null: false, index: { unique: true }
t.string :otp_secret, null: false
t.datetime :confirmed_at
t.text :recovery_codes
t.date... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111109011928_create_links.rb | Ruby | mit | 8,966 | main | 500 | # frozen_string_literal: true
class CreateLinks < ActiveRecord::Migration
def change
create_table :links do |t|
t.integer :user_id
t.string :name
t.string :unique_permalink
t.string :url
t.string :preview_url
t.string :description
t.float :price
t.integer :number_o... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150519180244_add_imported_customer_id_to_licenses.rb | Ruby | mit | 8,966 | main | 223 | # frozen_string_literal: true
class AddImportedCustomerIdToLicenses < ActiveRecord::Migration
def change
add_column :licenses, :imported_customer_id, :integer
add_index :licenses, :imported_customer_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240222233850_create_processor_payment_intents.rb | Ruby | mit | 8,966 | main | 317 | # frozen_string_literal: true
class CreateProcessorPaymentIntents < ActiveRecord::Migration[7.1]
def change
create_table :processor_payment_intents do |t|
t.bigint :purchase_id, null: false, index: { unique: true }
t.string :intent_id, null: false, index: true
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210811155201_create_product_integration.rb | Ruby | mit | 8,966 | main | 406 | # frozen_string_literal: true
class CreateProductIntegration < ActiveRecord::Migration[6.1]
def change
create_table :product_integrations do |t|
t.bigint :product_id, null: false
t.bigint :integration_id, null: false
t.datetime :deleted_at
t.timestamps
end
add_index :product_int... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200721210221_record_tiered_pricing_migration.rb | Ruby | mit | 8,966 | main | 569 | # frozen_string_literal: true
class RecordTieredPricingMigration < ActiveRecord::Migration[5.1]
# TODO(helen): remove these columns when confident that tiered pricing data
# migration was successful (see https://github.com/gumroad/web/pull/13830)
# Also see note in `Price` model re. `.alive` and `#alive?` method... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151219024411_create_email_info.rb | Ruby | mit | 8,966 | main | 602 | # frozen_string_literal: true
class CreateEmailInfo < ActiveRecord::Migration
def change
create_table :email_infos, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci" do |t|
t.references :user
t.references :purchase
t.references :installment
t.string :type
t.stri... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130618031049_add_tos_violation_reason_to_users.rb | Ruby | mit | 8,966 | main | 231 | # frozen_string_literal: true
class AddTosViolationReasonToUsers < ActiveRecord::Migration
def up
add_column :users, :tos_violation_reason, :string
end
def down
remove_column :users, :tos_violation_reason
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111109221929_purchase_attr.rb | Ruby | mit | 8,966 | main | 517 | # frozen_string_literal: true
class PurchaseAttr < ActiveRecord::Migration
def up
add_column :users, :name, :string
add_column :users, :payment_address, :string
add_column :users, :create_date, :integer
add_column :users, :balance, :float
add_column :users, :reset_hash, :string
end
def down
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130410034200_create_compliance_entities.rb | Ruby | mit | 8,966 | main | 540 | # frozen_string_literal: true
class CreateComplianceEntities < ActiveRecord::Migration
def change
create_table :compliance_entities do |t|
t.string :source_list
t.integer :entity_number
t.string :sdn_type
t.string :programs
t.string :name
t.string :title
t.string :addres... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200226180434_create_large_sellers.rb | Ruby | mit | 8,966 | main | 404 | # frozen_string_literal: true
class CreateLargeSellers < ActiveRecord::Migration
def change
create_table :large_sellers do |t|
t.references :user, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
t.integer :sales_count, null: false, default: 0
t.datetime :created_at, n... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190528172432_add_megaphone_states_datetimes.rb | Ruby | mit | 8,966 | main | 228 | # frozen_string_literal: true
class AddMegaphoneStatesDatetimes < ActiveRecord::Migration
def change
add_column :megaphone_states, :created_at, :datetime
add_column :megaphone_states, :updated_at, :datetime
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210924172723_remove_code_columns_from_links.rb | Ruby | mit | 8,966 | main | 774 | # frozen_string_literal: true
class RemoveCodeColumnsFromLinks < ActiveRecord::Migration[6.1]
def up
change_table :links, bulk: true do |t|
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :user_id, :bigint
t.change :flags, :bigint, default: 0, null: false
t... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130209224715_add_parent_id_to_purchases.rb | Ruby | mit | 8,966 | main | 226 | # frozen_string_literal: true
class AddParentIdToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :parent_id, :integer
add_column :purchases, :flags, :integer, default: 0, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230504184554_remove_is_business_publicly_traded_from_user_compliance_info.rb | Ruby | mit | 8,966 | main | 224 | # frozen_string_literal: true
class RemoveIsBusinessPubliclyTradedFromUserComplianceInfo < ActiveRecord::Migration[7.0]
def change
remove_column :user_compliance_info, :is_business_publicly_traded, :boolean
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250103130628_create_utm_link_visits.rb | Ruby | mit | 8,966 | main | 464 | # frozen_string_literal: true
class CreateUtmLinkVisits < ActiveRecord::Migration[7.1]
def change
create_table :utm_link_visits do |t|
t.references :utm_link, null: false
t.references :user
t.string :referrer
t.string :ip_address, null: false
t.string :user_agent
t.string :bro... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20181009173358_update_category_names.rb | Ruby | mit | 8,966 | main | 392 | # frozen_string_literal: true
class UpdateCategoryNames < ActiveRecord::Migration
def up
Category.where(name: "publishing").update_all(name: "writing")
Category.where(name: "physical").update_all(name: "merchandise")
end
def down
Category.where(name: "merchandise").update_all(name: "physical")
C... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231002214315_remove_profile_products_settings_from_user.rb | Ruby | mit | 8,966 | main | 988 | # frozen_string_literal: true
class RemoveProfileProductsSettingsFromUser < ActiveRecord::Migration[7.0]
def up
change_table :users, bulk: true do |t|
t.remove :custom_css
t.remove :profile_file_name
t.remove :profile_content_type
t.remove :profile_file_size
t.remove :profile_update... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230317210227_create_custom_fields.rb | Ruby | mit | 8,966 | main | 509 | # frozen_string_literal: true
class CreateCustomFields < ActiveRecord::Migration[7.0]
def change
create_table :custom_fields do |t|
t.string :field_type
t.string :name
t.boolean :required, default: false
t.boolean :global, default: false
t.timestamps
t.references :seller, null... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250211173413_increase_utm_link_param_char_limits.rb | Ruby | mit | 8,966 | main | 1,461 | # frozen_string_literal: true
class IncreaseUtmLinkParamCharLimits < ActiveRecord::Migration[7.1]
def up
change_table :utm_links, bulk: true do |t|
t.remove_index name: "index_utm_links_on_utm_fields_and_target_resource"
t.change :utm_campaign, :string, limit: 200
t.change :utm_medium, :string... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115041415_remove_browser_fingerprint_index_from_events.rb | Ruby | mit | 8,966 | main | 235 | # frozen_string_literal: true
class RemoveBrowserFingerprintIndexFromEvents < ActiveRecord::Migration
def up
remove_index "events", "browser_fingerprint"
end
def down
add_index "events", "browser_fingerprint"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230622180003_add_duration_in_months_to_offer_codes.rb | Ruby | mit | 8,966 | main | 216 | # frozen_string_literal: true
class AddDurationInMonthsToOfferCodes < ActiveRecord::Migration[7.0]
def change
change_table :offer_codes, bulk: true do |t|
t.integer :duration_in_months
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190601144310_back_fill_refunds.rb | Ruby | mit | 8,966 | main | 278 | # frozen_string_literal: true
class BackFillRefunds < ActiveRecord::Migration
def up
change_column_default :refunds, :status, "succeeded"
Refund.find_each do |refund|
refund.status = "succeeded"
refund.save!
end
end
def down
# NOOP
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150804000002_add_index_email_followed_id_to_follower.rb | Ruby | mit | 8,966 | main | 422 | # frozen_string_literal: true
class AddIndexEmailFollowedIdToFollower < ActiveRecord::Migration
def up
remove_index :followers, name: "index_follows_on_email_and_followed_id"
add_index :followers, [:email, :followed_id], unique: true
end
def down
remove_index :followers, [:email, :followed_id]
a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115042531_remove_event_name_index_on_events.rb | Ruby | mit | 8,966 | main | 206 | # frozen_string_literal: true
class RemoveEventNameIndexOnEvents < ActiveRecord::Migration
def up
remove_index "events", "event_type"
end
def down
add_index "events", "event_type"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250213174713_create_product_installment_plans.rb | Ruby | mit | 8,966 | main | 331 | # frozen_string_literal: true
class CreateProductInstallmentPlans < ActiveRecord::Migration[7.1]
def change
create_table :product_installment_plans do |t|
t.references :link, null: false
t.integer :number_of_installments, null: false
t.string :recurrence, null: false
t.timestamps
end... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230502015838_add_better_url_redirects_post_indexes.rb | Ruby | mit | 8,966 | main | 371 | # frozen_string_literal: true
class AddBetterUrlRedirectsPostIndexes < ActiveRecord::Migration[7.0]
def change
change_table :url_redirects, bulk: true do |t|
t.index [:installment_id, :purchase_id]
t.index [:installment_id, :subscription_id]
t.index [:installment_id, :imported_customer_id]
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210605062909_drop_audience_landing_page_view_events.rb | Ruby | mit | 8,966 | main | 1,421 | # frozen_string_literal: true
class DropAudienceLandingPageViewEvents < ActiveRecord::Migration[6.1]
def up
drop_table :audience_landing_page_view_events
end
def down
create_table "audience_landing_page_view_events", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.str... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130117014416_create_variants.rb | Ruby | mit | 8,966 | main | 289 | # frozen_string_literal: true
class CreateVariants < ActiveRecord::Migration
def change
create_table :variants do |t|
t.integer :variant_category_id
t.integer :price_difference_cents
t.string :name
end
add_index :variants, :variant_category_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190127012512_add_deleted_from_cdn_index_indexes.rb | Ruby | mit | 8,966 | main | 282 | # frozen_string_literal: true
class AddDeletedFromCdnIndexIndexes < ActiveRecord::Migration
def change
add_index :product_files, :deleted_from_cdn_at
add_index :product_files_archives, :deleted_from_cdn_at
add_index :transcoded_videos, :deleted_from_cdn_at
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20131023021154_create_affiliate_credits.rb | Ruby | mit | 8,966 | main | 761 | # frozen_string_literal: true
class CreateAffiliateCredits < ActiveRecord::Migration
def change
create_table :affiliate_credits do |t|
t.references :oauth_application
t.integer :basis_points
t.integer :amount_cents
t.integer :oauth_application_owner_id
t.integer :seller_id
t.i... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240616210250_remove_sales_stats_tables.rb | Ruby | mit | 8,966 | main | 22,954 | # frozen_string_literal: true
class RemoveSalesStatsTables < ActiveRecord::Migration[7.1]
def up
drop_table :product_daily_sales_stats, if_exists: true
drop_table :product_sales_stats, if_exists: true
drop_table :seller_daily_sales_stats, if_exists: true
drop_table :seller_sales_stats, if_exists: tru... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111209003710_add_email_required_on_link.rb | Ruby | mit | 8,966 | main | 311 | # frozen_string_literal: true
class AddEmailRequiredOnLink < ActiveRecord::Migration
def up
add_column :links, :email_required, :boolean, default: 0
add_column :purchases, :email, :text
end
def down
remove_column :links, :email_required
remove_column :purchases, :email, :text
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230530230438_add_google_uid_to_users.rb | Ruby | mit | 8,966 | main | 300 | # frozen_string_literal: true
class AddGoogleUidToUsers < ActiveRecord::Migration[7.0]
def up
change_table :users, bulk: true do |t|
t.string :google_uid, index: true
end
end
def down
remove_index :users, :google_uid
remove_column :users, :google_uid, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120112220152_redirect_has_purchase.rb | Ruby | mit | 8,966 | main | 314 | # frozen_string_literal: true
class RedirectHasPurchase < ActiveRecord::Migration
def up
add_column :url_redirects, :purchase_id, :integer
remove_column :url_redirects, :link_id
end
def down
remove_column :url_redirects, :purchase_id
add_column :url_redirects, :link_id, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121129184816_create_bins.rb | Ruby | mit | 8,966 | main | 457 | # frozen_string_literal: true
class CreateBins < ActiveRecord::Migration
def change
create_table :bins do |t|
t.string :card_bin
t.string :issuing_bank
t.string :card_type
t.string :card_level
t.string :iso_country_name
t.string :iso_country_a2
t.string :iso_country_a3
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.