-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Error 500 creating a PR #16936
Comments
Note on my upgrade process (as per https://docs.gitea.io/en-us/install-with-docker/#upgrading)
|
Maybe it looks like a db migration issue, as the specific migration script (models/migrations/v182.go) was amended, but my db may have had run it already, and so maybe is missing stuff? Just speculating here... |
I rolled back to 1.15.0 in the meantime. |
Flagging #16820 as potential culprit |
Seriously postgres? There's a primary key - that's an unique constraint! I don't understand why our integration tests didn't catch this. So I think we need a small simple test that is going to replicate the issue. It would be helpful to know what version of pq you're running. When you say rolled back what do you mean? Did you just run 1.15.0 without regenerating the dB? If so you may be able to now drop in 1.15.1 and the unique constraint will be kept. To that end it would be helpful to see what the current schema of the issue_index table is. |
Similarly what happens if you run |
Just ran into this issue as well, running |
Hmm this implies that xorm is dropping the unique constraint and not adding in the primary key one. It may be that we need to add the (unnecessary) unique constraint back in here and let that be removed in 1.16 when we regenerate the table. This doubly raises the importance of telling us the schema of the table. |
OK I've just looked at this table now I'm actually up and out of bed. Unfortunately I think all users upgrading from 1.15.0 to 1.15.1 need to run Damn. I totally forgot that Xorm would drop the Unique constraint - (I knew it wouldn't create the PK). If I'd just left the unique constraint in this would have been fine. |
The same problem |
There is a flaw in go-gitea#16820 where it was missed that although xorm will not add a primary key to a table during syncing, it will remove an unique constraint. Users upgrading from 1.15.0 to 1.15.1 will therefore lose the unique constraint that makes this table work unless they run `gitea doctor recreate-table issue_index`. Postgres helpfully warns about this situation but MySQL does not. Main/1.16-dev is not affected by this issue as there is a migration that does the above recreation by default. Users moving directly to 1.15.1 from 1.14.x or lower are also not affected. Whilst we could force all users who ran 1.15.0 to do the above recreate-table call, this PR proposes an alternative: Just add the unique constraint back in for 1.15.x. This won't have any long term effects - just some wasted space for the unnecessary index. Fix go-gitea#16936 Signed-off-by: Andrew Thornton <art27@cantab.net>
|
There is a flaw in #16820 where it was missed that although xorm will not add a primary key to a table during syncing, it will remove an unique constraint. Users upgrading from 1.15.0 to 1.15.1 will therefore lose the unique constraint that makes this table work unless they run `gitea doctor recreate-table issue_index`. Postgres helpfully warns about this situation but MySQL does not. Main/1.16-dev is not affected by this issue as there is a migration that does the above recreation by default. Users moving directly to 1.15.1 from 1.14.x or lower are also not affected. Whilst we could force all users who ran 1.15.0 to do the above recreate-table call, this PR proposes an alternative: Just add the unique constraint back in for 1.15.x. This won't have any long term effects - just some wasted space for the unnecessary index. Fix #16936 Signed-off-by: Andrew Thornton <art27@cantab.net>
Log of the above command after upgrading again back to 1.15.1:
Creating a PR after that worked on 1.15.1. Thanks and sorry I couldn't give you the table info sooner, I got to bed eventually 😪 Re:
Yes I had done that, simply rolled the container back to 1.15.0 without any further change. Hopefully I did not damage the schema. There is seldom any activity on this instance apart from me so I'm confident there hasn't been any more attempts to create issues and PRs before now. |
Are the warnings normal? Should i do anything? > gitea doctor recreate-table issue_index
2021/09/03 12:13:05 ...om/urfave/cli/app.go:405:RunAsSubcommand() [I] PING DATABASE postgres
2021/09/03 12:13:05 ...ations/migrations.go:444:func1() [I] Recreating Table: issue_index for Bean: IssueIndex
2021/09/03 12:13:06 ...om/urfave/cli/app.go:405:RunAsSubcommand() [W] Table user Column max_repo_creation db default is '-1', struct default is -1
2021/09/03 12:13:07 ...om/urfave/cli/app.go:405:RunAsSubcommand() [W] Table email_address Column lower_email db nullable is true, struct nullable is false
2021/09/03 12:13:07 ...om/urfave/cli/app.go:405:RunAsSubcommand() [W] Table external_login_user column avatar_url db type is TEXT, struct type is VARCHAR(255)
2021/09/03 12:13:08 ...om/urfave/cli/app.go:405:RunAsSubcommand() [W] Table project column board_type db type is INTEGER, struct type is BIGINT
2021/09/03 12:13:08 ...om/urfave/cli/app.go:405:RunAsSubcommand() [W] Table project column type db type is INTEGER, struct type is BIGINT Using this as backend: image:
registry: gcr.io
repository: bitnami-containers/postgresql
tag: 11.13.0-debian-10-r7 |
These are fine and can be ignored. |
same issue with a mysql (and same fix) |
Closing as fixed by #16938 and in 1.15.2 |
[x]
):Description
On a gitea running in docker; 1.15.0 used to work fine, but v1.15.1 does not.
The text was updated successfully, but these errors were encountered: