Improve SchemaAdditionMethodsNoPost cop
What does this MR do and why?
Following up !102810 (merged).
This MR improves our SchemaAdditionMethodsNoPost
cop to allow using some methods when rolling back the migration.
This will avoid disabling the cop every time as we are currently doing.
Before
➜ gitlab git:(morefice/improve-schema-addition-methods-no-post-cop) ✗ bundle exec rubocop db/post_migrate/20230518121320_remove_time_format_in_24h_column.rb
Inspecting 1 file
C
Offenses:
db/post_migrate/20230518121320_remove_time_format_in_24h_column.rb:11:5: C: Migration/SchemaAdditionMethodsNoPost: This method may not be used in post migrations. Please see documentation here: https://docs.gitlab.com/ee/development/migration_style_guide.html#choose-an-appropriate-migration-type
add_column :user_preferences, :time_format_in_24h, :boolean
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 file inspected, 1 offense detected
After
➜ gitlab git:(morefice/improve-schema-addition-methods-no-post-cop) ✗ bundle exec rubocop db/post_migrate/20230518121320_remove_time_format_in_24h_column.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Max Orefice