aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations/v1_20
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-07-28 09:54:31 +0200
committerGitHub <noreply@github.com>2023-07-28 09:54:31 +0200
commit7866a6e0e25cf87b298e046bb38f4d68c35529a7 (patch)
tree324e75f1da5229cc5ede217866de3f991a8a953e /models/migrations/v1_20
parent494ee56de28a52568413dfa30b5ddd99411fc2fc (diff)
downloadgitea-7866a6e0e25cf87b298e046bb38f4d68c35529a7.tar.gz
gitea-7866a6e0e25cf87b298e046bb38f4d68c35529a7.zip
Prevent primary key update on migration (#26192)
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: https://gitea.com/xorm/xorm/src/commit/c622cdaf893fbfe3f40a6b79f6bc17ee10f53865/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
Diffstat (limited to 'models/migrations/v1_20')
-rw-r--r--models/migrations/v1_20/v250.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/migrations/v1_20/v250.go b/models/migrations/v1_20/v250.go
index e05646e5c6..a09957b291 100644
--- a/models/migrations/v1_20/v250.go
+++ b/models/migrations/v1_20/v250.go
@@ -20,7 +20,7 @@ func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {
}
type PackageVersion struct {
- ID int64 `xorm:"pk"`
+ ID int64 `xorm:"pk autoincr"`
MetadataJSON string `xorm:"metadata_json"`
}