repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120517230515_add_is_mobile_to_purchases.rb | db/migrate/20120517230515_add_is_mobile_to_purchases.rb | # frozen_string_literal: true
class AddIsMobileToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :is_mobile, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230711202046_add_index_on_users_support_email.rb | db/migrate/20230711202046_add_index_on_users_support_email.rb | # frozen_string_literal: true
class AddIndexOnUsersSupportEmail < ActiveRecord::Migration[7.0]
def change
add_index :users, :support_email
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240319164216_add_token_and_token_expires_at_to_subscriptions.rb | db/migrate/20240319164216_add_token_and_token_expires_at_to_subscriptions.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150115000000_add_relationship_to_user.rb | db/migrate/20150115000000_add_relationship_to_user.rb | # frozen_string_literal: true
class AddRelationshipToUser < ActiveRecord::Migration
def change
add_column :users, :relationship, :integer, default: 0
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130419202454_create_preorder_links.rb | db/migrate/20130419202454_create_preorder_links.rb | # 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
end
add_index :preorder_links, :link_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120531054131_remove_card_id_and_cvc_check_from_failed_purchases.rb | db/migrate/20120531054131_remove_card_id_and_cvc_check_from_failed_purchases.rb | # 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_purchases, :cvc_check, :boolean
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111213003155_price_cents.rb | db/migrate/20111213003155_price_cents.rb | # frozen_string_literal: true
class PriceCents < ActiveRecord::Migration
def up
add_column :links, :price_cents, :integer
add_column :purchases, :price_cents, :integer
Link.find_each do |link|
link.price_cents = link.price * 100
link.save(validate: false)
end
Purchase.find_each do |purchase|
purchase.price_cents = purchase.price * 100
purchase.save(validate: false)
end
end
def down
remove_column :links, :price_cents
remove_column :purchases, :price_cents
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20201221103409_remove_event_test_path_assignments.rb | db/migrate/20201221103409_remove_event_test_path_assignments.rb | # frozen_string_literal: true
class RemoveEventTestPathAssignments < ActiveRecord::Migration[6.0]
def up
drop_table :event_test_path_assignments
end
def down
create_table "event_test_path_assignments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "event_id"
t.string "event_name", limit: 255
t.string "active_test_paths", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["active_test_paths", "event_name"], name: "index_event_assignments_on_active_test_paths_and_event_name"
t.index ["event_id"], name: "index_event_test_path_assignments_on_event_id"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230216144650_create_product_embeddings.rb | db/migrate/20230216144650_create_product_embeddings.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130109001636_create_subscriptions.rb | db/migrate/20130109001636_create_subscriptions.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130409211234_add_index_to_user_id_on_subscriptions.rb | db/migrate/20130409211234_add_index_to_user_id_on_subscriptions.rb | # frozen_string_literal: true
class AddIndexToUserIdOnSubscriptions < ActiveRecord::Migration
def change
add_index :subscriptions, :user_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20131025214853_add_affiliate_application_to_link.rb | db/migrate/20131025214853_add_affiliate_application_to_link.rb | # frozen_string_literal: true
class AddAffiliateApplicationToLink < ActiveRecord::Migration
def change
add_column :links, :affiliate_application_id, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140610022228_add_user_agent_to_twitter_orders.rb | db/migrate/20140610022228_add_user_agent_to_twitter_orders.rb | # frozen_string_literal: true
class AddUserAgentToTwitterOrders < ActiveRecord::Migration
def change
add_column :twitter_orders, :user_agent, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231119173129_drop_bins.rb | db/migrate/20231119173129_drop_bins.rb | # frozen_string_literal: true
class DropBins < ActiveRecord::Migration[7.0]
def up
drop_table :bins
end
def down
create_table "bins", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci" 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"
t.integer "iso_country_number"
t.string "website"
t.string "phone_number"
t.string "card_brand"
t.index ["card_bin"], name: "index_bins_on_card_bin"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130618031049_add_tos_violation_reason_to_users.rb | db/migrate/20130618031049_add_tos_violation_reason_to_users.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120124233751_add_custom_css_to_user.rb | db/migrate/20120124233751_add_custom_css_to_user.rb | # frozen_string_literal: true
class AddCustomCssToUser < ActiveRecord::Migration
def change
add_column :users, :custom_css, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120718175028_add_filegroup_to_links.rb | db/migrate/20120718175028_add_filegroup_to_links.rb | # frozen_string_literal: true
class AddFilegroupToLinks < ActiveRecord::Migration
def change
add_column :links, :filegroup, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20181207212703_add_tracking_url_to_shipments.rb | db/migrate/20181207212703_add_tracking_url_to_shipments.rb | # frozen_string_literal: true
class AddTrackingUrlToShipments < ActiveRecord::Migration
def change
add_column :shipments, :tracking_url, :string, limit: 2083
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230912033854_add_product_to_custom_domains.rb | db/migrate/20230912033854_add_product_to_custom_domains.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130515005212_add_subscription_duration_to_links.rb | db/migrate/20130515005212_add_subscription_duration_to_links.rb | # frozen_string_literal: true
class AddSubscriptionDurationToLinks < ActiveRecord::Migration
def change
add_column :links, :subscription_duration, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20211006125152_add_ancestry_to_comments.rb | db/migrate/20211006125152_add_ancestry_to_comments.rb | # frozen_string_literal: true
class AddAncestryToComments < ActiveRecord::Migration[6.1]
def change
change_table :comments, bulk: true do |t|
t.string :ancestry
t.integer :ancestry_depth, default: 0, null: false
t.index :ancestry
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120516231444_remove_stripe_disputed_from_purchases.rb | db/migrate/20120516231444_remove_stripe_disputed_from_purchases.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150804000002_add_index_email_followed_id_to_follower.rb | db/migrate/20150804000002_add_index_email_followed_id_to_follower.rb | # 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]
add_index :followers, [:email, :followed_id], name: "index_follows_on_email_and_followed_id"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121016054654_add_stripe_error_code_to_purchases.rb | db/migrate/20121016054654_add_stripe_error_code_to_purchases.rb | # frozen_string_literal: true
class AddStripeErrorCodeToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :stripe_error_code, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130428022915_add_google_analytics_id_to_users.rb | db/migrate/20130428022915_add_google_analytics_id_to_users.rb | # frozen_string_literal: true
class AddGoogleAnalyticsIdToUsers < ActiveRecord::Migration
def change
add_column :users, :google_analytics_id, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220201231036_add_taxonomy_id_to_links.rb | db/migrate/20220201231036_add_taxonomy_id_to_links.rb | # frozen_string_literal: true
class AddTaxonomyIdToLinks < ActiveRecord::Migration[6.1]
def change
add_reference :links, :taxonomy
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230916144954_add_policy_disclosure_fields_to_dispute_evidences.rb | db/migrate/20230916144954_add_policy_disclosure_fields_to_dispute_evidences.rb | # frozen_string_literal: true
class AddPolicyDisclosureFieldsToDisputeEvidences < ActiveRecord::Migration[7.0]
def change
change_table :dispute_evidences, bulk: true do |t|
t.text :cancellation_policy_disclosure
t.text :refund_policy_disclosure
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240512134634_create_call_availabilities.rb | db/migrate/20240512134634_create_call_availabilities.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120611194653_add_fanpage_to_users.rb | db/migrate/20120611194653_add_fanpage_to_users.rb | # frozen_string_literal: true
class AddFanpageToUsers < ActiveRecord::Migration
def change
add_column :users, :fanpage, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130117015306_create_variant_categories.rb | db/migrate/20130117015306_create_variant_categories.rb | # frozen_string_literal: true
class CreateVariantCategories < ActiveRecord::Migration
def change
create_table :variant_categories do |t|
t.integer :link_id
t.datetime :deleted_at
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210611004441_add_content_updated_at_to_products.rb | db/migrate/20210611004441_add_content_updated_at_to_products.rb | # frozen_string_literal: true
class AddContentUpdatedAtToProducts < ActiveRecord::Migration[6.1]
def change
add_column :links, :content_updated_at, :datetime, null: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240301123339_add_disputed_at_and_dispute_reversed_at_to_charges.rb | db/migrate/20240301123339_add_disputed_at_and_dispute_reversed_at_to_charges.rb | # frozen_string_literal: true
class AddDisputedAtAndDisputeReversedAtToCharges < ActiveRecord::Migration[7.1]
change_table :charges, bulk: true do |t|
t.datetime :disputed_at
t.datetime :dispute_reversed_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150608001919_create_product_tags.rb | db/migrate/20150608001919_create_product_tags.rb | # frozen_string_literal: true
class CreateProductTags < ActiveRecord::Migration
def change
create_table :product_tags, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :link
t.string :tag
t.string :tag_value
t.timestamps
t.datetime :deleted_at
end
add_index :product_tags, [:link_id, :tag], unique: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140204042121_create_imported_customers.rb | db/migrate/20140204042121_create_imported_customers.rb | # frozen_string_literal: true
class CreateImportedCustomers < ActiveRecord::Migration
def change
create_table :imported_customers do |t|
t.string :email
t.datetime :purchase_date
t.integer :link_id
t.integer :importing_user_id
t.timestamps
end
add_index(:imported_customers, :link_id)
add_index(:imported_customers, :importing_user_id)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20131023210534_add_affiliate_basis_points_to_oauth_applications.rb | db/migrate/20131023210534_add_affiliate_basis_points_to_oauth_applications.rb | # frozen_string_literal: true
class AddAffiliateBasisPointsToOauthApplications < ActiveRecord::Migration
def change
add_column :oauth_applications, :affiliate_basis_points, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150729183520_add_flags_to_variant_categories.rb | db/migrate/20150729183520_add_flags_to_variant_categories.rb | # frozen_string_literal: true
class AddFlagsToVariantCategories < ActiveRecord::Migration
def change
add_column :variant_categories, :flags, :integer, default: 0, null: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210811155205_create_base_variant_integration.rb | db/migrate/20210811155205_create_base_variant_integration.rb | # 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_index :base_variant_integrations, :integration_id
add_index :base_variant_integrations, :base_variant_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230617003555_add_archived_at_to_affiliates.rb | db/migrate/20230617003555_add_archived_at_to_affiliates.rb | # frozen_string_literal: true
class AddArchivedAtToAffiliates < ActiveRecord::Migration[7.0]
def change
add_column :affiliates, :archived_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120928045005_create_events.rb | db/migrate/20120928045005_create_events.rb | # frozen_string_literal: true
class CreateEvents < ActiveRecord::Migration
def change
create_table "events", force: true do |t|
t.integer "visit_id"
t.string "ip_address"
t.string "event_name"
t.integer "user_id"
t.integer "link_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "referrer"
t.string "parent_referrer"
t.string "language"
t.string "browser"
t.boolean "is_mobile", default: false
t.string "email"
t.integer "purchase_id"
t.integer "price_cents"
t.integer "credit_card_id"
t.string "card_type"
t.string "card_visual"
t.boolean "purchase_state", default: false
t.string "billing_zip"
t.boolean "chargeback", default: false
t.boolean "refunded", default: false
t.string "view_url"
t.string "fingerprint"
t.string "ip_country"
t.float "ip_longitude"
t.float "ip_latitude"
t.boolean "is_modal"
end
add_index "events", ["created_at"], name: "index_events_on_created_at"
add_index "events", ["event_name"], name: "index_events_on_event_type"
add_index "events", ["fingerprint"], name: "index_events_on_fingerprint"
add_index "events", ["ip_address"], name: "index_events_on_ip_address"
add_index "events", ["link_id"], name: "index_events_on_link_id"
add_index "events", ["purchase_id"], name: "index_events_on_purchase_id"
add_index "events", ["visit_id"], name: "index_events_on_visit_id"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210503141445_remove_link_columns.rb | db/migrate/20210503141445_remove_link_columns.rb | # 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
t.remove :preview_attachment_id
t.remove :partner_source
t.remove :is_charitable
t.remove :custom_download_text
end
end
def down
change_table :links do |t|
t.text :territory_restriction, size: :medium
t.boolean :preview_automatically_generated
t.integer :bad_email_counter, default: 0
t.integer :webhook_fail_count, default: 0
t.boolean :preview_processed, default: true
t.integer :preview_attachment_id
t.string :partner_source
t.boolean :is_charitable, default: false
t.string :custom_download_text
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230126145540_create_purchasing_power_parity_info.rb | db/migrate/20230126145540_create_purchasing_power_parity_info.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121110000812_create_balances.rb | db/migrate/20121110000812_create_balances.rb | # frozen_string_literal: true
class CreateBalances < ActiveRecord::Migration
def change
create_table :balances do |t|
t.references :user
t.date :date
t.integer :amount_cents, default: 0
t.string :state
t.timestamps
end
add_index :balances, [:user_id, :date], unique: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120518183521_add_attachment_profile_to_user.rb | db/migrate/20120518183521_add_attachment_profile_to_user.rb | # 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
def self.down
remove_column :users, :profile_file_name
remove_column :users, :profile_content_type
remove_column :users, :profile_file_size
remove_column :users, :profile_updated_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121113061128_add_balance_ids_to_purchases.rb | db/migrate/20121113061128_add_balance_ids_to_purchases.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120725195558_add_deleted_at_to_api_sessions.rb | db/migrate/20120725195558_add_deleted_at_to_api_sessions.rb | # frozen_string_literal: true
class AddDeletedAtToApiSessions < ActiveRecord::Migration
def change
add_column :api_sessions, :deleted_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111109011928_create_links.rb | db/migrate/20111109011928_create_links.rb | # 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_of_paid_downloads
t.integer :number_of_downloads
t.integer :download_limit
t.integer :number_of_views
t.float :balance
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120305005646_add_facebook_column_to_users.rb | db/migrate/20120305005646_add_facebook_column_to_users.rb | # frozen_string_literal: true
class AddFacebookColumnToUsers < ActiveRecord::Migration
def up
add_column :users, :facebook_profile, :string
add_column :users, :facebook_gender, :string
add_column :users, :facebook_timezone, :string
add_column :users, :facebook_locale, :string
add_column :users, :facebook_verified, :string
add_column :users, :facebook_pic_large, :string
add_column :users, :facebook_pic_square, :string
end
def down
remove_column :users, :facebook_profile
remove_column :users, :facebook_gender
remove_column :users, :facebook_timezone
remove_column :users, :facebook_locale
remove_column :users, :facebook_verified
remove_column :users, :facebook_pic_large
remove_column :users, :facebook_pic_square
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250331004347_create_video_files.rb | db/migrate/20250331004347_create_video_files.rb | # 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., "mp4")
# Metadata populated during analysis.
t.integer :width # Video width in pixels
t.integer :height # Video height in pixels
t.integer :duration # Duration in seconds
t.integer :bitrate # Bitrate of the video
t.integer :framerate # Frame rate of the video
t.integer :size # File size in bytes
t.integer :flags, default: 0 # For FlagShihTzu booleans
t.datetime :deleted_at
t.datetime :deleted_from_cdn_at
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210324121415_create_thumbnails.rb | db/migrate/20210324121415_create_thumbnails.rb | # frozen_string_literal: true
class CreateThumbnails < ActiveRecord::Migration[6.1]
def change
create_table :thumbnails do |t|
t.belongs_to :product, type: :integer, foreign_key: { to_table: :links }
t.datetime :deleted_at
t.string :guid
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231016051957_drop_json_data_from_product_files_archive.rb | db/migrate/20231016051957_drop_json_data_from_product_files_archive.rb | # frozen_string_literal: true
class DropJsonDataFromProductFilesArchive < ActiveRecord::Migration[7.0]
def change
remove_column :product_files_archives, :json_data, :text, size: :medium
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150913230710_add_call_to_action_to_updates.rb | db/migrate/20150913230710_add_call_to_action_to_updates.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20131010184403_create_product_files.rb | db/migrate/20131010184403_create_product_files.rb | # frozen_string_literal: true
class CreateProductFiles < ActiveRecord::Migration
def change
create_table :product_files do |t|
t.integer :link_id
t.string :url
t.string :filetype
t.string :filegroup
t.integer :size
t.integer :bitrate
t.integer :framerate
t.integer :pagelength
t.integer :duration
t.integer :width
t.integer :height
t.integer :flags, default: 0, null: false
t.text :json_data
t.datetime :deleted_at
t.timestamps
end
add_index :product_files, :link_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20221125144458_add_new_third_party_analytic_fields.rb | db/migrate/20221125144458_add_new_third_party_analytic_fields.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151208202555_create_messages.rb | db/migrate/20151208202555_create_messages.rb | # 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
t.text :text
t.string :title
t.datetime :read_at
t.datetime :responded_at
t.datetime :deleted_at
t.timestamps
end
add_index(:messages, :parent_id)
add_index(:messages, :purchase_id)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120521221732_add_profile_guid_to_users.rb | db/migrate/20120521221732_add_profile_guid_to_users.rb | # frozen_string_literal: true
class AddProfileGuidToUsers < ActiveRecord::Migration
def up
add_column :users, :profile_guid, :string
end
def down
remove_column :users, :profile_guid
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220907152005_add_content_type_to_resource_subscription.rb | db/migrate/20220907152005_add_content_type_to_resource_subscription.rb | # frozen_string_literal: true
class AddContentTypeToResourceSubscription < ActiveRecord::Migration[6.1]
def change
add_column :resource_subscriptions, :content_type, :string, default: "application/x-www-form-urlencoded"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121128061117_add_custom_fields_to_links.rb | db/migrate/20121128061117_add_custom_fields_to_links.rb | # frozen_string_literal: true
class AddCustomFieldsToLinks < ActiveRecord::Migration
def change
add_column :links, :custom_fields, :text
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130114225338_add_draft_to_links.rb | db/migrate/20130114225338_add_draft_to_links.rb | # frozen_string_literal: true
class AddDraftToLinks < ActiveRecord::Migration
def change
add_column :links, :draft, :boolean, default: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210101171009_add_processor_payment_intent_id_to_service_charges.rb | db/migrate/20210101171009_add_processor_payment_intent_id_to_service_charges.rb | # 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_payment_intent_id VARCHAR(255),
ADD INDEX index_service_charges_on_processor_payment_intent_id (processor_payment_intent_id)
SQL
end
def down
remove_column :service_charges, :processor_payment_intent_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150820001818_add_ended_at_to_subscription.rb | db/migrate/20150820001818_add_ended_at_to_subscription.rb | # frozen_string_literal: true
class AddEndedAtToSubscription < ActiveRecord::Migration
def change
add_column :subscriptions, :ended_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20211008190755_add_selected_flags_to_installment_index.rb | db/migrate/20211008190755_add_selected_flags_to_installment_index.rb | # frozen_string_literal: true
class AddSelectedFlagsToInstallmentIndex < ActiveRecord::Migration[6.1]
def up
EsClient.indices.put_mapping(
index: Installment.index_name,
body: {
properties: {
selected_flags: { type: "keyword" },
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210623231346_remove_unused_columns_from_payments.rb | db/migrate/20210623231346_remove_unused_columns_from_payments.rb | # frozen_string_literal: true
class RemoveUnusedColumnsFromPayments < ActiveRecord::Migration[6.1]
def up
change_table :payments, bulk: true do |t|
t.remove :status_data
t.remove :unique_id
t.remove :local_currency
t.change :id, :bigint, null: false, unique: true, auto_increment: true
t.change :user_id, :bigint
t.change :bank_account_id, :bigint
end
end
def down
change_table :payments, bulk: true do |t|
t.text :status_data
t.string :unique_id
t.string :local_currency
t.change :id, :integer, null: false, unique: true, auto_increment: true
t.change :user_id, :integer
t.change :bank_account_id, :integer
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20111116011538_create_attachments.rb | db/migrate/20111116011538_create_attachments.rb | # frozen_string_literal: true
class CreateAttachments < ActiveRecord::Migration
def change
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.string :file_file_name
t.string :file_content_type
t.integer :file_file_size
t.datetime :file_updated_at
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120524014628_create_currency.rb | db/migrate/20120524014628_create_currency.rb | # frozen_string_literal: true
class CreateCurrency < ActiveRecord::Migration
def up
create_table :currencies do |t|
t.float :currency_rate
t.string :currency_type
end
end
def down
drop_table :currencies
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120922005048_add_correlation_id_to_payments.rb | db/migrate/20120922005048_add_correlation_id_to_payments.rb | # frozen_string_literal: true
class AddCorrelationIdToPayments < ActiveRecord::Migration
def change
add_column :payments, :correlation_id, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230719131833_create_orders.rb | db/migrate/20230719131833_create_orders.rb | # frozen_string_literal: true
class CreateOrders < ActiveRecord::Migration[7.0]
def change
create_table :orders do |t|
t.references :purchaser
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120426001920_add_index_to_session_id.rb | db/migrate/20120426001920_add_index_to_session_id.rb | # frozen_string_literal: true
class AddIndexToSessionId < ActiveRecord::Migration
def up
add_index :purchases, :session_id
end
def down
remove_index :purchases, :session_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120725030749_add_custom_permalink_to_links.rb | db/migrate/20120725030749_add_custom_permalink_to_links.rb | # frozen_string_literal: true
class AddCustomPermalinkToLinks < ActiveRecord::Migration
def change
add_column :links, :custom_permalink, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210811141027_create_integration.rb | db/migrate/20210811141027_create_integration.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210215094713_create_active_storage_variant_records.active_storage.rb | db/migrate/20210215094713_create_active_storage_variant_records.active_storage.rb | # frozen_string_literal: true
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20241206205100_add_is_call_and_is_alive_to_products_index.rb | db/migrate/20241206205100_add_is_call_and_is_alive_to_products_index.rb | # frozen_string_literal: true
class AddIsCallAndIsAliveToProductsIndex < ActiveRecord::Migration[7.1]
def up
EsClient.indices.put_mapping(
index: Link.index_name,
body: {
properties: {
is_call: { type: "boolean" },
is_alive: { type: "boolean" },
}
}
)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20130116020240_create_ach_account.rb | db/migrate/20130116020240_create_ach_account.rb | # frozen_string_literal: true
class CreateAchAccount < ActiveRecord::Migration
def change
create_table :ach_accounts do |t|
t.references :user
t.string :routing_number
t.binary :account_number
t.string :state
t.timestamps
end
add_index :ach_accounts, :user_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230724164038_add_completed_at_to_post_email_blast.rb | db/migrate/20230724164038_add_completed_at_to_post_email_blast.rb | # frozen_string_literal: true
class AddCompletedAtToPostEmailBlast < ActiveRecord::Migration[7.0]
def change
add_column :post_email_blasts, :completed_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20171115105042_create_index_on_created_at_in_purchases.rb | db/migrate/20171115105042_create_index_on_created_at_in_purchases.rb | # frozen_string_literal: true
class CreateIndexOnCreatedAtInPurchases < ActiveRecord::Migration
def change
add_index :purchases, :created_at
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151111000001_add_returned_payment_to_credit.rb | db/migrate/20151111000001_add_returned_payment_to_credit.rb | # frozen_string_literal: true
class AddReturnedPaymentToCredit < ActiveRecord::Migration
def change
add_column :credits, :returned_payment_id, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120430184313_remove_publisher_from_infos.rb | db/migrate/20120430184313_remove_publisher_from_infos.rb | # frozen_string_literal: true
class RemovePublisherFromInfos < ActiveRecord::Migration
def up
remove_column :infos, :publisher
end
def down
add_column :infos, :publisher, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20150106182647_drop_documents.rb | db/migrate/20150106182647_drop_documents.rb | # frozen_string_literal: true
class DropDocuments < ActiveRecord::Migration
def change
drop_table :documents
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20220921065100_index_media_locations_product_id_updated_at.rb | db/migrate/20220921065100_index_media_locations_product_id_updated_at.rb | # frozen_string_literal: true
class IndexMediaLocationsProductIdUpdatedAt < ActiveRecord::Migration[6.1]
def change
add_index :media_locations, [:product_id, :updated_at]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151019000000_add_alive_at_charge_processor_at_to_merchant_account.rb | db/migrate/20151019000000_add_alive_at_charge_processor_at_to_merchant_account.rb | # frozen_string_literal: true
class AddAliveAtChargeProcessorAtToMerchantAccount < ActiveRecord::Migration
def change
add_column :merchant_accounts, :charge_processor_alive_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120411184339_add_bad_card_counter_to_links.rb | db/migrate/20120411184339_add_bad_card_counter_to_links.rb | # frozen_string_literal: true
class AddBadCardCounterToLinks < ActiveRecord::Migration
def change
add_column :links, :bad_card_counter, :integer, default: 0
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20250103131741_create_utm_link_driven_sales.rb | db/migrate/20250103131741_create_utm_link_driven_sales.rb | # frozen_string_literal: true
class CreateUtmLinkDrivenSales < ActiveRecord::Migration[7.1]
def change
create_table :utm_link_driven_sales do |t|
t.references :utm_link, null: false
t.references :utm_link_visit, null: false
t.references :order, null: false
t.timestamps
t.index [:utm_link_visit_id, :order_id], unique: true
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210511062447_create_affiliate_requests.rb | db/migrate/20210511062447_create_affiliate_requests.rb | # frozen_string_literal: true
class CreateAffiliateRequests < ActiveRecord::Migration[6.1]
def change
create_table :affiliate_requests do |t|
t.references :seller, type: :bigint, null: false, index: true
t.string :name, null: false, limit: 100
t.string :email, null: false
t.text :promotion_text, size: :medium, null: false
t.string :locale, null: false, default: "en"
t.string :state
t.datetime :state_transitioned_at
t.timestamps
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240323103102_create_sales_stats.rb | db/migrate/20240323103102_create_sales_stats.rb | # frozen_string_literal: true
class CreateSalesStats < ActiveRecord::Migration[7.0]
def set_up_common_columns(t)
t.bigint :sales_cents, default: 0, null: false
t.bigint :refunds_cents, default: 0, null: false
t.bigint :disputes_cents, default: 0, null: false
t.bigint :dispute_reversals_cents, default: 0, null: false
t.bigint :net_revenue_cents, as: "sales_cents - refunds_cents - disputes_cents + dispute_reversals_cents", stored: true, null: false
t.bigint :fees_cents, default: 0, null: false
t.bigint :fees_refunds_cents, default: 0, null: false
t.bigint :fees_disputes_cents, default: 0, null: false
t.bigint :fees_dispute_reversals_cents, default: 0, null: false
t.bigint :net_fees_cents, as: "fees_cents - fees_refunds_cents - fees_disputes_cents + fees_dispute_reversals_cents", stored: true, null: false
t.bigint :affiliate_sales_cents, default: 0, null: false
t.bigint :affiliate_refunds_cents, default: 0, null: false
t.bigint :affiliate_disputes_cents, default: 0, null: false
t.bigint :affiliate_dispute_reversals_cents, default: 0, null: false
t.bigint :net_affiliate_revenue_cents, as: "affiliate_sales_cents - affiliate_refunds_cents - affiliate_disputes_cents + affiliate_dispute_reversals_cents", stored: true, null: false
t.bigint :adjusted_net_revenue_cents, as: "net_revenue_cents - net_fees_cents - net_affiliate_revenue_cents", stored: true, null: false
t.bigint :discover_sales_cents, default: 0, null: false
t.bigint :discover_refunds_cents, default: 0, null: false
t.bigint :discover_disputes_cents, default: 0, null: false
t.bigint :discover_dispute_reversals_cents, default: 0, null: false
t.bigint :discover_net_revenue_cents, as: "discover_sales_cents - discover_refunds_cents - discover_disputes_cents + discover_dispute_reversals_cents", stored: true, null: false
t.integer :sales_count, default: 0, null: false
t.integer :full_refunds_count, default: 0, null: false
t.integer :disputes_count, default: 0, null: false
t.integer :dispute_reversals_count, default: 0, null: false
t.integer :net_sales_count, as: "sales_count - full_refunds_count - disputes_count + dispute_reversals_count", stored: true, null: false
t.integer :free_sales_count, default: 0, null: false
t.integer :active_nonmemberships_count, default: 0, null: false
t.integer :inactive_nonmemberships_count, default: 0, null: false
t.integer :net_active_nonmemberships_count, as: "active_nonmemberships_count - inactive_nonmemberships_count", stored: true, null: false
t.integer :active_memberships_count, default: 0, null: false
t.integer :inactive_memberships_count, default: 0, null: false
t.integer :net_active_memberships_count, as: "active_memberships_count - inactive_memberships_count", stored: true, null: false
t.integer :net_active_sales_count, as: "net_active_nonmemberships_count + net_active_memberships_count", stored: true, null: false
t.timestamps
end
def change
create_table :product_daily_sales_stats do |t|
t.bigint :seller_id, null: false
t.bigint :product_id, null: false
t.date :date, null: false
set_up_common_columns(t)
t.index [:product_id, :date], unique: true
t.index [:seller_id, :date] # used when reingesting
t.index :date # used for global sums
end
create_table :product_sales_stats do |t|
t.bigint :seller_id, null: false
t.bigint :product_id, null: false
set_up_common_columns(t)
t.index :seller_id
t.index :product_id, unique: true
end
create_table :variant_daily_sales_stats do |t|
t.bigint :seller_id, null: false
t.bigint :product_id, null: false
t.bigint :variant_id, null: false
t.date :date, null: false
set_up_common_columns(t)
t.index [:variant_id, :date], unique: true
t.index [:seller_id, :date] # used when reingesting
t.index :date # used for global sums
t.index :product_id
end
create_table :variant_sales_stats do |t|
t.bigint :seller_id, null: false
t.bigint :product_id, null: false
t.bigint :variant_id, null: false
set_up_common_columns(t)
t.index :seller_id
t.index :product_id
t.index :variant_id, unique: true
end
create_table :seller_daily_sales_stats do |t|
t.bigint :seller_id, null: false
t.date :date, null: false
set_up_common_columns(t)
t.index [:seller_id, :date], unique: true
t.index :date # used for global sums
end
create_table :seller_sales_stats do |t|
t.bigint :seller_id, null: false
set_up_common_columns(t)
t.index :seller_id, unique: true
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190307043559_add_missing_indexes_for_purchases_search.rb | db/migrate/20190307043559_add_missing_indexes_for_purchases_search.rb | # frozen_string_literal: true
class AddMissingIndexesForPurchasesSearch < ActiveRecord::Migration
def up
add_index :purchases, :email, length: 191, name: "index_purchases_on_email_long"
remove_index :purchases, name: "index_purchases_on_email"
add_index :purchases, [:seller_id, :purchase_state, :flags, :email], name: "index_purchases_on_seller_id_and_state_and_flags_and_email", length: { email: 191 }
add_index :subscriptions, [:link_id, :flags]
add_index :gifts, :giftee_purchase_id
end
def down
add_index :purchases, :email, length: 10, name: "index_purchases_on_email"
remove_index :purchases, name: "index_purchases_on_email_long"
remove_index :purchases, name: "index_purchases_on_seller_id_and_state_and_flags_and_email"
remove_index :subscriptions, [:link_id, :flags]
remove_index :gifts, :giftee_purchase_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20230516003056_create_australia_backtax_email_infos.rb | db/migrate/20230516003056_create_australia_backtax_email_infos.rb | # frozen_string_literal: true
class CreateAustraliaBacktaxEmailInfos < ActiveRecord::Migration[7.0]
def change
create_table :australia_backtax_email_infos do |t|
t.bigint :user_id
t.string "email_name"
t.datetime "sent_at"
t.timestamps
t.index [:user_id]
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20210524125845_add_deleted_at_to_followers.rb | db/migrate/20210524125845_add_deleted_at_to_followers.rb | # frozen_string_literal: true
class AddDeletedAtToFollowers < ActiveRecord::Migration[6.1]
def change
add_column :followers, :deleted_at, :datetime, null: true
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120516222956_remove_amounts_refunded_cents_from_purchases.rb | db/migrate/20120516222956_remove_amounts_refunded_cents_from_purchases.rb | # frozen_string_literal: true
class RemoveAmountsRefundedCentsFromPurchases < ActiveRecord::Migration
def up
remove_column :purchases, :amount_refunded_cents
end
def down
add_column :purchases, :amount_refunded_cents, :integer
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20201026060716_add_split_payment_by_cents_to_users.rb | db/migrate/20201026060716_add_split_payment_by_cents_to_users.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120125204636_remove_columns.rb | db/migrate/20120125204636_remove_columns.rb | # 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_exclusivity
remove_column :links, :number_of_downloads
remove_column :links, :download_limit
end
def down
add_column :links, :create_date, :int
add_column :purchases, :create_date, :int
add_column :users, :create_date, :int
add_column :purchases, :owner
Purchase.each do |purchase|
purchase.owner = purchase.user.email
purchase.save
end
add_column :links, :owner
Link.each do |link|
link.owner = link.user.email
link.save
end
remove_column :links, :length_of_exclusivity, :integer, default: 0
remove_column :links, :number_of_downloads, :integer, default: 0
remove_column :links, :download_limit, :integer, default: 0
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20151016233313_increase_string_limit_for_workflows.rb | db/migrate/20151016233313_increase_string_limit_for_workflows.rb | # frozen_string_literal: true
class IncreaseStringLimitForWorkflows < ActiveRecord::Migration
def change
change_column(:workflows, :name, :string, limit: 1024)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20251014161000_create_installment_plan_snapshots.rb | db/migrate/20251014161000_create_installment_plan_snapshots.rb | # frozen_string_literal: true
class CreateInstallmentPlanSnapshots < ActiveRecord::Migration[7.1]
def change
create_table :installment_plan_snapshots do |t|
t.integer :payment_option_id, null: false
t.integer :number_of_installments, null: false
t.string :recurrence, null: false
t.integer :total_price_cents, null: false
t.timestamps
t.index :payment_option_id, unique: true
t.foreign_key :payment_options, column: :payment_option_id
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20190601144211_add_status_to_refund.rb | db/migrate/20190601144211_add_status_to_refund.rb | # frozen_string_literal: true
class AddStatusToRefund < ActiveRecord::Migration
def change
add_column :refunds, :status, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20121120001642_create_payments_balances.rb | db/migrate/20121120001642_create_payments_balances.rb | # 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
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140321232012_add_json_data_to_purchases.rb | db/migrate/20140321232012_add_json_data_to_purchases.rb | # frozen_string_literal: true
class AddJsonDataToPurchases < ActiveRecord::Migration
def change
add_column :purchases, :json_data, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20231003202428_drop_profile_tags.rb | db/migrate/20231003202428_drop_profile_tags.rb | # frozen_string_literal: true
class DropProfileTags < ActiveRecord::Migration[7.0]
def change
drop_table :profile_tags do |t|
t.references :user, null: false
t.references :tag, null: false
t.boolean :active, default: true, null: false
t.timestamps null: false
t.index [:user_id, :tag_id], unique: true
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20140630203638_add_user_requested_cancellation_at_to_subscription.rb | db/migrate/20140630203638_add_user_requested_cancellation_at_to_subscription.rb | # frozen_string_literal: true
class AddUserRequestedCancellationAtToSubscription < ActiveRecord::Migration
def change
add_column :subscriptions, :user_requested_cancellation_at, :datetime
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120612012558_add_facebook_access_token_to_users.rb | db/migrate/20120612012558_add_facebook_access_token_to_users.rb | # frozen_string_literal: true
class AddFacebookAccessTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :facebook_access_token, :string
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20240712150014_add_flags_to_purchase_custom_fields.rb | db/migrate/20240712150014_add_flags_to_purchase_custom_fields.rb | # frozen_string_literal: true
class AddFlagsToPurchaseCustomFields < ActiveRecord::Migration[7.1]
def change
add_column :purchase_custom_fields, :flags, :bigint, default: 0, null: false
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120927080346_change_status_to_state_in_payments.rb | db/migrate/20120927080346_change_status_to_state_in_payments.rb | # 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
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/db/migrate/20120508233443_add_last_parntner_sync_to_links.rb | db/migrate/20120508233443_add_last_parntner_sync_to_links.rb | # frozen_string_literal: true
class AddLastParntnerSyncToLinks < ActiveRecord::Migration
def change
add_column :links, :last_partner_sync, :timestamp
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.