/
20170121_012048_device_actions.go
41 lines (36 loc) · 1.07 KB
/
20170121_012048_device_actions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"github.com/astaxie/beego/migration"
)
// DO NOT MODIFY
type DeviceActions_20170121_012048 struct {
migration.Migration
}
// DO NOT MODIFY
func init() {
m := &DeviceActions_20170121_012048{}
m.Created = "20170121_012048"
migration.Register("DeviceActions_20170121_012048", m)
}
// Run the migrations
func (m *DeviceActions_20170121_012048) Up() {
// use m.SQL("CREATE TABLE ...") to make schema update
m.SQL(`CREATE TABLE device_actions (
id Int( 11 ) AUTO_INCREMENT NOT NULL,
device_id Int( 11 ) NULL,
name VarChar( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
description VarChar( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
created_at DateTime NOT NULL,
update_at DateTime NOT NULL,
script_id Int( 32 ) NULL,
PRIMARY KEY ( id ),
CONSTRAINT unique_id UNIQUE( id ) )
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ENGINE = InnoDB;`)
}
// Reverse the migrations
func (m *DeviceActions_20170121_012048) Down() {
// use m.SQL("DROP TABLE ...") to reverse schema update
m.SQL("DROP TABLE IF EXISTS `device_actions` CASCADE")
}