Commit graph

15 commits

Author SHA1 Message Date
Rémy Coutable
a2d39b8010 Use gitlab-styles
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-12-22 08:34:44 -06:00
Sean McGivern
1ab33b15d1 Add cop for use of remove_column
remove_column should only be used in the up (or change) step of a migration if
it's a post-deployment migration. Otherwise there will be downtime due to the
ActiveRecord column cache, which we can avoid by using the IgnorableColumn
concern in combination with a post-deployment migration.
2017-12-11 16:34:51 +00:00
Sean McGivern
d8be981466 Prevent update_column_in_batches on large tables
add_column_with_default is implemented in terms of update_column_in_batches, but
update_column_in_batches can be used independently. Neither of these should be
used on the specified large tables, because they will cause issues on large
instances like GitLab.com.

This also ignores the cop for all existing migrations, renaming
AddColumnWithDefaultToLargeTable where appropriate.
2017-11-17 16:56:50 +00:00
Sean McGivern
a560291f14 Also warn on timestamp in datetime migration cop
The types `timestamp` and `datetime` are aliases:
https://github.com/rails/rails/blob/v4.2.10/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L362-L364
2017-10-10 10:36:10 +01:00
Michael Kozono
9beef18487 Add SaferBooleanColumn cop 2017-08-14 07:57:57 -07:00
Yorick Peterse
a004f9ec8c
Added cop to blacklist the use of hash indexes
These indexes are not recorded in the WAL (at least until PostgreSQL
10) and this isn't worth the minor performance improvement over btree
indexes.
2017-07-14 13:19:00 +02:00
Grzegorz Bizon
0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
blackst0ne
bc00806a4e Add database helpers 'add_timestamps_with_timezone' and 'timestamps_with_timezone' 2017-06-13 22:44:13 +11:00
Rémy Coutable
187e6c8d7c New Migration/UpdateColumnInBatches cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-05-29 11:28:23 +02:00
Robert Speicher
b9fa17d87b Add AddColumnWithDefaultToLargeTable cop 2017-04-28 15:55:55 -05:00
Robert Speicher
9c27c90b4a Rename AddColumnWithDefault to ReversibleAddColumnWithDefault
We're going to add another cop that deals with another aspect of
`add_column_with_default`, so we need to separate them.
2017-04-28 15:55:53 -05:00
blackst0ne
9997c58fc0 Add remove_concurrent_index to database helper 2017-04-06 09:53:57 +11:00
Douwe Maan
5d9762b3b5 Add cop to ensure reversibility of add_concurrent_index 2017-03-07 10:09:01 -06:00
Yorick Peterse
766060bcdf
Enforce use of add_concurrent_foreign_key
This adds a Rubocop rule to enforce the use of
add_concurrent_foreign_key instead of the regular add_foreign_key
method. This cop has been disabled for existing migrations so we don't
need to change those.
2017-02-10 21:51:09 +01:00
Douwe Maan
abc9548f8a Add cop that checks if add_column_with_default is used with up/down methods 2017-02-08 16:47:48 -06:00