New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wyattoday opened this Issue Jan 9, 2019 · 12 comments

Comments

5 participants
@wyattoday
Copy link

wyattoday commented Jan 9, 2019

  • Gitea version (or commit ref): dd13327
  • Git version: Latest
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

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

@techknowlogick

This comment has been minimized.

Copy link
Member

techknowlogick commented Jan 9, 2019

Ping @adelowo

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 9, 2019

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?

@wyattoday

This comment has been minimized.

Copy link

wyattoday commented Jan 9, 2019

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

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 9, 2019

Thanks for the heads up

@kimpenhaus

This comment has been minimized.

Copy link

kimpenhaus commented Jan 9, 2019

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

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 9, 2019

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.

@kimpenhaus

This comment has been minimized.

Copy link

kimpenhaus commented Jan 9, 2019

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?

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 9, 2019

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

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 9, 2019

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

gitea/models/user.go

Lines 170 to 175 in 31aa00f

func (u *User) AfterLoad() {
if u.Theme == "" {
u.Theme = setting.UI.DefaultTheme
}
}

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 9, 2019

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

@securitaas

This comment has been minimized.

Copy link

securitaas commented Jan 17, 2019

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

@adelowo

This comment has been minimized.

Copy link
Member

adelowo commented Jan 17, 2019

@securitaas What commit are you running? This was fixed in
#5682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment