fix: clean up payout migrations, remove ghosts, add defaults and indexes

This commit is contained in:
kbe
2025-09-17 00:02:59 +02:00
parent bc09feafc1
commit d2c43cfc2f
7 changed files with 13 additions and 22 deletions

View File

@@ -63,5 +63,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0]
# add_index :users, :confirmation_token, unique: true # add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true # add_index :users, :unlock_token, unique: true
# add_index :users, :stripe_customer_id # add_index :users, :stripe_customer_id
add_index :users, :stripe_connected_account_id, unique: true
# add_index :stripe_connected_account_id_on_users, :stripe_connected_account_id ?
end end
end end

View File

@@ -22,11 +22,16 @@ class CreateEvents < ActiveRecord::Migration[8.0]
# Allow ticket sell during the event # Allow ticket sell during the event
t.boolean :allow_booking_during_event, default: false, null: false t.boolean :allow_booking_during_event, default: false, null: false
# Payout fields
t.integer :payout_status
t.datetime :payout_requested_at
t.timestamps t.timestamps
end end
add_index :events, :state add_index :events, :state
add_index :events, :featured add_index :events, :featured
add_index :events, [ :latitude, :longitude ] add_index :events, [ :latitude, :longitude ]
add_index :events, :payout_status
end end
end end

View File

@@ -6,6 +6,8 @@ class CreateEarnings < ActiveRecord::Migration[8.0]
t.integer :status t.integer :status
t.string :stripe_payout_id t.string :stripe_payout_id
t.integer :net_amount_cents
t.references :event, null: false, foreign_key: false, index: true t.references :event, null: false, foreign_key: false, index: true
t.references :user, null: false, foreign_key: false, index: true t.references :user, null: false, foreign_key: false, index: true
t.references :order, null: false, foreign_key: false, index: true t.references :order, null: false, foreign_key: false, index: true

View File

@@ -1,5 +0,0 @@
class AddNetAmountToEarnings < ActiveRecord::Migration[8.0]
def change
add_column :earnings, :net_amount_cents, :integer
end
end

View File

@@ -1,6 +0,0 @@
class AddIndexToStripeConnectedAccountIdOnUsers < ActiveRecord::Migration[8.0]
def change
add_index :users, :stripe_connected_account_id, unique: true
add_index :stripe_connected_account_id_on_users, :stripe_connected_account_id
end
end

View File

@@ -1,11 +0,0 @@
class UpdatePayoutStatusOnEvents < ActiveRecord::Migration[8.0]
def up
change_column_default :events, :payout_status, from: nil, to: 0
add_index :events, :payout_status
end
def down
change_column_default :events, :payout_status, from: 0, to: nil
remove_index :events, :payout_status
end
end

View File

@@ -0,0 +1,4 @@
class FixPayoutSystemDefaultsAndIndexes < ActiveRecord::Migration[8.0]
def change
end
end