GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: CreateIndexes RepoUnit: pq: relation "IDX_repo_unit_S" already exists #325

Closed
opened 2025-11-02 03:18:46 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @strk on GitHub (Feb 6, 2017).

As of commit 94130da63a I cannot start Gitea against the development database I've been using so far, due to this error:

2017/02/06 17:56:09 [I] Migration: create repo unit table and add units for all repos
2017/02/06 17:56:09 [...itea/routers/init.go:54 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: CreateIndexes RepoUnit: pq: relation "IDX_repo_unit_created_unix" already exists

I think the call comes from here:

models/migrations/v16.go:       if err := sess.CreateIndexes(&repoUnit); err != nil {

I'm not sure why that migration is even attempted to be performed, given the DB is already at version 16:

=# select * from version;
 id | version 
----+---------
  1 |      16
(1 row)

@lunny ideas ?

Originally created by @strk on GitHub (Feb 6, 2017). As of commit 94130da63a31da59207dd7c4f12aa46fde17ab5b I cannot start Gitea against the development database I've been using so far, due to this error: ``` 2017/02/06 17:56:09 [I] Migration: create repo unit table and add units for all repos 2017/02/06 17:56:09 [...itea/routers/init.go:54 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: CreateIndexes RepoUnit: pq: relation "IDX_repo_unit_created_unix" already exists ``` I think the call comes from here: ``` models/migrations/v16.go: if err := sess.CreateIndexes(&repoUnit); err != nil { ``` I'm not sure why that migration is even attempted to be performed, given the DB is already at version 16: ``` =# select * from version; id | version ----+--------- 1 | 16 (1 row) ``` @lunny ideas ?
GiteaMirror added the issue/not-a-bug label 2025-11-02 03:18:46 -06:00
Author
Owner

@strk commented on GitHub (Feb 6, 2017):

I've fixed this by dropping the repo_unit table. Could be I tried the repo_unit branch before...

@strk commented on GitHub (Feb 6, 2017): I've fixed this by dropping the `repo_unit` table. Could be I tried the repo_unit branch before...
Author
Owner

@lunny commented on GitHub (Feb 7, 2017):

yes, because you tried that PR

@lunny commented on GitHub (Feb 7, 2017): yes, because you tried that PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#325