Skip to content

Add post migration cop to prevent schema additions

Jon Jenkins requested to merge 378637-new-schema-rubocop into master

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR does two things:

  1. Defines a new rubocop migration cop helper to allow us to define an "enforced since" parameter. This allows us to lint old migrations and ignore the cop, but check all migrations going forward.

  2. Adds a new cop to check for schema addition methods in new post migrations.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. git checkout 378637-new-schema-rubocop
  2. Add post deployment migration that uses the add column method
  3. bundle exec rubocop (it should fail)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #378637 (closed)

Merge request reports