mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Rework Account to use delegated types
This commit is contained in:
parent
938656de0e
commit
71939d6fb5
36 changed files with 282 additions and 0 deletions
7
db/migrate/20240202191425_create_account_loans.rb
Normal file
7
db/migrate/20240202191425_create_account_loans.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountLoans < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_loans, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
6
db/migrate/20240202191746_add_accountable_to_account.rb
Normal file
6
db/migrate/20240202191746_add_accountable_to_account.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddAccountableToAccount < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :accounts, :accountable_type, :string
|
||||
add_column :accounts, :accountable_id, :uuid
|
||||
end
|
||||
end
|
7
db/migrate/20240202192214_create_account_depositories.rb
Normal file
7
db/migrate/20240202192214_create_account_depositories.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountDepositories < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_depositories, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
7
db/migrate/20240202192231_create_account_credits.rb
Normal file
7
db/migrate/20240202192231_create_account_credits.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountCredits < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_credits, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
7
db/migrate/20240202192238_create_account_investments.rb
Normal file
7
db/migrate/20240202192238_create_account_investments.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountInvestments < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_investments, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
7
db/migrate/20240202192312_create_account_properties.rb
Normal file
7
db/migrate/20240202192312_create_account_properties.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountProperties < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_properties, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
7
db/migrate/20240202192319_create_account_vehicles.rb
Normal file
7
db/migrate/20240202192319_create_account_vehicles.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountVehicles < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_vehicles, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
7
db/migrate/20240202192327_create_account_other_assets.rb
Normal file
7
db/migrate/20240202192327_create_account_other_assets.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountOtherAssets < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_other_assets, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class CreateAccountOtherLiabilities < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :account_other_liabilities, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
43
db/schema.rb
generated
43
db/schema.rb
generated
|
@ -15,6 +15,46 @@ ActiveRecord::Schema[7.2].define(version: 2024_02_02_230325) do
|
|||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "account_credits", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_depositories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_investments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_loans", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_other_assets", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_other_liabilities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_properties", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "account_vehicles", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "accounts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "type"
|
||||
t.string "subtype"
|
||||
|
@ -24,6 +64,9 @@ ActiveRecord::Schema[7.2].define(version: 2024_02_02_230325) do
|
|||
t.string "currency", default: "USD"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "accountable_type"
|
||||
t.uuid "accountable_id"
|
||||
t.index ["accountable_type"], name: "index_accounts_on_accountable_type"
|
||||
t.index ["family_id"], name: "index_accounts_on_family_id"
|
||||
t.index ["type"], name: "index_accounts_on_type"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue