feat: implement payout system database schema and models
This commit is contained in:
@@ -52,6 +52,8 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0]
|
||||
# Add onboarding check on user model
|
||||
t.boolean :onboarding_completed, default: false, null: false
|
||||
|
||||
# add_column :users, :stripe_connected_account_id, :string
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
|
||||
16
db/migrate/20250916212717_create_earnings.rb
Normal file
16
db/migrate/20250916212717_create_earnings.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateEarnings < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :earnings do |t|
|
||||
t.integer :amount_cents
|
||||
t.integer :fee_cents
|
||||
t.integer :status
|
||||
t.string :stripe_payout_id
|
||||
|
||||
t.references :event, 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.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
6
db/migrate/20250916215118_add_payout_fields_to_events.rb
Normal file
6
db/migrate/20250916215118_add_payout_fields_to_events.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class AddPayoutFieldsToEvents < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :events, :payout_requested_at, :datetime
|
||||
add_column :events, :payout_status, :integer
|
||||
end
|
||||
end
|
||||
5
db/migrate/20250916215119_add_net_amount_to_earnings.rb
Normal file
5
db/migrate/20250916215119_add_net_amount_to_earnings.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddNetAmountToEarnings < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :earnings, :net_amount_cents, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class AddIndexToStripeConnectedAccountIdOnUsers < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :stripe_connected_account_id_on_users, :stripe_connected_account_id, :string
|
||||
add_index :stripe_connected_account_id_on_users, :stripe_connected_account_id
|
||||
end
|
||||
end
|
||||
11
db/migrate/20250916215130_update_payout_status_on_events.rb
Normal file
11
db/migrate/20250916215130_update_payout_status_on_events.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
Reference in New Issue
Block a user