Fix account_relationship_severance_events unique indexes (#29665)

This commit is contained in:
Claire 2024-03-20 17:08:34 +01:00 committed by GitHub
parent 99c9db5f67
commit d4449cc682
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,7 @@
# id :bigint(8) not null, primary key
# account_id :bigint(8) not null
# relationship_severance_event_id :bigint(8) not null
# relationships_count :integer default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
#

View File

@ -3,11 +3,13 @@
class CreateAccountRelationshipSeveranceEvents < ActiveRecord::Migration[7.1]
def change
create_table :account_relationship_severance_events do |t|
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false, index: { unique: true }
t.belongs_to :relationship_severance_event, foreign_key: { on_delete: :cascade }, null: false, index: { unique: true }
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
t.belongs_to :relationship_severance_event, foreign_key: { on_delete: :cascade }, null: false
t.integer :relationships_count, default: 0, null: false
t.index [:account_id, :relationship_severance_event_id], unique: true
t.timestamps
end
end

View File

@ -96,8 +96,9 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_20_140159) do
t.integer "relationships_count", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_account_relationship_severance_events_on_account_id", unique: true
t.index ["relationship_severance_event_id"], name: "idx_on_relationship_severance_event_id_403f53e707", unique: true
t.index ["account_id", "relationship_severance_event_id"], name: "idx_on_account_id_relationship_severance_event_id_7bd82bf20e", unique: true
t.index ["account_id"], name: "index_account_relationship_severance_events_on_account_id"
t.index ["relationship_severance_event_id"], name: "idx_on_relationship_severance_event_id_403f53e707"
end
create_table "account_stats", force: :cascade do |t|