[1.18.0] SQL warnings on start-up, which can't be fixed by the doctor.
Description
When I start it, some SQL warnings are shown:
Dez 30 06:50:43 gitea[14648]: 2022/12/30 06:50:43 routers/init.go:145:GlobalInitInstalled() [W] Table system_setting Column version db default is , struct default is 1
Dez 30 06:50:43 gitea[14648]: 2022/12/30 06:50:43 routers/init.go:145:GlobalInitInstalled() [W] Table project column board_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
Dez 30 06:50:43 gitea[14648]: 2022/12/30 06:50:43 routers/init.go:145:GlobalInitInstalled() [W] Table project column type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
I have tryed to fix it via:
sudo -u gitea ./gitea -c /etc/gitea/gitea.ini doctor recreate-table project system_setting
But on the next start, the messages are occurs again the the log.
Gitea Version
1.18.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.18.4
Operating System
CentOS7
How are you running Gitea?
Download binary blob from github. Running via systemd as an separate user. DB version: MariaDB-server-10.6.11-1.el7.centos.x86_64
Database
MySQL
Also with sqlite3 the same warning occurs regarding table system_setting:
2023/01/13 09:48:58 ...rfave/cli/command.go:173:Run() [W] Table system_setting Column version db default is , struct default is 1
Same issue, but only with system_settings.
These are bugs in Xorm and can be ignored.
After upgrading to v1.19 problem is still present:
2023/05/18 14:36:28 routers/init.go:148:GlobalInitInstalled() [W] Table system_setting Column version db default is , struct default is 1
2023/05/18 14:36:28 routers/init.go:148:GlobalInitInstalled() [W] Table project column board_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2023/05/18 14:36:28 routers/init.go:148:GlobalInitInstalled() [W] Table project column card_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2023/05/18 14:36:28 routers/init.go:148:GlobalInitInstalled() [W] Table project column type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
These are bugs in Xorm and can be ignored.
Ignoring error messages should be avoided.
It will also affect PostgreSQL. Tested with gitea 1.20.0
On MariaDB I went ahead and fixed most of these warnings
[W] Table system_setting Column version db default is , struct default is 1
[W] Table email_address Column lower_email db nullable is true, struct nullable is false
[W] Table gpg_key Column content db nullable is true, struct nullable is false
[W] Table gpg_key_import Column content db nullable is true, struct nullable is false
[W] Table public_key Column content db nullable is true, struct nullable is false
[W] Table project column board_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
[W] Table project column card_type db type is INT(11), struct type is INT UNSIGNED
[W] Table project Column card_type db default is 0, struct default is
[W] Table project Column card_type db nullable is false, struct nullable is true
[W] Table project column type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
[W] Table hook_task has column repo_id but struct has not related field
manually with these SQL statements
ALTER TABLE system_setting MODIFY COLUMN version INT(11) NULL DEFAULT 1;
ALTER TABLE email_address MODIFY COLUMN lower_email VARCHAR(255) NOT NULL;
ALTER TABLE gpg_key MODIFY COLUMN content MEDIUMTEXT NOT NULL;
ALTER TABLE gpg_key_import MODIFY COLUMN content MEDIUMTEXT NOT NULL;
ALTER TABLE public_key MODIFY COLUMN content MEDIUMTEXT NOT NULL;
ALTER TABLE project MODIFY COLUMN board INT UNSIGNED;
ALTER TABLE project MODIFY COLUMN card_type INT UNSIGNED;
ALTER TABLE project MODIFY COLUMN type INT UNSIGNED;
ALTER TABLE hook_task DROP COLUMN repo_id;
After that, I got these warnings left:
[W] Table project column board_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
[W] Table project column card_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
[W] Table project column type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
Still happening with 1.20.2:
2023/07/30 16:15:44 cmd/web.go:175:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2023/07/30 16:15:44 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db default is 0, struct default is
2023/07/30 16:15:44 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true
Gitea 1.20.2 with PostgreSQL
2023/07/30 17:21:16 cmd/web.go:175:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2023/07/30 17:21:16 cmd/web.go:175:serveInstalled() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE
2023/07/30 17:21:16 cmd/web.go:175:serveInstalled() [W] Table session has column created_unix but struct has not related field
2023/07/30 17:21:16 cmd/web.go:175:serveInstalled() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2023/07/30 17:21:16 cmd/web.go:175:serveInstalled() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2023/07/30 17:21:17 cmd/web.go:175:serveInstalled() [W] Table project column board_type db type is INTEGER, struct type is BIGINT
2023/07/30 17:21:17 cmd/web.go:175:serveInstalled() [W] Table project column card_type db type is INTEGER, struct type is BIGINT
2023/07/30 17:21:17 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db default is 0, struct default is
2023/07/30 17:21:17 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true
2023/07/30 17:21:17 cmd/web.go:175:serveInstalled() [W] Table project column type db type is INTEGER, struct type is BIGINT
2023/07/30 17:21:17 cmd/web.go:175:serveInstalled() [W] Table hook_task has column repo_id but struct has not related field
Also on 1.20.3:
2023/08/21 11:06:42 cmd/web.go:175:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2023/08/21 11:06:42 cmd/web.go:175:serveInstalled() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE
2023/08/21 11:06:42 cmd/web.go:175:serveInstalled() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2023/08/21 11:06:43 cmd/web.go:175:serveInstalled() [W] Table project column card_type db type is INTEGER, struct type is BIGINT
2023/08/21 11:06:43 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db default is 0, struct default is
2023/08/21 11:06:43 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true
2023/08/21 11:06:44 cmd/web.go:175:serveInstalled() [W] Table hook_task has column repo_id but struct has not related field
1.20.4 sqlite3
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table user Column keep_activity_private db default is , struct default is 0
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table user Column keep_activity_private db nullable is true, struct nullable is false
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db default is 0, struct default is
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true
2023/09/08 14:52:39 cmd/web.go:175:serveInstalled() [W] Table hook_task has column repo_id but struct has not related field
[xorm] [warn] 2023/12/22 11:40:13.763410 Table user_info Column version db default is , struct default is 1
The same issue is present in Gitea version 1.21.3 built with GNU Make 4.3, go1.21.5 : bindata, sqlite, sqlite_unlock_notify and SQLite database:
2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table email_address Column lower_email db nullable is true, struct nullable is false 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table user Column keep_activity_private db default is , struct default is 0 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table user Column keep_activity_private db nullable is true, struct nullable is false 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table project Column card_type db default is 0, struct default is 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table tracked_time Column time db nullable is true, struct nullable is false 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table hook_task has column repo_id but struct has not related field 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table webhook Column is_system_webhook db default is 0, struct default is 2024/01/06 12:33:58 cmd/web.go:194:serveInstalled() [W] Table webhook Column is_system_webhook db nullable is false, struct nullable is true
1.21.4 with PostgreSQL
2024/01/17 09:41:13 cmd/web.go:194:serveInstalled() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE
2024/01/17 09:41:14 cmd/web.go:194:serveInstalled() [W] Table session has column created_unix but struct has not related field
2024/01/17 09:41:14 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2024/01/17 09:41:14 cmd/web.go:194:serveInstalled() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2024/01/17 09:41:14 cmd/web.go:194:serveInstalled() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table project column board_type db type is INTEGER, struct type is BIGINT
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table project column card_type db type is INTEGER, struct type is BIGINT
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table project Column card_type db default is 0, struct default is
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table project column type db type is INTEGER, struct type is BIGINT
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table label Column archived_unix db default is , struct default is NULL
2024/01/17 09:41:15 cmd/web.go:194:serveInstalled() [W] Table hook_task has column repo_id but struct has not related field
got same warning info
Gitea 1.22.1, MariaDB 10.11.9, Collation utf8mb4_uca1400_as_cs
- Gitea
1.22.3 - PostgreSQL
16.1
[git@localhost ~]$ gitea doctor recreate-table -c /etc/gitea/app.ini user label system_setting oauth2_application
2024/11/12 16:40:09 [email protected]/command.go:269:Run() [I] PING DATABASE postgres
2024/11/12 16:40:10 ...igrations/base/db.go:39:func2() [I] Recreating Table: user for Bean: User
2024/11/12 16:40:10 ...igrations/base/db.go:39:func2() [I] Recreating Table: label for Bean: Label
2024/11/12 16:40:11 ...igrations/base/db.go:39:func2() [I] Recreating Table: system_setting for Bean: Setting
2024/11/12 16:40:11 ...igrations/base/db.go:39:func2() [I] Recreating Table: oauth2_application for Bean: OAuth2Application
2024/11/12 16:40:11 [email protected]/command.go:269:Run() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE
2024/11/12 16:40:11 [email protected]/command.go:269:Run() [W] Table system_setting Column version db default is , struct default is 1
2024/11/12 16:40:11 [email protected]/command.go:269:Run() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2024/11/12 16:40:11 [email protected]/command.go:269:Run() [W] Table label Column archived_unix db default is , struct default is NULL
Same issue with version 1.24.3 and Postgres:
2025/07/25 19:16:42 routers/common/db.go:24:InitDBEngine() [I] Beginning ORM engine initialization.
2025/07/25 19:16:42 routers/common/db.go:31:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2025/07/25 19:16:42 cmd/web.go:207:serveInstalled() [I] PING DATABASE postgres
2025/07/25 19:16:42 cmd/web.go:207:serveInstalled() [W] Table oauth2_application Column confidential_client db default is true, struct default is TRUE
2025/07/25 19:16:42 cmd/web.go:207:serveInstalled() [W] Table oauth2_application Column skip_secondary_authorization db default is false, struct default is FALSE
2025/07/25 19:16:42 cmd/web.go:207:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2025/07/25 19:16:42 cmd/web.go:207:serveInstalled() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2025/07/25 19:16:42 cmd/web.go:207:serveInstalled() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2025/07/25 19:16:43 cmd/web.go:207:serveInstalled() [W] Table project column card_type db type is INTEGER, struct type is BIGINT
2025/07/25 19:16:43 cmd/web.go:207:serveInstalled() [W] Table project Column card_type db default is 0, struct default is
2025/07/25 19:16:43 cmd/web.go:207:serveInstalled() [W] Table project Column card_type db nullable is false, struct nullable is true
2025/07/25 19:16:43 cmd/web.go:207:serveInstalled() [W] Table label Column archived_unix db default is , struct default is NULL
2025/07/25 19:16:43 routers/init.go:145:InitWebInstalled() [I] ORM engine initialization successful!