[2.x] fix: restore 1.x migration filenames so 1.x upgrades don't re-run them - #137
Merged
Merged
Conversation
Two migrations were renamed during the 2.0 refactor:
2026_04_17_000000_alter_polls_add_draft_columns.php
-> 2026_05_18_000000_alter_polls_add_draft_columns.php
2023_07_14_000002_delete_extra_polls_columns.php.disabled
-> 2026_04_15_000000_delete_extra_polls_columns.php
Flarum tracks applied migrations by filename, so sites upgrading from
1.x had no record of the new names and re-ran migrations whose changes
were already applied, failing with:
SQLSTATE[42S21]: Column already exists: 1060
Duplicate column name 'published_at'
Restore both files to their 1.x filenames so previously-applied
migrations are correctly skipped, and guard every step (column adds,
drops, and the index) with hasColumn()/hasIndex() checks in both
directions. The guards cover installs that already ran the migrations
under the 2.x filenames, and repair partially-applied states.
delete_extra_polls_columns no longer uses Migration::dropColumns(),
whose generated up/down are unguarded; it is now written out longhand
with the same column definitions preserved for rollback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two migrations were renamed in the 2.0 refactor, so 1.x sites had no record of the new filenames and re-ran already-applied changes, failing with
Duplicate column name 'published_at'. Restores both 1.x filenames and guards every step withhasColumn()/hasIndex()in both directions.