Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 10:46:10 +01:00

Prevent primary key update on migration (#26192) (#26199)

Backport #26192 by @KN4CK3R

Fixes #25918

The migration fails on MSSQL because xorm tries to update the primary
key column. xorm prevents this if the column is marked as auto
increment:

c622cdaf89/internal/statements/update.go (L38-L40)

I think it would be better if xorm would check for primary key columns
here because updating such columns is bad practice. It looks like if
that auto increment check should do the same.

fyi @lunny

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit ecfbcced46)
This commit is contained in:
Giteabot 2023-07-28 17:08:11 +08:00 committed by Earl Warren
parent 5a4b19435d
commit 751028549d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -20,7 +20,7 @@ func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {
} }
type PackageVersion struct { type PackageVersion struct {
ID int64 `xorm:"pk"` ID int64 `xorm:"pk autoincr"`
MetadataJSON string `xorm:"metadata_json"` MetadataJSON string `xorm:"metadata_json"`
} }