-
Notifications
You must be signed in to change notification settings - Fork 70
/
v0001.go
48 lines (46 loc) · 1.13 KB
/
v0001.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
42
43
44
45
46
47
package migrations
var migration_v0001 = map[string][]string{
"mysql": {
`CREATE TABLE IF NOT EXISTS groups (
id int NOT NULL AUTO_INCREMENT,
guid varchar(255),
UNIQUE (guid),
PRIMARY KEY (id)
);`,
`CREATE TABLE IF NOT EXISTS destinations (
id int NOT NULL AUTO_INCREMENT,
group_id int REFERENCES groups(id),
port int,
protocol varchar(255),
UNIQUE (group_id, port, protocol),
PRIMARY KEY (id)
);`,
`CREATE TABLE IF NOT EXISTS policies (
id int NOT NULL AUTO_INCREMENT,
group_id int REFERENCES groups(id),
destination_id int REFERENCES destinations(id),
UNIQUE (group_id, destination_id),
PRIMARY KEY (id)
);`,
},
"postgres": {
`CREATE TABLE IF NOT EXISTS groups (
id SERIAL PRIMARY KEY,
guid text,
UNIQUE (guid)
);`,
`CREATE TABLE IF NOT EXISTS destinations (
id SERIAL PRIMARY KEY,
group_id int REFERENCES groups(id),
port int,
protocol text,
UNIQUE (group_id, port, protocol)
);`,
`CREATE TABLE IF NOT EXISTS policies (
id SERIAL PRIMARY KEY,
group_id int REFERENCES groups(id),
destination_id int REFERENCES destinations(id),
UNIQUE (group_id, destination_id)
);`,
},
}