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 | config.ru | Ruby | mit | 8,966 | main | 206 | # typed: false
# frozen_string_literal: true
# This file is used by Rack-based servers to start the application.
require_relative "config/environment"
run Rails.application
Rails.application.load_server |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/schema.rb | Ruby | mit | 8,966 | main | 130,789 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/seeds.rb | Ruby | mit | 8,966 | main | 951 | # frozen_string_literal: true
def seed_log(msg)
puts msg unless Rails.env.test?
end
def load_seeds(file)
seed_log "Applying seeds in: #{file}"
load(file, true)
end
seed_log "Applying seeds for environment: #{Rails.env}"
# Load common seeds.
common_directory = __dir__ + "/seeds"
Dir[File.join(common_directory,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190318023359_add_admin_purchases_and_service_charges_search_index.rb | Ruby | mit | 8,966 | main | 737 | # frozen_string_literal: true
class AddAdminPurchasesAndServiceChargesSearchIndex < ActiveRecord::Migration
def change
add_index :purchases, [:card_type, :card_visual, :stripe_fingerprint], name: "index_purchases_on_card_type_visual_fingerprint"
add_index :purchases, [:card_type, :card_visual, :created_at, :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240716153656_create_product_review_responses.rb | Ruby | mit | 8,966 | main | 307 | # frozen_string_literal: true
class CreateProductReviewResponses < ActiveRecord::Migration[7.1]
def change
create_table :product_review_responses do |t|
t.belongs_to :user, null: false
t.belongs_to :product_review, null: false
t.text :message
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120706013215_delete_default_for_links_price_cents.rb | Ruby | mit | 8,966 | main | 234 | # frozen_string_literal: true
class DeleteDefaultForLinksPriceCents < ActiveRecord::Migration
def up
change_column_default :links, :price_cents, nil
end
def down
change_column_default :links, :price_cents, 0
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130116020240_create_ach_account.rb | Ruby | mit | 8,966 | main | 316 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250210153633_create_public_files.rb | Ruby | mit | 8,966 | main | 618 | # frozen_string_literal: true
class CreatePublicFiles < ActiveRecord::Migration[7.1]
def change
create_table :public_files do |t|
t.references :seller
t.belongs_to :resource, polymorphic: true, null: false
t.string :public_id, null: false, index: { unique: true }
t.string :display_name, n... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140718003800_create_documents.rb | Ruby | mit | 8,966 | main | 313 | # frozen_string_literal: true
class CreateDocuments < ActiveRecord::Migration
def change
create_table :documents do |t|
t.belongs_to :product_file
t.string :state
t.string :external_docspad_id
t.timestamps
end
add_index :documents, :external_docspad_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190307043559_add_missing_indexes_for_purchases_search.rb | Ruby | mit | 8,966 | main | 879 | # 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, ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240227023200_index_reviews_with_messages.rb | Ruby | mit | 8,966 | main | 748 | # frozen_string_literal: true
class IndexReviewsWithMessages < ActiveRecord::Migration[7.1]
def up
change_table :product_reviews, bulk: true do |t|
t.change :id, :bigint, auto_increment: true, null: false
t.change :purchase_id, :bigint
t.change :link_id, :bigint
t.boolean :has_message, nu... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230523203442_migrate_deleted_purchases.rb | Ruby | mit | 8,966 | main | 888 | # frozen_string_literal: true
class MigrateDeletedPurchases < ActiveRecord::Migration[7.0]
def up
return unless Rails.env.development?
invalid_purchase_ids = []
eligible_purchases.find_in_batches do |batch|
batch.each do |purchase|
purchase.update!(
purchase_state: "successful",
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20180322091933_add_unconfirmed_email_index.rb | Ruby | mit | 8,966 | main | 207 | # frozen_string_literal: true
class AddUnconfirmedEmailIndex < ActiveRecord::Migration
def change
add_index :users, :unconfirmed_email, name: "index_users_on_unconfirmed_email", length: 191
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20260422000000_add_sales_count_for_inventory_cache.rb | Ruby | mit | 8,966 | main | 312 | # frozen_string_literal: true
class AddSalesCountForInventoryCache < ActiveRecord::Migration[7.1]
def change
add_column :base_variants, :sales_count_for_inventory_cache, :integer, default: 0, null: false
add_column :links, :sales_count_for_inventory_cache, :integer, default: 0, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200821142223_create_versions.rb | Ruby | mit | 8,966 | main | 1,645 | # frozen_string_literal: true
# This migration creates the `versions` table, the only schema PT requires.
# All other migrations PT provides are optional.
class CreateVersions < ActiveRecord::Migration[5.0]
# The largest text column available in all supported RDBMS is
# 1024^3 - 1 bytes, roughly one gibibyte. We ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120216022958_change_yen_to_jpy.rb | Ruby | mit | 8,966 | main | 1,167 | # frozen_string_literal: true
class ChangeYenToJpy < ActiveRecord::Migration
def up
User.find_each do |user|
if user.currency_type == "yen"
user.currency_type = "jpy"
end
user.save(validate: false)
end
Link.find_each do |link|
if link.price_currency_type == "yen"
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120211163119_remove_email_required_for_links.rb | Ruby | mit | 8,966 | main | 231 | # frozen_string_literal: true
class RemoveEmailRequiredForLinks < ActiveRecord::Migration
def up
remove_column :links, :email_required
end
def down
add_column :links, :email_required, :boolean, default: 0
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210502195458_remove_asset_preview_columns.rb | Ruby | mit | 8,966 | main | 619 | # frozen_string_literal: true
class RemoveAssetPreviewColumns < ActiveRecord::Migration[6.1]
def up
change_table :asset_previews do |t|
t.remove "attachment_file_name"
t.remove "attachment_content_type"
t.remove "attachment_file_size"
t.remove "attachment_updated_at"
t.remove "attac... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231117091724_change_default_product_type.rb | Ruby | mit | 8,966 | main | 206 | # frozen_string_literal: true
class ChangeDefaultProductType < ActiveRecord::Migration[7.0]
def change
change_column_default(:links, :native_type, from: nil, to: Link::NATIVE_TYPE_DIGITAL)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20151007000000_add_stripe_identity_document_id_to_user_compliance_info.rb | Ruby | mit | 8,966 | main | 210 | # frozen_string_literal: true
class AddStripeIdentityDocumentIdToUserComplianceInfo < ActiveRecord::Migration
def change
add_column :user_compliance_info, :stripe_identity_document_id, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240214064403_add_deleted_at_to_cart_products.rb | Ruby | mit | 8,966 | main | 330 | # frozen_string_literal: true
class AddDeletedAtToCartProducts < ActiveRecord::Migration[7.0]
def change
change_table :cart_products, bulk: true do |t|
t.datetime :deleted_at
t.remove_index [:cart_id, :product_id], unique: true
t.index [:cart_id, :product_id, :deleted_at], unique: true
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240408073222_make_charge_processor_and_merchant_account_id_nullable.rb | Ruby | mit | 8,966 | main | 469 | # frozen_string_literal: true
class MakeChargeProcessorAndMerchantAccountIdNullable < ActiveRecord::Migration[7.1]
def up
change_table :charges, bulk: true do |t|
t.change :processor, :string, null: true
t.change :merchant_account_id, :bigint, null: true
end
end
def down
change_table :ch... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190808124455_add_index_for_refunds_processor_refund_id.rb | Ruby | mit | 8,966 | main | 243 | # frozen_string_literal: true
class AddIndexForRefundsProcessorRefundId < ActiveRecord::Migration
def up
add_index :refunds, :processor_refund_id, unique: true
end
def down
remove_index :refunds, :processor_refund_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230125154905_create_upsell_variants.rb | Ruby | mit | 8,966 | main | 349 | # frozen_string_literal: true
class CreateUpsellVariants < ActiveRecord::Migration[7.0]
def change
create_table :upsell_variants do |t|
t.references :upsell, null: false
t.references :selected_variant, null: false
t.references :offered_variant, null: false
t.datetime :deleted_at
t.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20181031091727_create_product_reviews.rb | Ruby | mit | 8,966 | main | 320 | # frozen_string_literal: true
class CreateProductReviews < ActiveRecord::Migration
def change
create_table :product_reviews do |t|
t.references :purchase, index: true, unique: true, foreign_key: { on_delete: :cascade }
t.integer :rating, default: nil
t.timestamps null: false
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220415204825_add_top_seller_requests_index.rb | Ruby | mit | 8,966 | main | 746 | # frozen_string_literal: true
class AddTopSellerRequestsIndex < ActiveRecord::Migration[6.1]
def up
if Rails.env.production? || Rails.env.staging?
TopSellerRequest.__elasticsearch__.create_index!(index: "top_seller_requests_v1")
EsClient.indices.put_alias(name: "top_seller_requests", index: "top_sell... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111116011538_create_attachments.rb | Ruby | mit | 8,966 | main | 433 | # 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_cont... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200203195840_add_facebook_pixel_tracking_id_to_users.rb | Ruby | mit | 8,966 | main | 230 | # frozen_string_literal: true
class AddFacebookPixelTrackingIdToUsers < ActiveRecord::Migration
def up
add_column :users, :facebook_pixel_id, :string
end
def down
remove_column :users, :facebook_pixel_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210624025201_remove_unused_columns_from_url_redirects.rb | Ruby | mit | 8,966 | main | 1,671 | # frozen_string_literal: true
class RemoveUnusedColumnsFromUrlRedirects < ActiveRecord::Migration[6.1]
def up
execute <<~SQL
ALTER TABLE `url_redirects`
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
DROP COLUMN `webhooked_url`,
DROP COLUMN `customized_file_url`,
CHANGE `id` `id`... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230412221958_modify_upsells_selected_products.rb | Ruby | mit | 8,966 | main | 242 | # frozen_string_literal: true
class ModifyUpsellsSelectedProducts < ActiveRecord::Migration[7.0]
def change
change_table(:upsells_selected_products, bulk: true) do |t|
t.rename :product_id, :selected_product_id
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150608000000_add_stripe_ids_to_payments.rb | Ruby | mit | 8,966 | main | 226 | # frozen_string_literal: true
class AddStripeIdsToPayments < ActiveRecord::Migration
def change
add_column :payments, :stripe_connect_account_id, :string
add_column :payments, :stripe_transfer_id, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20250131062035_utm_link_update_unique_index_on_utm_params.rb | Ruby | mit | 8,966 | main | 603 | # frozen_string_literal: true
class UtmLinkUpdateUniqueIndexOnUtmParams < ActiveRecord::Migration[7.1]
def change
change_table :utm_links, bulk: true do |t|
t.remove_index [:seller_id, :utm_source, :utm_medium, :utm_campaign, :utm_term, :utm_content], where: "deleted_at IS NULL", name: "index_utm_links_on_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20221012115921_change_default_rich_content_version_on_links.rb | Ruby | mit | 8,966 | main | 262 | # frozen_string_literal: true
class ChangeDefaultRichContentVersionOnLinks < ActiveRecord::Migration[6.1]
def up
change_column_default :links, :rich_content_version, 1
end
def down
change_column_default :links, :rich_content_version, 0
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111213003155_price_cents.rb | Ruby | mit | 8,966 | main | 534 | # 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 |p... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230125154843_create_upsells.rb | Ruby | mit | 8,966 | main | 473 | # frozen_string_literal: true
class CreateUpsells < ActiveRecord::Migration[7.0]
def change
create_table :upsells do |t|
t.references :seller, null: false
t.references :offered_product, null: false
t.references :offered_variant
t.references :offer_code
t.string :name, null: false
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230503202309_add_purchase_refund_policies.rb | Ruby | mit | 8,966 | main | 309 | # frozen_string_literal: true
class AddPurchaseRefundPolicies < ActiveRecord::Migration[7.0]
def change
create_table :purchase_refund_policies do |t|
t.references :purchase, index: true, null: false
t.string :title, null: false
t.text :fine_print
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120912185136_change_cvc_check_to_cvc_check_failed.rb | Ruby | mit | 8,966 | main | 259 | # frozen_string_literal: true
class ChangeCvcCheckToCvcCheckFailed < ActiveRecord::Migration
def up
rename_column(:credit_cards, :cvc_check, :cvc_check_failed)
end
def down
rename_column(:credit_cards, :cvc_check_failed, :cvc_check)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120703060331_create_delayed_emails.rb | Ruby | mit | 8,966 | main | 203 | # frozen_string_literal: true
class CreateDelayedEmails < ActiveRecord::Migration
def change
create_table :delayed_emails do |t|
t.integer :purchase_id
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130109002024_create_installments.rb | Ruby | mit | 8,966 | main | 241 | # frozen_string_literal: true
class CreateInstallments < ActiveRecord::Migration
def change
create_table :installments do |t|
t.integer :link_id
t.text :message
t.text :url
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150709181910_fix_processed_audio_charset.rb | Ruby | mit | 8,966 | main | 210 | # frozen_string_literal: true
class FixProcessedAudioCharset < ActiveRecord::Migration
def change
execute("ALTER TABLE processed_audios CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;")
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231119164327_drop_user_recommended_root_taxonomies.rb | Ruby | mit | 8,966 | main | 624 | # frozen_string_literal: true
class DropUserRecommendedRootTaxonomies < ActiveRecord::Migration[7.0]
def up
drop_table :user_recommended_root_taxonomies
end
def down
create_table "user_recommended_root_taxonomies", charset: "utf8mb4", collation: "utf8mb4_unicode_ci" do |t|
t.bigint "user_id", null... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230203130729_create_gumroad_daily_analytics.rb | Ruby | mit | 8,966 | main | 481 | # frozen_string_literal: true
class CreateGumroadDailyAnalytics < ActiveRecord::Migration[7.0]
def change
create_table :gumroad_daily_analytics do |t|
t.datetime :period_ended_at, null: false
t.integer :gumroad_price_cents, null: false
t.integer :gumroad_fee_cents, null: false
t.integer :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20261122000000_create_billing_details.rb | Ruby | mit | 8,966 | main | 656 | # frozen_string_literal: true
class CreateBillingDetails < ActiveRecord::Migration[7.1]
def change
create_table :billing_details do |t|
t.bigint :purchaser_id, null: false
t.string :full_name, null: false
t.string :business_name
t.string :business_id
t.string :street_address, null: ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210901054745_set_elasticsearch_indices_mappings_as_strictly_non_dynamic.rb | Ruby | mit | 8,966 | main | 589 | # frozen_string_literal: true
class SetElasticsearchIndicesMappingsAsStrictlyNonDynamic < ActiveRecord::Migration[6.1]
def up
[Link, Balance, Purchase, Installment, ConfirmedFollowerEvent].each do |model|
EsClient.indices.put_mapping(index: model.index_name, body: { dynamic: :strict })
end
end
def... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120921000018_add_some_new_fields_to_payments.rb | Ruby | mit | 8,966 | main | 202 | # frozen_string_literal: true
class AddSomeNewFieldsToPayments < ActiveRecord::Migration
def change
add_column :payments, :txn_id, :string
add_column :payments, :unique_id, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200620103947_add_variant_id_to_product_files_archives.rb | Ruby | mit | 8,966 | main | 288 | # frozen_string_literal: true
class AddVariantIdToProductFilesArchives < ActiveRecord::Migration
def change
add_reference :product_files_archives, :variant, index: true
add_foreign_key :product_files_archives, :base_variants, column: :variant_id, on_delete: :cascade
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191014233812_backfill_installments_events_cache_count.rb | Ruby | mit | 8,966 | main | 425 | # frozen_string_literal: true
class BackfillInstallmentsEventsCacheCount < ActiveRecord::Migration
def up
Installment.find_in_batches do |installments|
# installment_events_count can be zero here instead of precalculated because we know
# the installment_events table is empty.
Installment.where... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230516003056_create_australia_backtax_email_infos.rb | Ruby | mit | 8,966 | main | 311 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120425190921_change_type_back_to_card_type.rb | Ruby | mit | 8,966 | main | 227 | # frozen_string_literal: true
class ChangeTypeBackToCardType < ActiveRecord::Migration
def up
rename_column :credit_cards, :type, :card_type
end
def down
rename_column :credit_cards, :card_type, :type
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150513164427_add_recommendation_type_to_users.rb | Ruby | mit | 8,966 | main | 239 | # frozen_string_literal: true
class AddRecommendationTypeToUsers < ActiveRecord::Migration
def change
add_column :users, :recommendation_type, :string, default: User::RecommendationType::SAME_CREATOR_PRODUCTS, null: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111212220615_user_facebook_uid.rb | Ruby | mit | 8,966 | main | 286 | # frozen_string_literal: true
class UserFacebookUid < ActiveRecord::Migration
def up
add_column :users, :facebook_uid, :string
add_index :users, :facebook_uid
end
def down
remove_index :users, :facebook_uid
remove_column :users, :facebook_uid, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210811063931_remove_content_length_unit_required_from_media_location.rb | Ruby | mit | 8,966 | main | 468 | # frozen_string_literal: true
class RemoveContentLengthUnitRequiredFromMediaLocation < ActiveRecord::Migration[6.1]
def up
change_table :media_locations, bulk: true do |t|
t.change :content_length, :integer, null: true
t.change :unit, :string, null: true
end
end
def down
change_table :me... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190910183718_backfill_installments_with_email_channel.rb | Ruby | mit | 8,966 | main | 311 | # frozen_string_literal: true
class BackfillInstallmentsWithEmailChannel < ActiveRecord::Migration
def up
Installment.find_in_batches do |installments|
installments.each do |installment|
installment.send_emails = true
installment.save!
end
sleep(0.05)
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240323103102_create_sales_stats.rb | Ruby | mit | 8,966 | main | 4,765 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121110000812_create_balances.rb | Ruby | mit | 8,966 | main | 329 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230828063848_remove_integration_type_from_integration.rb | Ruby | mit | 8,966 | main | 1,035 | # frozen_string_literal: true
class RemoveIntegrationTypeFromIntegration < ActiveRecord::Migration[7.0]
def up
remove_column :integrations, :integration_type
end
def down
add_column :integrations, :integration_type, :string
[CircleIntegration, DiscordIntegration, GoogleCalendarIntegration, ZoomInte... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150430233010_add_first_name_last_name_to_user_compliance_info.rb | Ruby | mit | 8,966 | main | 244 | # frozen_string_literal: true
class AddFirstNameLastNameToUserComplianceInfo < ActiveRecord::Migration
def change
add_column :user_compliance_info, :first_name, :string
add_column :user_compliance_info, :last_name, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20181026094910_add_search_indexes.rb | Ruby | mit | 8,966 | main | 289 | # frozen_string_literal: true
class AddSearchIndexes < ActiveRecord::Migration
def change
add_index :users, :name
add_index :gifts, :giftee_email
add_index :purchases, :full_name
add_index :subscriptions, :cancelled_at
add_index :subscriptions, :failed_at
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150202000000_create_merchant_account.rb | Ruby | mit | 8,966 | main | 558 | # frozen_string_literal: true
class CreateMerchantAccount < ActiveRecord::Migration
def up
create_table :merchant_accounts, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.references :user
t.string :acquirer_id
t.string :acquirer_merchant_id
t.string :charge_process... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231017001012_add_resolution_fields_to_dispute_evidences.rb | Ruby | mit | 8,966 | main | 326 | # frozen_string_literal: true
class AddResolutionFieldsToDisputeEvidences < ActiveRecord::Migration[7.0]
def change
change_table :dispute_evidences, bulk: true do |t|
t.datetime :resolved_at
t.string :resolution, default: "unknown"
t.string :error_message
t.index :resolved_at
end
en... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220429193757_add_discover_fee_to_recommended_purchase_infos.rb | Ruby | mit | 8,966 | main | 213 | # frozen_string_literal: true
class AddDiscoverFeeToRecommendedPurchaseInfos < ActiveRecord::Migration[6.1]
def change
add_column :recommended_purchase_infos, :discover_fee_per_thousand, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211214112715_remove_background_columns_from_users.rb | Ruby | mit | 8,966 | main | 380 | # frozen_string_literal: true
class RemoveBackgroundColumnsFromUsers < ActiveRecord::Migration[6.1]
def up
change_table :users, bulk: true do |t|
t.remove :background_color
t.remove :background_image_url
end
end
def down
change_table :users, bulk: true do |t|
t.string :background_c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20200713002040_create_computed_sales_analytics_days.rb | Ruby | mit | 8,966 | main | 324 | # frozen_string_literal: true
class CreateComputedSalesAnalyticsDays < ActiveRecord::Migration
def change
create_table :computed_sales_analytics_days do |t|
t.string :key, null: false, index: { unique: true }
t.text :data, limit: 10.megabytes # mediumtext
t.timestamps null: false
end
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121115185246_add_purchaser_id_index_to_purchases.rb | Ruby | mit | 8,966 | main | 218 | # frozen_string_literal: true
class AddPurchaserIdIndexToPurchases < ActiveRecord::Migration
def up
add_index "purchases", "purchaser_id"
end
def down
remove_index "purchases", "purchaser_id"
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210624104755_change_oauth_access_grants.rb | Ruby | mit | 8,966 | main | 281 | # frozen_string_literal: true
class ChangeOauthAccessGrants < ActiveRecord::Migration[6.1]
def up
change_column :oauth_access_grants, :scopes, :string, null: false, default: ""
end
def down
change_column :oauth_access_grants, :scopes, :string, null: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20261119011937_create_user_external_authentications.rb | Ruby | mit | 8,966 | main | 395 | # frozen_string_literal: true
class CreateUserExternalAuthentications < ActiveRecord::Migration[7.1]
def change
create_table :user_external_authentications do |t|
t.references :user, null: false
t.string :provider, null: false
t.string :uid, null: false
t.timestamps
end
add_index... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120913183233_remove_uniqueness_index_from_failed_purchases.rb | Ruby | mit | 8,966 | main | 335 | # frozen_string_literal: true
class RemoveUniquenessIndexFromFailedPurchases < ActiveRecord::Migration
def up
remove_index :failed_purchases, name: "by_link_and_stripe_fingerprint"
end
def down
add_index :failed_purchases, [:link_id, :stripe_fingerprint], unique: true, name: "by_link_and_stripe_fingerpr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130419202457_add_preorder_id_to_url_redirect.rb | Ruby | mit | 8,966 | main | 210 | # frozen_string_literal: true
class AddPreorderIdToUrlRedirect < ActiveRecord::Migration
def change
add_column :url_redirects, :preorder_id, :integer
add_index :url_redirects, :preorder_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220201101203_create_taxonomy_hierarchies.rb | Ruby | mit | 8,966 | main | 560 | # frozen_string_literal: true
class CreateTaxonomyHierarchies < ActiveRecord::Migration[6.1]
def change
create_table :taxonomy_hierarchies, id: false do |t|
t.bigint :ancestor_id, null: false
t.bigint :descendant_id, null: false
t.integer :generations, null: false
end
add_index :taxono... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191006034047_fix_installment_events_indexes.rb | Ruby | mit | 8,966 | main | 916 | # frozen_string_literal: true
class FixInstallmentEventsIndexes < ActiveRecord::Migration
def up
change_table :installment_events do |t|
t.remove_references :event, foreign_key: { on_delete: :cascade }
t.remove_references :installment, foreign_key: { on_delete: :cascade }
t.references :event, i... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230510160658_create_audience_members.rb | Ruby | mit | 8,966 | main | 2,232 | # frozen_string_literal: true
class CreateAudienceMembers < ActiveRecord::Migration[7.0]
def change
create_table :audience_members do |t|
t.bigint :seller_id, null: false
t.string :email, null: false
t.json :details
t.timestamps
t.index [:seller_id, :email], unique: true
# de... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190906144208_create_devices.rb | Ruby | mit | 8,966 | main | 465 | # frozen_string_literal: true
class CreateDevices < ActiveRecord::Migration
def change
create_table :devices do |t|
t.string :token, null: false, limit: 255
t.string :app_version, limit: 255
t.string :device_type, null: false, default: "ios", limit: 255
t.references :user, foreign_key: {... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210215094713_create_active_storage_variant_records.active_storage.rb | Ruby | mit | 8,966 | main | 535 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130124005549_create_refunds.rb | Ruby | mit | 8,966 | main | 231 | # frozen_string_literal: true
class CreateRefunds < ActiveRecord::Migration
def change
create_table :refunds do |t|
t.integer :amount_cents, default: 0
t.integer :purchase_id
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190906144207_remove_shown_on_profile_column_from_product_taggings.rb | Ruby | mit | 8,966 | main | 332 | # frozen_string_literal: true
class RemoveShownOnProfileColumnFromProductTaggings < ActiveRecord::Migration
def up
remove_column :product_taggings, :shown_on_profile
end
def down
add_column :product_taggings, :shown_on_profile, :boolean
change_column_default :product_taggings, :shown_on_profile, tru... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20131010184403_create_product_files.rb | Ruby | mit | 8,966 | main | 583 | # 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 ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240823204443_add_license_serial_to_elasticsearch.rb | Ruby | mit | 8,966 | main | 294 | # frozen_string_literal: true
class AddLicenseSerialToElasticsearch < ActiveRecord::Migration[7.1]
def up
EsClient.indices.put_mapping(
index: Purchase.index_name,
body: {
properties: {
license_serial: { type: "keyword" },
}
}
)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230310211434_add_affiliate_basis_points_to_affiliates_links.rb | Ruby | mit | 8,966 | main | 200 | # frozen_string_literal: true
class AddAffiliateBasisPointsToAffiliatesLinks < ActiveRecord::Migration[7.0]
def change
add_column :affiliates_links, :affiliate_basis_points, :integer
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20150501185757_add_asset_previews.rb | Ruby | mit | 8,966 | main | 400 | # frozen_string_literal: true
class AddAssetPreviews < ActiveRecord::Migration
def change
create_table :asset_previews, options: "DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.belongs_to :link
t.attachment :attachment
t.string :guid
t.text :oembed
t.timestam... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191126120036_add_deleted_at_to_custom_domain.rb | Ruby | mit | 8,966 | main | 229 | # frozen_string_literal: true
class AddDeletedAtToCustomDomain < ActiveRecord::Migration
def up
add_column :custom_domains, :deleted_at, :datetime
end
def down
remove_column :custom_domains, :deleted_at
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140218061738_index_purchase_variants.rb | Ruby | mit | 8,966 | main | 203 | # frozen_string_literal: true
class IndexPurchaseVariants < ActiveRecord::Migration
def change
add_index :purchases_variants, :purchase_id
add_index :purchases_variants, :variant_id
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130211200149_create_test_paths_table.rb | Ruby | mit | 8,966 | main | 451 | # frozen_string_literal: true
class CreateTestPathsTable < ActiveRecord::Migration
def change
create_table :test_paths do |t|
t.string :alternative_name
t.integer :ab_test_id
t.timestamps
end
add_index "test_paths", ["ab_test_id", "alternative_name"], name: "index_assignments_on_ab_tes... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20140807201229_create_invites.rb | Ruby | mit | 8,966 | main | 368 | # frozen_string_literal: true
class CreateInvites < ActiveRecord::Migration
def change
create_table :invites do |t|
t.integer :sender_id
t.string :receiver_email
t.integer :receiver_id
t.string :invite_state
t.timestamps
end
add_index :invites, [:sender_id]
add_index :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240830231925_add_stats_to_wishlists.rb | Ruby | mit | 8,966 | main | 450 | # frozen_string_literal: true
class AddStatsToWishlists < ActiveRecord::Migration[7.1]
def change
change_table :wishlists, bulk: true do |t|
t.integer :flags, default: 0, null: false
t.boolean :recommendable, default: false, null: false
t.integer :follower_count, default: 0, null: false
t... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240425095407_remove_rich_content_version_from_links.rb | Ruby | mit | 8,966 | main | 254 | # frozen_string_literal: true
class RemoveRichContentVersionFromLinks < ActiveRecord::Migration[7.1]
def up
remove_column :links, :rich_content_version
end
def down
add_column :links, :rich_content_version, :integer, default: 1
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20130211200402_create_event_test_paths_assignments_table.rb | Ruby | mit | 8,966 | main | 554 | # frozen_string_literal: true
class CreateEventTestPathsAssignmentsTable < ActiveRecord::Migration
def change
create_table :event_test_path_assignments do |t|
t.integer :event_id
t.string :event_name
t.string :active_test_paths
t.timestamps
end
add_index "event_test_path_assignme... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230512132813_remove_unique_index_constraint_from_rich_contents.rb | Ruby | mit | 8,966 | main | 573 | # frozen_string_literal: true
class RemoveUniqueIndexConstraintFromRichContents < ActiveRecord::Migration[7.0]
def up
remove_index :rich_contents, name: "index_rich_contents_on_entity_id_and_entity_type"
add_index :rich_contents, [:entity_id, :entity_type], name: "index_rich_contents_on_entity_id_and_entity_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20240301123339_add_disputed_at_and_dispute_reversed_at_to_charges.rb | Ruby | mit | 8,966 | main | 228 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20121011224111_changed_purchase_state_type.rb | Ruby | mit | 8,966 | main | 220 | # frozen_string_literal: true
class ChangedPurchaseStateType < ActiveRecord::Migration
def change
change_column :events, :purchase_state, :string
change_column_default(:events, :purchase_state, nil)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120928230933_create_visits.rb | Ruby | mit | 8,966 | main | 665 | # frozen_string_literal: true
class CreateVisits < ActiveRecord::Migration
def change
create_table "visits", force: true do |t|
t.string "ip_address"
t.datetime "created_at"
t.string "entry_point"
t.datetime "updated_at"
t.string "fingerprint"
t.integer "user_id"
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20111207011813_add_email_reconfirmable.rb | Ruby | mit | 8,966 | main | 227 | # frozen_string_literal: true
class AddEmailReconfirmable < ActiveRecord::Migration
def up
add_column :users, :unconfirmed_email, :string
end
def down
remove_column :users, :unconfirmed_email, :string
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20191102103149_add_fee_cents_to_refunds.rb | Ruby | mit | 8,966 | main | 206 | # frozen_string_literal: true
class AddFeeCentsToRefunds < ActiveRecord::Migration
def up
add_column :refunds, :fee_cents, :integer
end
def down
remove_column :refunds, :fee_cents
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120816223942_allow_email_to_be_nil.rb | Ruby | mit | 8,966 | main | 237 | # frozen_string_literal: true
class AllowEmailToBeNil < ActiveRecord::Migration
def up
change_column :users, :email, :string, allow_nil: true
end
def down
change_column :users, :email, :string, allow_nil: false
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20120814044454_create_parents_children.rb | Ruby | mit | 8,966 | main | 375 | # frozen_string_literal: true
class CreateParentsChildren < ActiveRecord::Migration
def up
create_table :parents_children, id: false do |t|
t.references :parent
t.references :child
t.timestamps
end
add_index :parents_children, :parent_id
add_index :parents_children, :child_id
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20211008190755_add_selected_flags_to_installment_index.rb | Ruby | mit | 8,966 | main | 300 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20190613024006_add_missing_index_on_purchases.rb | Ruby | mit | 8,966 | main | 264 | # frozen_string_literal: true
class AddMissingIndexOnPurchases < ActiveRecord::Migration
def up
add_index :purchases, [:link_id, :purchase_state, :created_at]
end
def down
remove_index :purchases, [:link_id, :purchase_state, :created_at]
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20230420160357_create_refund_policies.rb | Ruby | mit | 8,966 | main | 359 | # frozen_string_literal: true
class CreateRefundPolicies < ActiveRecord::Migration[7.0]
def change
create_table :refund_policies do |t|
t.references :seller, index: true, null: false
t.references :product, index: { unique: true }, null: false
t.string :title, null: false
t.text :fine_prin... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20210324121415_create_thumbnails.rb | Ruby | mit | 8,966 | main | 301 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20231228165212_create_wishlists.rb | Ruby | mit | 8,966 | main | 271 | # frozen_string_literal: true
class CreateWishlists < ActiveRecord::Migration[7.0]
def change
create_table :wishlists do |t|
t.references :user, null: false
t.string :name, null: false
t.datetime :deleted_at
t.timestamps
end
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | db/migrate/20220110203052_create_legacy_permalinks.rb | Ruby | mit | 8,966 | main | 283 | # frozen_string_literal: true
class CreateLegacyPermalinks < ActiveRecord::Migration[6.1]
def change
create_table :legacy_permalinks do |t|
t.string :permalink, null: false, index: { unique: true }
t.references :product, null: false, index: true
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.