gitea icon indicating copy to clipboard operation
gitea copied to clipboard

[1.18.0] SQL warnings on start-up, which can't be fixed by the doctor.

Open tuxmaster5000 opened this issue 2 years ago • 15 comments

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

tuxmaster5000 avatar Dec 30 '22 05:12 tuxmaster5000

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

hbokh avatar Jan 13 '23 08:01 hbokh

Same issue, but only with system_settings.

tacerus avatar Feb 06 '23 22:02 tacerus

These are bugs in Xorm and can be ignored.

zeripath avatar Feb 07 '23 12:02 zeripath

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.

pboguslawski avatar May 18 '23 12:05 pboguslawski

It will also affect PostgreSQL. Tested with gitea 1.20.0

tuxmaster5000 avatar Jul 19 '23 04:07 tuxmaster5000

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

coderkun avatar Jul 19 '23 07:07 coderkun

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

markshep avatar Jul 30 '23 15:07 markshep

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

somera avatar Jul 30 '23 15:07 somera

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

johansmitsnl avatar Aug 21 '23 09:08 johansmitsnl

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

Leontyev1003 avatar Sep 08 '23 10:09 Leontyev1003

[xorm] [warn] 2023/12/22 11:40:13.763410 Table user_info Column version db default is , struct default is 1

gaojs avatar Dec 22 '23 03:12 gaojs

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

0x6d61726b avatar Jan 06 '24 11:01 0x6d61726b

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

somera avatar Jan 17 '24 08:01 somera

image got same warning info

yp05327 avatar Apr 10 '24 04:04 yp05327

image

Gitea 1.22.1, MariaDB 10.11.9, Collation utf8mb4_uca1400_as_cs

foretix avatar Aug 23 '24 16:08 foretix

  • 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

Android-KitKat avatar Nov 12 '24 08:11 Android-KitKat

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!

jleroy avatar Jul 25 '25 19:07 jleroy