diff --git a/adaptors/adaptors.go b/adaptors/adaptors.go index 1fbdc63d7..518799fdb 100644 --- a/adaptors/adaptors.go +++ b/adaptors/adaptors.go @@ -20,25 +20,25 @@ type Adaptors struct { DeviceAction *DeviceAction DeviceState *DeviceState Flow *Flow - FlowElement *FlowElement - Connection *Connection - Worker *Worker - Role *Role - Permission *Permission - User *User - UserMeta *UserMeta - Image *Image - Variable *Variable - Map *Map - MapLayer *MapLayer - MapText *MapText - MapImage *MapImage - MapDevice *MapDevice - MapElement *MapElement - MapDeviceState *MapDeviceState - MapDeviceAction *MapDeviceAction - Log *Log - ZoneTag *ZoneTag + FlowElement *FlowElement + Connection *Connection + Worker *Worker + Role *Role + Permission *Permission + User *User + UserMeta *UserMeta + Image *Image + Variable *Variable + Map *Map + MapLayer *MapLayer + MapText *MapText + MapImage *MapImage + MapDevice *MapDevice + MapElement *MapElement + MapDeviceState *MapDeviceState + MapDeviceAction *MapDeviceAction + Log *Log + MapZone *MapZone } func NewAdaptors(db *gorm.DB, @@ -76,7 +76,7 @@ func NewAdaptors(db *gorm.DB, MapDeviceState: GetMapDeviceStateAdaptor(db), MapDeviceAction: GetMapDeviceActionAdaptor(db), Log: GetLogAdaptor(db), - ZoneTag: GetZoneTagAdaptor(db), + MapZone: GetMapZoneAdaptor(db), } return diff --git a/adaptors/map_element.go b/adaptors/map_element.go index edea5a3cf..d2bc15330 100644 --- a/adaptors/map_element.go +++ b/adaptors/map_element.go @@ -309,7 +309,7 @@ func (n *MapElement) fromDb(dbVer *db.MapElement) (ver *m.MapElement) { // Zone tag if dbVer.Zone != nil { - zoneAdaptor := GetZoneTagAdaptor(n.db) + zoneAdaptor := GetMapZoneAdaptor(n.db) ver.Zone = zoneAdaptor.fromDb(dbVer.Zone) } diff --git a/adaptors/map_zone.go b/adaptors/map_zone.go new file mode 100644 index 000000000..a05311eb1 --- /dev/null +++ b/adaptors/map_zone.go @@ -0,0 +1,76 @@ +package adaptors + +import ( + "github.com/e154/smart-home/db" + m "github.com/e154/smart-home/models" + "github.com/jinzhu/gorm" +) + +type MapZone struct { + table *db.MapZones + db *gorm.DB +} + +func GetMapZoneAdaptor(d *gorm.DB) *MapZone { + return &MapZone{ + table: &db.MapZones{Db: d}, + db: d, + } +} + +func (n *MapZone) Add(tag *m.MapZone) (id int64, err error) { + + dbTag := n.toDb(tag) + id, err = n.table.Add(dbTag) + + return +} + + +func (n *MapZone) GetByName(zoneName string) (ver *m.MapZone, err error) { + + var dbVer *db.MapZone + if dbVer, err = n.table.GetByName(zoneName); err != nil { + return + } + + ver = n.fromDb(dbVer) + + return +} + +func (n *MapZone) Delete(name string) (err error) { + + err = n.table.Delete(name) + + return +} + +func (n *MapZone) Search(query string, limit, offset int) (list []*m.MapZone, total int64, err error) { + var dbList []*db.MapZone + if dbList, total, err = n.table.Search(query, limit, offset); err != nil { + return + } + + list = make([]*m.MapZone, 0) + for _, dbTag := range dbList { + node := n.fromDb(dbTag) + list = append(list, node) + } + + return +} + +func (n *MapZone) toDb(tag *m.MapZone) *db.MapZone { + return &db.MapZone{ + Id: tag.Id, + Name: tag.Name, + } +} + +func (n *MapZone) fromDb(tag *db.MapZone) *m.MapZone { + return &m.MapZone{ + Id: tag.Id, + Name: tag.Name, + } +} diff --git a/adaptors/zone_tag.go b/adaptors/zone_tag.go deleted file mode 100644 index 395aec9d8..000000000 --- a/adaptors/zone_tag.go +++ /dev/null @@ -1,63 +0,0 @@ -package adaptors - -import ( - "github.com/e154/smart-home/db" - m "github.com/e154/smart-home/models" - "github.com/jinzhu/gorm" -) - -type ZoneTag struct { - table *db.ZoneTags - db *gorm.DB -} - -func GetZoneTagAdaptor(d *gorm.DB) *ZoneTag { - return &ZoneTag{ - table: &db.ZoneTags{Db: d}, - db: d, - } -} - -func (n *ZoneTag) Add(tag *m.ZoneTag) (id int64, err error) { - - dbTag := n.toDb(tag) - id, err = n.table.Add(dbTag) - - return -} - -func (n *ZoneTag) Delete(name string) (err error) { - - err = n.table.Delete(name) - - return -} - -func (n *ZoneTag) Search(query string, limit, offset int) (list []*m.ZoneTag, total int64, err error) { - var dbList []*db.ZoneTag - if dbList, total, err = n.table.Search(query, limit, offset); err != nil { - return - } - - list = make([]*m.ZoneTag, 0) - for _, dbTag := range dbList { - node := n.fromDb(dbTag) - list = append(list, node) - } - - return -} - -func (n *ZoneTag) toDb(tag *m.ZoneTag) *db.ZoneTag { - return &db.ZoneTag{ - Id: tag.Id, - Name: tag.Name, - } -} - -func (n *ZoneTag) fromDb(tag *db.ZoneTag) *m.ZoneTag { - return &m.ZoneTag{ - Id: tag.Id, - Name: tag.Name, - } -} diff --git a/api/server/routers.go b/api/server/routers.go index 00c56c778..c9119189b 100644 --- a/api/server/routers.go +++ b/api/server/routers.go @@ -135,6 +135,11 @@ func (s *Server) setControllers() { v1.GET("/map_elements", s.af.Auth, s.ControllersV1.MapElement.GetList) v1.PUT("/map_elements/sort", s.af.Auth, s.ControllersV1.MapElement.Sort) + // map zone + v1.POST("/map_zone", s.af.Auth, s.ControllersV1.MapZone.Add) + v1.DELETE("/map_zone/:name", s.af.Auth, s.ControllersV1.MapZone.Delete) + v1.GET("/map_zone/search", s.af.Auth, s.ControllersV1.MapZone.Search) + // images v1.POST("/image", s.af.Auth, s.ControllersV1.Image.Add) v1.GET("/image/:id", s.af.Auth, s.ControllersV1.Image.GetById) diff --git a/api/server/v1/controllers/controllers.go b/api/server/v1/controllers/controllers.go index ed0e27ff9..3d87bf9ec 100644 --- a/api/server/v1/controllers/controllers.go +++ b/api/server/v1/controllers/controllers.go @@ -28,6 +28,7 @@ type ControllersV1 struct { Flow *ControllerFlow Log *ControllerLog Gate *ControllerGate + MapZone *ControllerMapZone } func NewControllersV1(adaptors *adaptors.Adaptors, @@ -56,5 +57,6 @@ func NewControllersV1(adaptors *adaptors.Adaptors, Flow: NewControllerFlow(common), Log: NewControllerLog(common), Gate: NewControllerGate(common), + MapZone: NewControllerMapZone(common), } } diff --git a/api/server/v1/controllers/map_zone.go b/api/server/v1/controllers/map_zone.go new file mode 100644 index 000000000..c177f4ca1 --- /dev/null +++ b/api/server/v1/controllers/map_zone.go @@ -0,0 +1,172 @@ +package controllers + +import ( + "github.com/e154/smart-home/api/server/v1/models" + "github.com/e154/smart-home/common" + m "github.com/e154/smart-home/models" + "github.com/gin-gonic/gin" +) + +type ControllerMapZone struct { + *ControllerCommon +} + +func NewControllerMapZone(common *ControllerCommon) *ControllerMapZone { + return &ControllerMapZone{ControllerCommon: common} +} + +// swagger:operation POST /map_zone mapZoneAdd +// --- +// parameters: +// - description: map_zone params +// in: body +// name: map_zone +// required: true +// schema: +// $ref: '#/definitions/NewMapZone' +// type: object +// summary: add new map_zone +// description: +// security: +// - ApiKeyAuth: [] +// tags: +// - map_zone +// responses: +// "200": +// description: OK +// schema: +// $ref: '#/definitions/MapZone' +// "400": +// $ref: '#/responses/Error' +// "401": +// description: "Unauthorized" +// "403": +// description: "Forbidden" +// "500": +// $ref: '#/responses/Error' +func (c ControllerMapZone) Add(ctx *gin.Context) { + + params := &models.NewMapZone{} + if err := ctx.ShouldBindJSON(params); err != nil { + log.Error(err.Error()) + NewError(400, err).Send(ctx) + return + } + + zone := &m.MapZone{} + _ = common.Copy(&zone, ¶ms, common.JsonEngine) + + zone, errs, err := c.endpoint.MapZone.Add(zone) + if len(errs) > 0 { + err400 := NewError(400) + err400.ValidationToErrors(errs).Send(ctx) + return + } + + if err != nil { + NewError(500, err).Send(ctx) + return + } + + result := &models.MapZone{} + if err = common.Copy(&result, &zone, common.JsonEngine); err != nil { + return + } + + resp := NewSuccess() + resp.SetData(result).Send(ctx) +} + +// swagger:operation DELETE /map_zone/{name} mapZoneDeleteByName +// --- +// parameters: +// - description: MapZone Name +// in: path +// name: name +// required: true +// type: text +// summary: delete map_zone by name +// description: +// security: +// - ApiKeyAuth: [] +// tags: +// - map_zone +// responses: +// "200": +// $ref: '#/responses/Success' +// "400": +// $ref: '#/responses/Error' +// "401": +// description: "Unauthorized" +// "403": +// description: "Forbidden" +// "404": +// $ref: '#/responses/Error' +// "500": +// $ref: '#/responses/Error' +func (c ControllerMapZone) Delete(ctx *gin.Context) { + + name := ctx.Param("name") + if err := c.endpoint.MapZone.Delete(name); err != nil { + code := 500 + if err.Error() == "record not found" { + code = 404 + } + NewError(code, err).Send(ctx) + return + } + + resp := NewSuccess() + resp.Send(ctx) +} + +// swagger:operation GET /map_zone/search mapZoneSearch +// --- +// summary: search map_zone +// description: +// security: +// - ApiKeyAuth: [] +// tags: +// - map_zone +// parameters: +// - description: query +// in: query +// name: query +// type: string +// - default: 10 +// description: limit +// in: query +// name: limit +// required: true +// type: integer +// - default: 0 +// description: offset +// in: query +// name: offset +// required: true +// type: integer +// responses: +// "200": +// $ref: '#/responses/MapZoneSearch' +// "401": +// description: "Unauthorized" +// "403": +// description: "Forbidden" +// "500": +// $ref: '#/responses/Error' +func (c ControllerMapZone) Search(ctx *gin.Context) { + + query, limit, offset := c.select2(ctx) + items, _, err := c.endpoint.MapZone.Search(query, limit, offset) + if err != nil { + NewError(500, err).Send(ctx) + return + } + + result := make([]*models.MapZone, 0) + _ = common.Copy(&result, &items) + + resp := NewSuccess() + resp.Item("zones", result) + resp.Send(ctx) +} diff --git a/api/server/v1/models/map_zone.go b/api/server/v1/models/map_zone.go new file mode 100644 index 000000000..d84f4fc29 --- /dev/null +++ b/api/server/v1/models/map_zone.go @@ -0,0 +1,11 @@ +package models + +type NewMapZone struct { + Name string `json:"name"` +} + +// swagger:model +type MapZone struct { + Id int64 `json:"id"` + Name string `json:"name"` +} diff --git a/api/server/v1/responses/map_zone.go b/api/server/v1/responses/map_zone.go new file mode 100644 index 000000000..0dac9406f --- /dev/null +++ b/api/server/v1/responses/map_zone.go @@ -0,0 +1,26 @@ +package responses + +import ( + "github.com/e154/smart-home/api/server/v1/models" +) + +// swagger:response MapZoneList +type MapZoneList struct { + // in:body + Body struct { + Items []*models.MapZone `json:"items"` + Meta struct { + Limit int64 `json:"limit"` + ObjectCount int64 `json:"object_count"` + Offset int64 `json:"offset"` + } `json:"meta"` + } +} + +// swagger:response MapZoneSearch +type MapZoneSearch struct { + // in:body + Body struct { + MapZones []*models.MapZone `json:"zones"` + } +} diff --git a/bin/generator.sh b/bin/generator.sh index 4b65e0a2e..3db743c45 100755 --- a/bin/generator.sh +++ b/bin/generator.sh @@ -7,7 +7,8 @@ set -o errexit ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")" && cd ../ && pwd)" CONF_PATH=${ROOT}/conf/swagger -SWAGGER=swagger_darwin_amd64.dms.v0.19 +#SWAGGER=swagger_darwin_amd64.dms.v0.19 +SWAGGER=swagger_darwin_amd64.dms.v0.20.1 __validate() { ${SWAGGER} validate ${CONF_PATH}/swagger.yml diff --git a/db/map_element.go b/db/map_element.go index 80f7a48db..dcf5da830 100644 --- a/db/map_element.go +++ b/db/map_element.go @@ -33,7 +33,7 @@ type MapElement struct { Status StatusType Weight int64 ZoneId *int64 - Zone *ZoneTag + Zone *MapZone CreatedAt time.Time UpdatedAt time.Time } diff --git a/db/map_zone.go b/db/map_zone.go new file mode 100644 index 000000000..007b0331c --- /dev/null +++ b/db/map_zone.go @@ -0,0 +1,64 @@ +package db + +import ( + "fmt" + "github.com/jinzhu/gorm" +) + +type MapZones struct { + Db *gorm.DB +} + +type MapZone struct { + Id int64 `gorm:"primary_key"` + Name string +} + +func (d *MapZone) TableName() string { + return "map_zones" +} + +func (n MapZones) Add(zone *MapZone) (id int64, err error) { + if err = n.Db.Create(&zone).Error; err != nil { + return + } + id = zone.Id + return +} + +func (n MapZones) GetByName(zoneName string) (zone *MapZone, err error) { + + zone = &MapZone{} + err = n.Db.Model(zone). + Where("name = ?", zoneName). + First(&zone). + Error + + return +} + +func (n *MapZones) Search(query string, limit, offset int) (list []*MapZone, total int64, err error) { + + q := n.Db.Model(&MapZone{}). + Where("name LIKE ?", "%"+query+"%"). + Order("name ASC") + + if err = q.Count(&total).Error; err != nil { + return + } + + list = make([]*MapZone, 0) + err = q.Find(&list).Error + + return +} + +func (n MapZones) Delete(name string) (err error) { + if name == "" { + err = fmt.Errorf("zero name") + return + } + err = n.Db.Model(&MapZone{}). + Delete("name = ?", name).Error + return +} diff --git a/db/zone_tag.go b/db/zone_tag.go deleted file mode 100644 index ff95ca86b..000000000 --- a/db/zone_tag.go +++ /dev/null @@ -1,53 +0,0 @@ -package db - -import ( - "fmt" - "github.com/jinzhu/gorm" -) - -type ZoneTags struct { - Db *gorm.DB -} - -type ZoneTag struct { - Id int64 `gorm:"primary_key"` - Name string -} - -func (d *ZoneTag) TableName() string { - return "zone_tags" -} - -func (n ZoneTags) Add(tag *ZoneTag) (id int64, err error) { - if err = n.Db.Create(&tag).Error; err != nil { - return - } - id = tag.Id - return -} - -func (n *ZoneTags) Search(query string, limit, offset int) (list []*ZoneTag, total int64, err error) { - - q := n.Db.Model(&ZoneTag{}). - Where("name LIKE ?", "%"+query+"%"). - Order("name ASC") - - if err = q.Count(&total).Error; err != nil { - return - } - - list = make([]*ZoneTag, 0) - err = q.Find(&list).Error - - return -} - -func (n ZoneTags) Delete(name string) (err error) { - if name == "" { - err = fmt.Errorf("zero name") - return - } - err = n.Db.Model(&ZoneTag{}). - Delete("name = ?", name).Error - return -} diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go index 069d6e2af..78cdb3b59 100644 --- a/endpoint/endpoint.go +++ b/endpoint/endpoint.go @@ -24,6 +24,7 @@ type Endpoint struct { Map *MapEndpoint MapElement *MapElementEndpoint MapLayer *MapLayerEndpoint + MapZone *MapZoneEndpoint Node *NodeEndpoint Role *RoleEndpoint Script *ScriptEndpoint @@ -57,5 +58,6 @@ func NewEndpoint(adaptors *adaptors.Adaptors, WorkflowScenario: NewWorkflowScenarioEndpoint(common), User: NewUserEndpoint(common), Gate: NewGateEndpoint(common), + MapZone: NewMapZoneEndpoint(common), } } diff --git a/endpoint/map_zone.go b/endpoint/map_zone.go new file mode 100644 index 000000000..51363d166 --- /dev/null +++ b/endpoint/map_zone.go @@ -0,0 +1,48 @@ +package endpoint + +import ( + m "github.com/e154/smart-home/models" + "github.com/e154/smart-home/system/validation" +) + +type MapZoneEndpoint struct { + *CommonEndpoint +} + +func NewMapZoneEndpoint(common *CommonEndpoint) *MapZoneEndpoint { + return &MapZoneEndpoint{ + CommonEndpoint: common, + } +} + +func (n *MapZoneEndpoint) Add(zone *m.MapZone) (result *m.MapZone, errs []*validation.Error, err error) { + + _, errs = zone.Valid() + if len(errs) > 0 { + return + } + + if zone.Id, err = n.adaptors.MapZone.Add(zone); err != nil { + return + } + + return +} + +func (n *MapZoneEndpoint) Delete(zoneName string) (err error) { + + if _, err = n.adaptors.MapZone.GetByName(zoneName); err != nil { + return + } + + err = n.adaptors.MapZone.Delete(zoneName) + + return +} + +func (n *MapZoneEndpoint) Search(query string, limit, offset int) (result []*m.MapZone, total int64, err error) { + + result, total, err = n.adaptors.MapZone.Search(query, limit, offset) + + return +} diff --git a/migrations/20190913_172212_rename_zone_tags.sql b/migrations/20190913_172212_rename_zone_tags.sql new file mode 100644 index 000000000..d1602254a --- /dev/null +++ b/migrations/20190913_172212_rename_zone_tags.sql @@ -0,0 +1,10 @@ +-- +migrate Up +-- SQL in section 'Up' is executed when this migration is applied +ALTER TABLE zone_tags + RENAME TO map_zones; + +-- +migrate Down +-- SQL section 'Down' is executed when this migration is rolled back +ALTER TABLE map_zones + RENAME TO zone_tags; + diff --git a/models/map_element.go b/models/map_element.go index 9b6dfc0f4..b99df6135 100644 --- a/models/map_element.go +++ b/models/map_element.go @@ -74,7 +74,7 @@ type MapElement struct { GraphSettings MapElementGraphSettings `json:"graph_settings"` Status StatusType `json:"status" valid:"Required"` Weight int64 `json:"weight"` - Zone *ZoneTag `json:"zone"` + Zone *MapZone `json:"zone"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } diff --git a/models/map_zone.go b/models/map_zone.go new file mode 100644 index 000000000..eb28a1f3d --- /dev/null +++ b/models/map_zone.go @@ -0,0 +1,18 @@ +package models + +import "github.com/e154/smart-home/system/validation" + +type MapZone struct { + Id int64 `json:"id"` + Name string `json:"name" valid:"Required"` +} + +func (d *MapZone) Valid() (ok bool, errs []*validation.Error) { + + valid := validation.Validation{} + if ok, _ = valid.Valid(d); !ok { + errs = valid.Errors + } + + return +} diff --git a/models/zone_tag.go b/models/zone_tag.go deleted file mode 100644 index 43c36af0d..000000000 --- a/models/zone_tag.go +++ /dev/null @@ -1,6 +0,0 @@ -package models - -type ZoneTag struct { - Id int64 `json:"id"` - Name string `json:"name"` -} diff --git a/system/initial/env1/map.go b/system/initial/env1/map.go index 6b82da77c..e2f30e357 100644 --- a/system/initial/env1/map.go +++ b/system/initial/env1/map.go @@ -19,16 +19,16 @@ func addMaps(adaptors *adaptors.Adaptors, // zones // ------------------------------------------------ - mainHallZone := &m.ZoneTag{ + mainHallZone := &m.MapZone{ Name: "Main Hall", } - mainHallZone.Id, err = adaptors.ZoneTag.Add(mainHallZone) + mainHallZone.Id, err = adaptors.MapZone.Add(mainHallZone) So(err, ShouldBeNil) - kitchenZone := &m.ZoneTag{ + kitchenZone := &m.MapZone{ Name: "Kitchen", } - kitchenZone.Id, err = adaptors.ZoneTag.Add(kitchenZone) + kitchenZone.Id, err = adaptors.MapZone.Add(kitchenZone) So(err, ShouldBeNil) // map 1 diff --git a/system/migrations/assets/assets.go b/system/migrations/assets/assets.go index 27cfbaac1..cb36cfdb8 100644 --- a/system/migrations/assets/assets.go +++ b/system/migrations/assets/assets.go @@ -17,6 +17,7 @@ // migrations/20190730_193837_update_user.sql // migrations/20190730_235533_fix_workflow_scenario_ref.sql // migrations/20190910_234100_add_map_element_zone_attr.sql +// migrations/20190913_172212_rename_zone_tags.sql // DO NOT EDIT! package database @@ -99,7 +100,7 @@ func migrations20170121_004649_nodesSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20170121_004649_nodes.sql", size: 781, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20170121_004649_nodes.sql", size: 781, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -119,7 +120,7 @@ func migrations20170121_005244_workflowsSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20170121_005244_workflows.sql", size: 2822, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20170121_005244_workflows.sql", size: 2822, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -139,7 +140,7 @@ func migrations20181109_220911_workflow_add_scenarioSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181109_220911_workflow_add_scenario.sql", size: 428, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181109_220911_workflow_add_scenario.sql", size: 428, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -159,7 +160,7 @@ func migrations20181113_013141_workflow_elementsSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181113_013141_workflow_elements.sql", size: 11875, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181113_013141_workflow_elements.sql", size: 11875, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -179,7 +180,7 @@ func migrations20181114_214137_devicesSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181114_214137_devices.sql", size: 2920, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181114_214137_devices.sql", size: 2920, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -199,7 +200,7 @@ func migrations20181114_225604_device_groupSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181114_225604_device_group.sql", size: 486, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181114_225604_device_group.sql", size: 486, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -219,7 +220,7 @@ func migrations20181119_092050_add_workersSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181119_092050_add_workers.sql", size: 932, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181119_092050_add_workers.sql", size: 932, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -239,7 +240,7 @@ func migrations20181219_205800_add_imagesSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181219_205800_add_images.sql", size: 375, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181219_205800_add_images.sql", size: 375, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -259,7 +260,7 @@ func migrations20181219_205810_add_usersSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181219_205810_add_users.sql", size: 3090, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181219_205810_add_users.sql", size: 3090, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -279,7 +280,7 @@ func migrations20181223_231535_add_variablesSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20181223_231535_add_variables.sql", size: 428, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20181223_231535_add_variables.sql", size: 428, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -299,7 +300,7 @@ func migrations20190122_002953_add_mapSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190122_002953_add_map.sql", size: 4338, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20190122_002953_add_map.sql", size: 4338, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -319,7 +320,7 @@ func migrations20190309_123940_add_logsSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190309_123940_add_logs.sql", size: 607, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20190309_123940_add_logs.sql", size: 607, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -339,7 +340,7 @@ func migrations20190610_215124_add_passw_to_nodeSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190610_215124_add_passw_to_node.sql", size: 389, mode: os.FileMode(420), modTime: time.Unix(1560521754, 0)} + info := bindataFileInfo{name: "migrations/20190610_215124_add_passw_to_node.sql", size: 389, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -359,7 +360,7 @@ func migrations20190730_175759_update_nodeSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190730_175759_update_node.sql", size: 392, mode: os.FileMode(420), modTime: time.Unix(1564484404, 0)} + info := bindataFileInfo{name: "migrations/20190730_175759_update_node.sql", size: 392, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -379,7 +380,7 @@ func migrations20190730_193837_update_userSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190730_193837_update_user.sql", size: 323, mode: os.FileMode(420), modTime: time.Unix(1564490368, 0)} + info := bindataFileInfo{name: "migrations/20190730_193837_update_user.sql", size: 323, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -399,7 +400,7 @@ func migrations20190730_235533_fix_workflow_scenario_refSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190730_235533_fix_workflow_scenario_ref.sql", size: 445, mode: os.FileMode(420), modTime: time.Unix(1564506385, 0)} + info := bindataFileInfo{name: "migrations/20190730_235533_fix_workflow_scenario_ref.sql", size: 445, mode: os.FileMode(420), modTime: time.Unix(1568213048, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -419,7 +420,27 @@ func migrations20190910_234100_add_map_element_zone_attrSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "migrations/20190910_234100_add_map_element_zone_attr.sql", size: 664, mode: os.FileMode(420), modTime: time.Unix(1568134250, 0)} + info := bindataFileInfo{name: "migrations/20190910_234100_add_map_element_zone_attr.sql", size: 664, mode: os.FileMode(420), modTime: time.Unix(1568223338, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _migrations20190913_172212_rename_zone_tagsSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\xce\xbf\x0e\x82\x30\x10\xc7\xf1\xfd\x9e\xe2\xb7\x31\x98\x3e\x01\x13\xc6\x6e\xa8\x11\x61\x26\x15\x2e\x70\x11\xda\x86\xd6\x60\x7c\x7a\x43\x8c\x44\x9d\x5c\xef\x4f\xbe\x1f\xa5\xb0\x19\xa5\x9b\x4c\x64\x54\x9e\x94\xc2\xf9\x94\x43\x2c\x02\x37\x51\x9c\x45\x52\xf9\x04\x12\xc0\x77\x6e\x6e\x91\x5b\xcc\x3d\x5b\xc4\x5e\x02\x5e\x7f\xcb\x91\x04\x18\xef\x07\xe1\x96\xb2\xbc\xd4\x05\xca\x6c\x9b\x6b\x3c\x9c\xe5\x3a\x9a\x2e\x10\x00\x14\xfa\x90\xed\x35\xca\x23\x46\xe3\xeb\x65\x17\x52\xa2\x4f\xc0\xce\xcd\xf6\x4d\x58\xfb\xcb\xf0\x2f\xc1\xe4\x86\x81\x5b\x5c\x4c\x73\xfd\x52\xac\xb5\x1f\xc5\xaa\x4b\x89\x9e\x01\x00\x00\xff\xff\xf3\x30\xe8\xe9\x07\x01\x00\x00") + +func migrations20190913_172212_rename_zone_tagsSqlBytes() ([]byte, error) { + return bindataRead( + _migrations20190913_172212_rename_zone_tagsSql, + "migrations/20190913_172212_rename_zone_tags.sql", + ) +} + +func migrations20190913_172212_rename_zone_tagsSql() (*asset, error) { + bytes, err := migrations20190913_172212_rename_zone_tagsSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "migrations/20190913_172212_rename_zone_tags.sql", size: 263, mode: os.FileMode(420), modTime: time.Unix(1568370197, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -493,6 +514,7 @@ var _bindata = map[string]func() (*asset, error){ "migrations/20190730_193837_update_user.sql": migrations20190730_193837_update_userSql, "migrations/20190730_235533_fix_workflow_scenario_ref.sql": migrations20190730_235533_fix_workflow_scenario_refSql, "migrations/20190910_234100_add_map_element_zone_attr.sql": migrations20190910_234100_add_map_element_zone_attrSql, + "migrations/20190913_172212_rename_zone_tags.sql": migrations20190913_172212_rename_zone_tagsSql, } // AssetDir returns the file names below a certain @@ -553,6 +575,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "20190730_193837_update_user.sql": &bintree{migrations20190730_193837_update_userSql, map[string]*bintree{}}, "20190730_235533_fix_workflow_scenario_ref.sql": &bintree{migrations20190730_235533_fix_workflow_scenario_refSql, map[string]*bintree{}}, "20190910_234100_add_map_element_zone_attr.sql": &bintree{migrations20190910_234100_add_map_element_zone_attrSql, map[string]*bintree{}}, + "20190913_172212_rename_zone_tags.sql": &bintree{migrations20190913_172212_rename_zone_tagsSql, map[string]*bintree{}}, }}, }}