alphagov / content-publisher

Publishing application for GOV.UK
https://docs.publishing.service.gov.uk/apps/content-publisher.html
MIT License
33 stars 11 forks source link

Remove old database migrations #3253

Closed ChrisBAshton closed 1 week ago

ChrisBAshton commented 1 week ago

There is precedent in removing old migrations, e.g. in https://github.com/alphagov/whitehall/pull/7675 and https://github.com/alphagov/signon/pull/2217

Keeping migrations around makes it harder to grep, and to apply changes en-masse (such as linting updates). #3198 is currently failing because of a single lint failure in one of these migration files:

Offenses:

db/migrate/20200206153428_remove_null_constraints_from_whitehall_migrations.rb:3:5: C: Rails/BulkChangeTable: You can use change_table :whitehall_migrations, bulk: true to combine alter queries. (https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-change_table, https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html)
    change_column_null :whitehall_migrations, :document_type, true
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

603 files inspected, 1 offense detected

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.