Add Migration/DropTable rubocop cop
Description of the proposal
This MR introduces a new Rubocop cop that checks that tables get dropped only in post-deployment migrations.
There are still possible ways to execute drop table
in deployment migrations that are not covered by the cop, e.g. execute SQL_FROM_CONSTANT
, execute sql_from_variable
, execute sql_from_method
, etc.
It may be an overkill to cover them, and there are other cops that don't cover these cases, e.g.Migration/AddIndex
.
Closes #25528 (closed)
Check-list
-
Make sure this MR enables a static analysis check rule for new usage but ignores current offenses -
Mention this proposal in the relevant Slack channels (e.g. #development
,#backend
,#frontend
) -
Create a follow-up issue to fix the current offenses as a separate iteration: ISSUE_LINK -
Follow the review process as usual -
Once approved and merged by a maintainer, mention it again: -
In the relevant Slack channels (e.g. #development
,#backend
,#frontend
) -
(Optional depending on the impact of the change) In the Engineering Week in Review
-
Edited by blackst0ne