Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old database migrations #3253

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Remove old database migrations #3253

merged 1 commit into from
Sep 18, 2024

Conversation

ChrisBAshton
Copy link
Contributor

There is precedent in removing old migrations, e.g. in alphagov/whitehall#7675 and alphagov/signon#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.

There is precedent in removing old migrations, e.g. in
alphagov/whitehall#7675 and
alphagov/signon#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
```
@ChrisBAshton ChrisBAshton merged commit b6c3db7 into main Sep 18, 2024
12 checks passed
@ChrisBAshton ChrisBAshton deleted the clean-up-db-folder branch September 18, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants