]> git.openstreetmap.org Git - rails.git/commitdiff
Disable Rails/BulkChangeTable cop
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 19 Jun 2024 16:44:20 +0000 (17:44 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 19 Jun 2024 16:44:20 +0000 (17:44 +0100)
If you have multiple alter commands in a migration (like adding two
columns to an existing table) this cop will suggest combining them using
`change_table :foo, :bulk => true`.

However, Strong Migrations can't inspect `change_table` blocks, and
therefore suggests using `safety_assured`, which mostly defeats the
purpose of using strong_migrations in the first place.

Instead, we should stick with the individual alter commands. Since
postgres runs DDL changes in a transaction anyway, there is not enough
benefit from the `change_table` approach to be worth losing the
safety net of the Strong Migrations checks.

.rubocop.yml

index 1e18afd83581ba0fc47d728032b3ade65f091b1a..c0f0c1fa08053ec082a77ae9cd8e6e3d0facb874 100644 (file)
@@ -45,6 +45,10 @@ Naming/FileName:
 Naming/MethodParameterName:
   Enabled: false
 
 Naming/MethodParameterName:
   Enabled: false
 
+# This conflicts with Strong Migrations, which can't check `change_table`
+Rails/BulkChangeTable:
+  Enabled: false
+
 Rails/CreateTableWithTimestamps:
   Enabled: false
 
 Rails/CreateTableWithTimestamps:
   Enabled: false