-
- Notifications
You must be signed in to change notification settings - Fork 6.2k
Description
- Gitea version (or commit ref): 1.3.1+1-g8a19c6b9
- Operating system: Ubuntu 16.04
- Database (use
[x]
):- PostgreSQL
- Can you reproduce the bug at https://try.gitea.io:
- Not relevant
Description
I think I have discovered a serious migrations bug when upgrading from version 1.2.3 to version 1.3.1 today. It seems that several migrations were backported to the 1.2 branch out of order. Our Gitea installation had a database version of 42 before the upgrade and was upgraded to version 49. However, due to the ordering of the migrations, three of them were applied twice and three were not applied at all.
I becomes clearer if looking at the diff of models/migrations/migrations.go
from the 1.2 to the 1.3 branch:
@@ -126,12 +126,26 @@ var migrations = []Migration{ NewMigration("unescape user full names", unescapeUserFullNames), // v38 -> v39 NewMigration("remove commits and settings unit types", removeCommitsUnitType), - // v43 -> v44 - NewMigration("fix protected branch can push value to false", fixProtectedBranchCanPushValue), + // v39 -> v40 + NewMigration("adds time tracking and stopwatches", addTimetracking), + // v40 -> v41 + NewMigration("migrate protected branch struct", migrateProtectedBranchStruct), + // v41 -> v42 + NewMigration("add default value to user prohibit_login", addDefaultValueToUserProhibitLogin), // v42 -> v43 NewMigration("add tags to releases and sync existing repositories", releaseAddColumnIsTagAndSyncTags), + // v43 -> v44 + NewMigration("fix protected branch can push value to false", fixProtectedBranchCanPushValue), // v44 -> v45 NewMigration("remove duplicate unit types", removeDuplicateUnitTypes), + // v45 -> v46 + NewMigration("remove index column from repo_unit table", removeIndexColumnFromRepoUnitTable), + // v46 -> v47 + NewMigration("remove organization watch repositories", removeOrganizationWatchRepo), + // v47 -> v48 + NewMigration("add deleted branches", addDeletedBranch), + // v48 -> v49 + NewMigration("add repo indexer status", addRepoIndexerStatus), } // Migrate database to current version
As can be seen, v43, v42 and v44 were applied (in that order) in the 1.2 branch (but with database versions of 40, 41 and 42). v39, v40 and v41 were then added before the existing migrations in the 1.3 branch. This led to v39, v40 and v41 being skipped, while v42, v43 and v44 have been applied a second time:
2017/12/11 16:13:30 [I] Migration: add tags to releases and sync existing repositories 2017/12/11 16:13:30 [I] Migration: fix protected branch can push value to false 2017/12/11 16:13:31 [I] Migration: remove duplicate unit types 2017/12/11 16:13:31 [I] Migration: remove index column from repo_unit table 2017/12/11 16:13:31 [I] Migration: remove organization watch repositories 2017/12/11 16:13:31 [I] Migration: add deleted branches 2017/12/11 16:13:31 [I] Migration: add repo indexer status