annotation: added region support to annoations

This commit is contained in:
Torkel Ödegaard
2017-04-12 16:26:34 +02:00
parent b867921b3b
commit 593b2ef866
5 changed files with 41 additions and 3 deletions

View File

@@ -23,6 +23,17 @@ func (r *SqlAnnotationRepo) Save(item *annotations.Item) error {
})
}
func (r *SqlAnnotationRepo) Update(item *annotations.Item) error {
return inTransaction(func(sess *xorm.Session) error {
if _, err := sess.Table("annotation").Id(item.Id).Update(item); err != nil {
return err
}
return nil
})
}
func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.Item, error) {
var sql bytes.Buffer
params := make([]interface{}, 0)

View File

@@ -54,4 +54,8 @@ func addAnnotationMig(mg *Migrator) {
{Name: "new_state", Type: DB_NVarchar, Length: 25, Nullable: false},
{Name: "data", Type: DB_Text, Nullable: false},
}))
mg.AddMigration("Add column region_id to annotation table", NewAddColumnMigration(table, &Column{
Name: "region_id", Type: DB_BigInt, Nullable: true, Default: "0",
}))
}