2024-03-20 15:37:21 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CreateAccountRelationshipSeveranceEvents < ActiveRecord::Migration[7.1]
|
|
|
|
def change
|
|
|
|
create_table :account_relationship_severance_events do |t|
|
2024-03-20 16:08:34 +00:00
|
|
|
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
|
|
|
|
t.belongs_to :relationship_severance_event, foreign_key: { on_delete: :cascade }, null: false
|
2024-03-20 15:37:21 +00:00
|
|
|
|
|
|
|
t.integer :relationships_count, default: 0, null: false
|
|
|
|
|
2024-03-20 16:08:34 +00:00
|
|
|
t.index [:account_id, :relationship_severance_event_id], unique: true
|
|
|
|
|
2024-03-20 15:37:21 +00:00
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|