Rubocop: Disallow add_reference within transaction

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Calling add_reference translates to (for example):

ALTER TABLE "identities" ADD "saml_provider_id" integer;
CREATE  INDEX  "index_identities_on_saml_provider_id" ON "identities"  ("saml_provider_id" );
ALTER TABLE "identities" ADD CONSTRAINT "fk_rails_aade90f0fc"
FOREIGN KEY ("saml_provider_id")
  REFERENCES "saml_providers" ("id")
 ON DELETE CASCADE;```

Rubocop should catch this and force us to split this into two migrations: One to add the column and a second one to create the index and foreign key using the concurrent migration helpers.
Edited Sep 13, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading