sqlite Migration: add approval whitelists to protected branches fails #2771

Closed
opened 2025-11-02 04:47:55 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @jsimonetti on GitHub (Jan 18, 2019).

  • Gitea version (or commit ref): docker 1.7.0-rc2
  • Git version:
  • Operating system:
  • 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/18 11:59:09 [I] Log Mode: File(Info)
2019/01/18 11:59:09 [I] XORM Log Mode: File(Info)
2019/01/18 11:59:09 [I] Cache Service Enabled
2019/01/18 11:59:09 [I] Session Service Enabled
2019/01/18 11:59:09 [I] Migration: add approval whitelists to protected branches
2019/01/18 11:59:09 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Unknown col "is_empty" in index is_bare of table repository, columns [id owner_id lower_name name description website default_branch num_watches num_stars num_forks num_issues num_closed_issues num_pulls num_closed_pulls num_milestones num_closed_milestones is_private is_empty is_mirror is_fork fork_id size is_fsck_enabled topics created_unix updated_unix]

Description

The migration fails because the index was created using:
CREATE INDEX `IDX_repository_is_bare` ON `repository` ("is_empty");

The index should actually be:
CREATE INDEX `IDX_repository_is_bare` ON `repository` (`is_empty`);
(note the backticks instead of quotes)

Manually editting the database and doing:
sqlite> DROP INDEX `IDX_repository_is_bare`;
sqlite> CREATE INDEX `IDX_repository_is_bare` ON `repository` (`is_empty`);

now allows for the db migration to v74 to succeed.

Originally created by @jsimonetti on GitHub (Jan 18, 2019). - Gitea version (or commit ref): docker 1.7.0-rc2 - Git version: - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant - Log gist: 2019/01/18 11:59:09 [I] Log Mode: File(Info) 2019/01/18 11:59:09 [I] XORM Log Mode: File(Info) 2019/01/18 11:59:09 [I] Cache Service Enabled 2019/01/18 11:59:09 [I] Session Service Enabled 2019/01/18 11:59:09 [I] Migration: add approval whitelists to protected branches 2019/01/18 11:59:09 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Unknown col "is_empty" in index is_bare of table repository, columns [id owner_id lower_name name description website default_branch num_watches num_stars num_forks num_issues num_closed_issues num_pulls num_closed_pulls num_milestones num_closed_milestones is_private is_empty is_mirror is_fork fork_id size is_fsck_enabled topics created_unix updated_unix] ## Description The migration fails because the index was created using: ```CREATE INDEX `IDX_repository_is_bare` ON `repository` ("is_empty");``` The index should actually be: ```CREATE INDEX `IDX_repository_is_bare` ON `repository` (`is_empty`);``` (note the backticks instead of quotes) Manually editting the database and doing: ```sqlite> DROP INDEX `IDX_repository_is_bare`;``` ```sqlite> CREATE INDEX `IDX_repository_is_bare` ON `repository` (`is_empty`);``` now allows for the db migration to v74 to succeed.
GiteaMirror added the issue/duplicate label 2025-11-02 04:47:55 -06:00
Author
Owner

@serverwentdown commented on GitHub (Jan 18, 2019):

Thanks! This affected me when I upgraded.

@serverwentdown commented on GitHub (Jan 18, 2019): Thanks! This affected me when I upgraded.
Author
Owner

@lunny commented on GitHub (Jan 18, 2019):

please confirm https://github.com/go-gitea/gitea/pull/5762 fix this issue.

@lunny commented on GitHub (Jan 18, 2019): please confirm https://github.com/go-gitea/gitea/pull/5762 fix this issue.
Author
Owner

@theasp commented on GitHub (Jan 18, 2019):

Using the docker image that was pushed after that commit (image c98e58549906), I am still having this issue.

2019/01/18 15:57:04 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Unknown col "is_empty" in index is_bare of table repository, columns [id owner_id lower_name name description website default_branch num_watches num_stars num_forks num_issues num_closed_issues num_pulls num_closed_pulls num_milestones num_closed_milestones is_private is_empty is_mirror is_fork fork_id size created_unix updated_unix is_fsck_enabled topics]
@theasp commented on GitHub (Jan 18, 2019): Using the docker image that was pushed after that commit (image c98e58549906), I am still having this issue. ``` 2019/01/18 15:57:04 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Unknown col "is_empty" in index is_bare of table repository, columns [id owner_id lower_name name description website default_branch num_watches num_stars num_forks num_issues num_closed_issues num_pulls num_closed_pulls num_milestones num_closed_milestones is_private is_empty is_mirror is_fork fork_id size created_unix updated_unix is_fsck_enabled topics] ```
Author
Owner

@zeripath commented on GitHub (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
@zeripath commented on GitHub (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
Author
Owner

@zeripath commented on GitHub (Jan 18, 2019):

@theasp you may need to explicitly run gitea migrate too

@zeripath commented on GitHub (Jan 18, 2019): @theasp you may need to explicitly run `gitea migrate` too
Author
Owner

@zeripath commented on GitHub (Jan 18, 2019):

This is a duplicate of #5759

@zeripath commented on GitHub (Jan 18, 2019): This is a duplicate of #5759
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2771