Fix local pricelist uniqueness and preserve config project on update

This commit is contained in:
Mikhail Chusavitin
2026-02-06 16:00:23 +03:00
parent 3d5ab63970
commit 51e2d1fc83
6 changed files with 178 additions and 10 deletions

View File

@@ -126,8 +126,8 @@ func (LocalConfigurationVersion) TableName() string {
// LocalPricelist stores cached pricelists from server
type LocalPricelist struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
ServerID uint `gorm:"not null" json:"server_id"` // ID on MariaDB server
Version string `gorm:"uniqueIndex;not null" json:"version"`
ServerID uint `gorm:"not null;uniqueIndex" json:"server_id"` // ID on MariaDB server
Version string `gorm:"not null;index" json:"version"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
SyncedAt time.Time `json:"synced_at"`