2025-04-01 20:17:57 -04:00
|
|
|
class CreateRules < ActiveRecord::Migration[7.2]
|
|
|
|
def change
|
|
|
|
create_table :rules, id: :uuid do |t|
|
|
|
|
t.references :family, null: false, foreign_key: true, type: :uuid
|
|
|
|
|
|
|
|
t.string :resource_type, null: false
|
2025-04-02 12:47:07 -04:00
|
|
|
t.date :effective_date
|
2025-04-01 20:17:57 -04:00
|
|
|
t.boolean :active, null: false, default: true
|
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :rule_conditions, id: :uuid do |t|
|
|
|
|
t.references :rule, foreign_key: true, type: :uuid
|
|
|
|
t.references :parent, foreign_key: { to_table: :rule_conditions }, type: :uuid
|
|
|
|
|
|
|
|
t.string :condition_type, null: false
|
|
|
|
t.string :operator, null: false
|
|
|
|
t.string :value
|
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :rule_actions, id: :uuid do |t|
|
|
|
|
t.references :rule, null: false, foreign_key: true, type: :uuid
|
|
|
|
|
|
|
|
t.string :action_type, null: false
|
|
|
|
t.string :value, null: false
|
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|