#45498: remove updated/created columns in `file_meta` table

pull/45534/head
Artur Wierzbicki 3 years ago
parent 656643203c
commit eb7a9bd351
  1. 17
      pkg/infra/filestorage/db_filestorage.go
  2. 2
      pkg/services/sqlstore/migrations/db_file_storage.go

@ -22,11 +22,9 @@ type file struct {
}
type fileMeta struct {
Path string `xorm:"path"`
Key string `xorm:"key"`
Value string `xorm:"value"`
Updated time.Time `xorm:"updated"`
Created time.Time `xorm:"created"`
Path string `xorm:"path"`
Key string `xorm:"key"`
Value string `xorm:"value"`
}
type dbFileStorage struct {
@ -213,16 +211,13 @@ func upsertProperty(sess *sqlstore.DBSession, now time.Time, path string, key st
}
if exists {
existing.Updated = now
existing.Value = val
_, err = sess.Where("path = ? AND key = ?", strings.ToLower(path), key).Update(existing)
} else {
_, err = sess.Insert(&fileMeta{
Path: strings.ToLower(path),
Key: key,
Value: val,
Updated: now,
Created: now,
Path: strings.ToLower(path),
Key: key,
Value: val,
})
}
return err

@ -28,8 +28,6 @@ func addDbFileStorageMigration(mg *migrator.Migrator) {
{Name: "path", Type: migrator.DB_NVarchar, Length: 1024, Nullable: false},
{Name: "key", Type: migrator.DB_NVarchar, Length: 1024, Nullable: false},
{Name: "value", Type: migrator.DB_NVarchar, Length: 1024, Nullable: false},
{Name: "updated", Type: migrator.DB_DateTime, Nullable: false},
{Name: "created", Type: migrator.DB_DateTime, Nullable: false},
},
Indices: []*migrator.Index{
{Cols: []string{"path", "key"}, Type: migrator.UniqueIndex},

Loading…
Cancel
Save