Upgrading docker image from 1.9.6 to 1.10: gitea fails to start - database error #6484

Closed
opened 2025-11-02 06:57:22 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @mfigrs on GitHub (Dec 8, 2020).

  • Gitea version (or commit ref): 1.9.6 -> 1.10
  • Git version: 2.22.2
  • Operating system: docker gitea/gitea:1.10
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:

Description

I am trying to update gitea from 1.9.6 to 1.10. Docker container starts, however I am not able to access any page.

Troubleshooting steps taken:

  1. I deleted the 'app.ini' from conf folder and opened the web page again. I was able to see the main screen and the installation screen.
  2. On the install screen I left all entries at default except 'SSH domain' and 'gitea URL' which I updated to match my config.
  3. After clicking "install gitea" I get an empty page error. Container log is filled with several hundred of messages about database problems, and gitea.log is filled with blocks like: "
    2020/12/08 15:00:57 ...dules/setting/log.go:273:newLogService() [I] Gitea Log Mode: File(File:info)
    2020/12/08 15:00:57 ...les/setting/cache.go:45:newCacheService() [I] Cache Service Enabled
    2020/12/08 15:00:57 ...s/setting/session.go:44:newSessionService() [I] Session Service Enabled
    2020/12/08 15:00:57 routers/init.go:51:initDBEngine() [I] Beginning ORM engine initialization.
    2020/12/08 15:00:57 routers/init.go:53:initDBEngine() [I] ORM engine initialization attempt #1/10...
    2020/12/08 15:00:57 ...-xorm/xorm/engine.go:330:Ping() [I] PING DATABASE sqlite3
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? []interface {}{"version"} - took: 46.087µs
    2020/12/08 15:00:57 ...m/dialect_sqlite3.go:260:IsColumnExist() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%id%') or (sql like '%[id]%')) [version]
    2020/12/08 15:00:57 ...m/dialect_sqlite3.go:260:IsColumnExist() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%version%') or (sql like '%[version]%')) [version]
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT id, version FROM version WHERE id=? LIMIT 1 []interface {}{1} - took: 21.261µs
    2020/12/08 15:00:57 ...ations/migrations.go:300:Migrate() [I] Migration[102]: update migration repositories' service type
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_list(pull_request) - took: 13.759µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(IDX_pull_request_merged_unix) - took: 14.361µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(IDX_pull_request_merger_id) - took: 9.169µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(IDX_pull_request_has_merged) - took: 9.842µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(IDX_pull_request_base_repo_id) - took: 15.084µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(IDX_pull_request_head_repo_id) - took: 10.079µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(IDX_pull_request_issue_id) - took: 9.333µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT sql FROM sqlite_master WHERE tbl_name='pull_request' and type='table' - took: 30.395µs
    2020/12/08 15:00:57 .../xorm/session_raw.go:194:exec() [I] [SQL] CREATE TABLE new_pull_request_new (id INTEGER PRIMARY KEY AUTOINCREMENT, type INT NULL, status INT NULL, issue_id BIGINT(20) NULL, index BIGINT(20) NULL, head_repo_id BIGINT(20) NULL, base_repo_id BIGINT(20) NULL, NULL, head_branch VARCHAR(255) NULL, base_branch VARCHAR(255) NULL, merge_base VARCHAR(40) NULL, has_merged TINYINT(1) NULL, merged_commit_id VARCHAR(40) NULL, merger_id BIGINT(20) NULL, merged_unix BIGINT(20) NULL, conflicted_files TEXT NULL) - took: 27.895µs
    2020/12/08 15:00:57 routers/init.go:59:initDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: near "NULL": syntax error
    2020/12/08 15:00:57 routers/init.go:60:initDBEngine() [I] Backing off for 3 seconds
    "
  4. If I delete the app.ini again and give a new name to the db file in installation, gitea starts OK, but obviously with all of my data gone.

To me this means that there is a problem migrating the DB between 1.9.6 and 1.10 versions. Please help.

Screenshots

Originally created by @mfigrs on GitHub (Dec 8, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.6 -> 1.10 - Git version: 2.22.2 - Operating system: docker gitea/gitea:1.10 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ## Description I am trying to update gitea from 1.9.6 to 1.10. Docker container starts, however I am not able to access any page. *Troubleshooting steps taken:* 1. I deleted the 'app.ini' from conf folder and opened the web page again. I was able to see the main screen and the installation screen. 2. On the install screen I left all entries at default except 'SSH domain' and 'gitea URL' which I updated to match my config. 3. After clicking "install gitea" I get an empty page error. Container log is filled with several hundred of messages about database problems, and gitea.log is filled with blocks like: " 2020/12/08 15:00:57 ...dules/setting/log.go:273:newLogService() [I] Gitea Log Mode: File(File:info) 2020/12/08 15:00:57 ...les/setting/cache.go:45:newCacheService() [I] Cache Service Enabled 2020/12/08 15:00:57 ...s/setting/session.go:44:newSessionService() [I] Session Service Enabled 2020/12/08 15:00:57 routers/init.go:51:initDBEngine() [I] Beginning ORM engine initialization. 2020/12/08 15:00:57 routers/init.go:53:initDBEngine() [I] ORM engine initialization attempt #1/10... 2020/12/08 15:00:57 ...-xorm/xorm/engine.go:330:Ping() [I] PING DATABASE sqlite3 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? []interface {}{"version"} - took: 46.087µs 2020/12/08 15:00:57 ...m/dialect_sqlite3.go:260:IsColumnExist() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%`id`%') or (sql like '%[id]%')) [version] 2020/12/08 15:00:57 ...m/dialect_sqlite3.go:260:IsColumnExist() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%`version`%') or (sql like '%[version]%')) [version] 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1} - took: 21.261µs 2020/12/08 15:00:57 ...ations/migrations.go:300:Migrate() [I] Migration[102]: update migration repositories' service type 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_list(`pull_request`) - took: 13.759µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(`IDX_pull_request_merged_unix`) - took: 14.361µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(`IDX_pull_request_merger_id`) - took: 9.169µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(`IDX_pull_request_has_merged`) - took: 9.842µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(`IDX_pull_request_base_repo_id`) - took: 15.084µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(`IDX_pull_request_head_repo_id`) - took: 10.079µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] PRAGMA index_info(`IDX_pull_request_issue_id`) - took: 9.333µs 2020/12/08 15:00:57 .../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT sql FROM sqlite_master WHERE tbl_name='pull_request' and type='table' - took: 30.395µs 2020/12/08 15:00:57 .../xorm/session_raw.go:194:exec() [I] [SQL] CREATE TABLE `new_pull_request_new` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `type` INT NULL, `status` INT NULL, `issue_id` BIGINT(20) NULL, `index` BIGINT(20) NULL, `head_repo_id` BIGINT(20) NULL, `base_repo_id` BIGINT(20) NULL, NULL, `head_branch` VARCHAR(255) NULL, `base_branch` VARCHAR(255) NULL, `merge_base` VARCHAR(40) NULL, `has_merged` TINYINT(1) NULL, `merged_commit_id` VARCHAR(40) NULL, `merger_id` BIGINT(20) NULL, `merged_unix` BIGINT(20) NULL, `conflicted_files` TEXT NULL) - took: 27.895µs 2020/12/08 15:00:57 routers/init.go:59:initDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: near "NULL": syntax error 2020/12/08 15:00:57 routers/init.go:60:initDBEngine() [I] Backing off for 3 seconds " 4. If I delete the app.ini again and give a new name to the db file in installation, gitea starts OK, but obviously with all of my data gone. To me this means that there is a problem migrating the DB between 1.9.6 and 1.10 versions. Please help. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
Author
Owner

@techknowlogick commented on GitHub (Dec 9, 2020):

By deleting your app.ini in step 1 your are telling gitea to attempt to install over an existing installation, rather than to attempt an upgrade. To upgrade it is a matter of taking a backup, and then swapping out the binary (in the case of docker it would be to change the docker image).

I am going to close this, but if your upgrade fails again (hopefully you have backups prior to the upgrade) then please start a thread in our discourse forum https://discourse.gitea.io/, or hop into chat https://discord.gg/Gitea

@techknowlogick commented on GitHub (Dec 9, 2020): By deleting your app.ini in step 1 your are telling gitea to attempt to install over an existing installation, rather than to attempt an upgrade. To upgrade it is a matter of taking a backup, and then swapping out the binary (in the case of docker it would be to change the docker image). I am going to close this, but if your upgrade fails again (hopefully you have backups prior to the upgrade) then please start a thread in our discourse forum https://discourse.gitea.io/, or hop into chat https://discord.gg/Gitea
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6484