Gitea: Gitea fails to start: Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1

Created on 9 Jan 2019  ·  13Comments  ·  Source: go-gitea/gitea

2019/01/09 16:43:38 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:39 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:39 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:40 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:40 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1

Description

Using the latest gitea version fails to start. Likely due to changes not being made to the database.

Screenshots

kinbug

Most helpful comment

Note to self --- Always Test on 5.X and 8.X

All 13 comments

Ping @adelowo

Taking a look at this right now.

@wyattoday what version of MySQL are you running? I cannot replicate this on 5.7.20? And is this a fresh database or a previously used one?

MySQL 8.0.13, upgrading from the gitea commit previous to the “theme commit” to a commit after the “theme commit”

Thanks for the heads up

Having the same issue with the latest docker container - updated by watchtower (so also a previously used one). Running against 10.3.7-MariaDB. It's a previously used db

Sorry folks, I'm getting to my computer in a few minutes and will pull down an 8.X MySQL image to test and submit a patch.

I've found a workaround to get my container up and running. The theme entries of all users inside the db had NULL value. Updating that value to gitea (as default) fixed it for me. I guess the migration alters the column to NOT NULL without respecting existing data?

Yeah, I believe that is the fix, but I want to test on a 8.X Mysql DB before doing anything. Downloading the docker image right now

I didn't want to set gitea as the default so as not to interfere with the value of DEFAULT_THEME if set

https://github.com/go-gitea/gitea/blob/31aa00fa4b6a5e77b5bd4d29628860ff88eb4029/models/user.go#L170-L175

Note to self --- Always Test on 5.X and 8.X

Same for me. Setting the default theme to "gitea" for all users works.

@securitaas What commit are you running? This was fixed in
https://github.com/go-gitea/gitea/pull/5682

Hi, I have the some problem when trying to update from 1.7.1 to 1.8.3
Database is mysql 8.0.12

The latest entry on log is
[...itea/routers/init.go:84 GlobalInit()] [E] ORM engine initialization failed: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1

Was this page helpful?
0 / 5 - 0 ratings