Skip to content

Migration issues from 1.14.4 to 1.15.0 on task table #16828

@anderson-dev

Description

@anderson-dev

Unfortunately, I mistakenly deployed my team's instance of Gitea using the 'latest' tag of the official Gitea docker image around 3-4 months ago (I believe it was around version 1.14.2 at that time) thinking it was the latest stable release rather than an unstable dev version. I upgraded to the stable gitea/gitea:1.14.4 about 2 months ago. It required me to force migrate the underlying sqlite db in order for it to take. My hope was that some of the extra fields it added, but didn't use yet, would simply be used properly upon upgrade to the next release version. Yesterday I backed up my volume and attempted to upgrade to 1.15.0 but it failed during db migration.

What is the simplest way to ensure I'm back to the correct db schema version? Should I just blast away the volume, start with a fresh install, re-configure, and re-push all local repos to the new installation?

  • Gitea version (or commit ref): 1.14.4 -> 1.15.0
  • Git version:
  • Operating system: official docker image
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
1.14.4 (Current warnings relating to current db schema)

2021/08/26 12:26:49 routers/init.go:150:GlobalInit() [I] SQLite3 Supported
2021/08/26 12:26:49 routers/init.go:68:initDBEngine() [I] Beginning ORM engine initialization.
2021/08/26 12:26:49 routers/init.go:75:initDBEngine() [I] ORM engine initialization attempt #1/10...
2021/08/26 12:26:49 ...om/urfave/cli/app.go:524:HandleAction() [I] PING DATABASE sqlite3
2021/08/26 12:26:49 ...rfave/cli/command.go:173:Run() [W] Table mirror has column lfs_enabled but struct has not related field
2021/08/26 12:26:49 ...rfave/cli/command.go:173:Run() [W] Table mirror has column lfs_endpoint but struct has not related field
2021/08/26 12:26:49 ...rfave/cli/command.go:173:Run() [W] Table email_address has column lower_email but struct has not related field
2021/08/26 12:26:49 ...rfave/cli/command.go:173:Run() [W] Table email_address has column is_primary but struct has not related field
2021/08/26 12:26:49 ...rfave/cli/command.go:173:Run() [W] Table task has column message but struct has not related field
2021/08/26 12:26:49 routers/init.go:155:GlobalInit() [I] ORM engine initialization successful!
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: update_mirrors
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: repo_health_check
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: check_repo_stats
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: archive_cleanup
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: sync_external_users
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: deleted_branches_cleanup
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: update_migration_poster_id
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: cleanup_hook_task_table
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: delete_inactive_accounts
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: delete_repo_archives
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: git_gc_repos
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: resync_all_sshkeys
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: resync_all_sshprincipals
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: resync_all_hooks
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: reinit_missing_repos
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: delete_missing_repos
2021/08/26 12:26:49 ...odules/cron/tasks.go:120:RegisterTask() [D] Registering task: delete_generated_repository_avatars
2021/08/26 12:26:49 ...er/issues/indexer.go:142:func2() [I] PID 18: Initializing Issue Indexer: db
2021/08/26 12:26:49 ...er/issues/indexer.go:221:func3() [I] Issue Indexer Initialization took 22.5µs
2021/08/26 12:26:49 ...xer/stats/indexer.go:38:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2021/08/26 12:26:49 ...ueue_disk_channel.go:162:Run() [D] PersistableChannelUniqueQueue: repo_stats_update Starting
2021/08/26 12:26:49 ...ue/queue_bytefifo.go:96:Run() [D] unique-level: repo_stats_update-level Starting
2021/08/26 12:26:49 ...xer/stats/indexer.go:84:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2021/08/26 12:26:49 ...ueue_disk_channel.go:162:Run() [D] PersistableChannelUniqueQueue: pr_patch_checker Starting
2021/08/26 12:26:49 ...ue/queue_bytefifo.go:96:Run() [D] unique-level: pr_patch_checker-level Starting
2021/08/26 12:26:50 ...ueue_disk_channel.go:137:Run() [D] PersistableChannelQueue: task Starting
2021/08/26 12:26:50 ...ue/queue_bytefifo.go:96:Run() [D] level: task-level Starting
2021/08/26 12:26:50 cmd/web.go:189:listen() [I] Listen: http://0.0.0.0:3000
2021/08/26 12:26:50 cmd/web.go:192:listen() [I] LFS server enabled
2021/08/26 12:26:50 ...s/graceful/server.go:62:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 18
2021/08/26 12:26:50 ...s/graceful/server.go:75:func1() [D] Starting server on tcp:0.0.0.0:3000 (PID: 18)



1.15.0 (Errors seen during attempted migration from 1.14.4 w/ schema discrepancies)

2021/08/26 11:57:38 routers/init.go:93:GlobalInit() [I] SQLite3 Supported
2021/08/26 11:57:38 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization.
2021/08/26 11:57:38 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2021/08/26 11:57:38 ...om/urfave/cli/app.go:524:HandleAction() [I] PING DATABASE sqlite3
2021/08/26 11:57:38 ...ations/migrations.go:419:Migrate() [I] Migration[178]: Add LFS columns to Mirror
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table mirror has column id but struct has not related field
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table mirror has column repo_id but struct has not related field
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table mirror has column interval but struct has not related field
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table mirror has column enable_prune but struct has not related field
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table mirror has column updated_unix but struct has not related field
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table mirror has column next_update_unix but struct has not related field
2021/08/26 11:57:38 ...ations/migrations.go:419:Migrate() [I] Migration[179]: Convert avatar url to text
2021/08/26 11:57:38 ...ations/migrations.go:419:Migrate() [I] Migration[180]: Delete credentials from past migrations
2021/08/26 11:57:38 ...ations/migrations.go:419:Migrate() [I] Migration[181]: Always save primary email on email address table
2021/08/26 11:57:38 routers/common/db.go:28:InitDBEngine() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2021/08/26 11:57:40 ...ations/migrations.go:419:Migrate() [I] Migration[182]: Add issue resource index table
2021/08/26 11:57:40 ...ations/migrations.go:419:Migrate() [I] Migration[183]: Create PushMirror table
2021/08/26 11:57:40 ...ations/migrations.go:419:Migrate() [I] Migration[184]: Rename Task errors to message
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column id but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column doer_id but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column owner_id but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column repo_id but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column start_time but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column end_time but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column payload_content but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column message but struct has not related field
2021/08/26 11:57:40 routers/init.go:97:GlobalInit() [W] Table task has column created but struct has not related field
2021/08/26 11:57:40 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: error in table task after rename: duplicate column name: message

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detail

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions