瀏覽代碼

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>
tags/v1.20.2
Giteabot 10 月之前
父節點
當前提交
ecfbcced46
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      models/migrations/v1_20/v250.go

+ 1
- 1
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"`
}


Loading…
取消
儲存