mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
Domain model sketch
This commit is contained in:
parent
02bfa9f251
commit
b2d8da8857
2 changed files with 53 additions and 0 deletions
25
db/migrate/20250225135843_add_rules.rb
Normal file
25
db/migrate/20250225135843_add_rules.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
class AddRules < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :rules, id: :uuid do |t|
|
||||
t.references :family, null: false, foreign_key: true, type: :uuid
|
||||
|
||||
t.date :effective_date, null: false
|
||||
t.boolean :active, null: false, default: true
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :rule_triggers do |t|
|
||||
t.references :rule, null: false, foreign_key: true, type: :uuid
|
||||
|
||||
t.string :trigger_type, null: false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :rule_actions do |t|
|
||||
t.references :rule, null: false, foreign_key: true, type: :uuid
|
||||
|
||||
t.string :action_type, null: false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
28
db/schema.rb
generated
28
db/schema.rb
generated
|
@ -468,6 +468,31 @@ ActiveRecord::Schema[7.2].define(version: 2025_03_19_212839) do
|
|||
t.index ["outflow_transaction_id"], name: "index_rejected_transfers_on_outflow_transaction_id"
|
||||
end
|
||||
|
||||
create_table "rule_actions", force: :cascade do |t|
|
||||
t.uuid "rule_id", null: false
|
||||
t.string "action_type", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["rule_id"], name: "index_rule_actions_on_rule_id"
|
||||
end
|
||||
|
||||
create_table "rule_triggers", force: :cascade do |t|
|
||||
t.uuid "rule_id", null: false
|
||||
t.string "trigger_type", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["rule_id"], name: "index_rule_triggers_on_rule_id"
|
||||
end
|
||||
|
||||
create_table "rules", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "family_id", null: false
|
||||
t.date "effective_date", null: false
|
||||
t.boolean "active", default: true, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["family_id"], name: "index_rules_on_family_id"
|
||||
end
|
||||
|
||||
create_table "securities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "ticker", null: false
|
||||
t.string "name"
|
||||
|
@ -661,6 +686,9 @@ ActiveRecord::Schema[7.2].define(version: 2025_03_19_212839) do
|
|||
add_foreign_key "plaid_items", "families"
|
||||
add_foreign_key "rejected_transfers", "account_transactions", column: "inflow_transaction_id"
|
||||
add_foreign_key "rejected_transfers", "account_transactions", column: "outflow_transaction_id"
|
||||
add_foreign_key "rule_actions", "rules"
|
||||
add_foreign_key "rule_triggers", "rules"
|
||||
add_foreign_key "rules", "families"
|
||||
add_foreign_key "security_prices", "securities"
|
||||
add_foreign_key "sessions", "impersonation_sessions", column: "active_impersonator_session_id"
|
||||
add_foreign_key "sessions", "users"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue