models/protect_branch: fix whitelist with invalid 'protect_branch_id' (#4333)

If user creates a protect branch for the first time (which has ID=0),
it generates invalid whitelist records with 'protect_branch_id=0'.
This prevents future updates of protect branch whitelist.

Migration: remove existing invalid protect branch whitelist records.
This commit is contained in:
Unknwon
2017-03-27 13:13:04 -04:00
parent 73de9f9d6a
commit 1038916460
6 changed files with 26 additions and 9 deletions

View File

@@ -62,6 +62,8 @@ var migrations = []Migration{
NewMigration("generate and migrate Git hooks", generateAndMigrateGitHooks),
// v15 -> v16:v0.10.16
NewMigration("update repository sizes", updateRepositorySizes),
// v16 -> v17:v0.10.31
NewMigration("remove invalid protect branch whitelist", removeInvalidProtectBranchWhitelist),
}
// Migrate database to current version