2024-03-21 02:37:21 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CreateAccountRelationshipSeveranceEvents < ActiveRecord::Migration[7.1]
|
|
|
|
def change
|
|
|
|
create_table :account_relationship_severance_events do |t|
|
2024-03-21 03:08:34 +11: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-21 02:37:21 +11:00
|
|
|
|
|
|
|
t.integer :relationships_count, default: 0, null: false
|
|
|
|
|
2024-03-21 03:08:34 +11:00
|
|
|
t.index [:account_id, :relationship_severance_event_id], unique: true
|
|
|
|
|
2024-03-21 02:37:21 +11:00
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|