Skip to content

Commit fdca6de

Browse files
KN4CK3RGiteaBot
authored andcommitted
Prevent primary key update on migration (go-gitea#26192)
Fixes go-gitea#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
1 parent 892e24a commit fdca6de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/migrations/v1_20/v250.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {
2020
}
2121

2222
type PackageVersion struct {
23-
ID int64 `xorm:"pk"`
23+
ID int64 `xorm:"pk autoincr"`
2424
MetadataJSON string `xorm:"metadata_json"`
2525
}
2626

0 commit comments

Comments
 (0)