Skip to content
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
2 of 7 tasks
wyattoday opened this issue Jan 9, 2019 · 13 comments · Fixed by #5682
Labels

Comments

@wyattoday
Copy link

  • 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
Copy link
Member

Ping @adelowo

@adelowo
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
Copy link
Author

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

@adelowo
Copy link
Member

adelowo commented Jan 9, 2019

Thanks for the heads up

@kimpenhaus
Copy link

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
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
Copy link

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
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
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
Copy link
Member

adelowo commented Jan 9, 2019

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

@securitaas
Copy link

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

@adelowo
Copy link
Member

adelowo commented Jan 17, 2019

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

@tokidoki11
Copy link

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

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants