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

Migration error: rename repo is_bare to repo is_empty #5759

Closed
2 of 7 tasks
kimpenhaus opened this issue Jan 18, 2019 · 10 comments · Fixed by #5776
Closed
2 of 7 tasks

Migration error: rename repo is_bare to repo is_empty #5759

kimpenhaus opened this issue Jan 18, 2019 · 10 comments · Fixed by #5776
Labels

Comments

@kimpenhaus
Copy link

kimpenhaus commented Jan 18, 2019

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

Description

I am running gitea inside docker container: gitea/gitea:latest - so I assume this is the latest version. After the last update with watchtower the container won't come up again. Checking the logfiles:

2019/01/18 09:07:18 [I] Migration: rename repo is_bare to repo is_empty
2019/01/18 09:07:18 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: select repositories: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"repository" RENAME COLUMN "is_bare" TO "is_empty"' at line 1

Not pretty sure but while rename column works for MySQL I think it is not working in MariaDB. change column should work for both DBs.

MySQL Ref
bildschirmfoto 2019-01-18 um 10 31 26

MaraiDB Ref
bildschirmfoto 2019-01-18 um 10 32 14

Working statement looks like:

ALTER TABLE
    `repository`
CHANGE COLUMN
    `is_bare` `is_empty` tinyint(1);
@zeripath
Copy link
Contributor

Sigh. Sorry about this.

@kimpenhaus
Copy link
Author

kimpenhaus commented Jan 18, 2019

no worries 😄 I am even not pretty sure if MariaDB is one of the supported platforms.

I did manual migration by executing the proper sql statement and setting version to 79. Now it's running again.

@kimpenhaus kimpenhaus changed the title Migration error: rename repo is_bare to repo is_empty MariaDB migration error: rename repo is_bare to repo is_empty Jan 18, 2019
@wyattoday
Copy link

This also happens on MySQL 8.0 / Percona Server 8.0. Same solution.

@xsteadfastx
Copy link

also in sqlite....

@zeripath
Copy link
Contributor

zeripath commented Jan 18, 2019

If unfortunately you were hit by the migration bug and starting your gitea failed, please follow the below steps:

  • Stop gitea if it's still running
  • Change the value of the table version from 79 to 78
  • Restart gitea

If your version was not 79 you should just run gitea migrate

@zeripath
Copy link
Contributor

Please reply to ensure that you've managed to successfully restart Gitea

@zeripath zeripath changed the title MariaDB migration error: rename repo is_bare to repo is_empty Migration error: rename repo is_bare to repo is_empty Jan 18, 2019
@zeripath
Copy link
Contributor

Hmm... I've just had a similar issue on sqlite migrating from versions back to v1.5.3 . The migration is still wrong.

@zeripath
Copy link
Contributor

@lunny It seems that the problem at least for sqlite is that sess.Sync2 locks the schema which means the drop of the index earlier in the transaction breaks. I'm going to put another PR in for this.

zeripath added a commit to zeripath/gitea that referenced this issue Jan 19, 2019
Unfortunately the last fix didn't completely fix the migration to v79 of the db
due to bug with schema locking during Sync2. This should fix this issue.

Fix go-gitea#5759

Signed-off-by: Andrew Thornton <[email protected]>
techknowlogick pushed a commit that referenced this issue Jan 20, 2019
Unfortunately the last fix didn't completely fix the migration to v79 of the db
due to bug with schema locking during Sync2. This should fix this issue.

Fix #5759

Signed-off-by: Andrew Thornton <[email protected]>
@michelebugio
Copy link

I do apologize but my gitea docker instance with sqlite is still down.

I understand I do need to change the value of the version table to 79 manually, but I do not seem to be able to run queries within the docker console. I am sure I am missing something as I've never dealt with sqlite within a docker before, but at this point I would like to make it work.

@kimpenhaus
Copy link
Author

kimpenhaus commented Jan 25, 2019

Is your sqlite DB mounted into the docker as volume? If so, you could connect from share or use https://sqlitebrowser.org. If not - I would recommend copying the DB to a volume mount point and then use console or UI.

And you need to change version to 78 ;-)

@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