-
Notifications
You must be signed in to change notification settings - Fork 390
/
migrate.go
54 lines (50 loc) · 1.17 KB
/
migrate.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
48
49
50
51
52
53
54
// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package multinodedb
import (
"storj.io/storj/private/migrate"
)
// SQLite3Migration returns steps needed for migrating sqlite3 database.
func (db *DB) SQLite3Migration() *migrate.Migration {
return &migrate.Migration{
Table: "versions",
Steps: []*migrate.Step{
{
DB: &db.migrationDB,
Description: "Initial setup",
Version: 0,
Action: migrate.SQL{
`CREATE TABLE nodes (
id BLOB NOT NULL,
name TEXT NOT NULL,
public_address TEXT NOT NULL,
api_secret BLOB NOT NULL,
PRIMARY KEY ( id )
); `,
},
},
},
}
}
// PostgresMigration returns steps needed for migrating postgres database.
func (db *DB) PostgresMigration() *migrate.Migration {
return &migrate.Migration{
Table: "versions",
Steps: []*migrate.Step{
{
DB: &db.migrationDB,
Description: "Initial setup",
Version: 0,
Action: migrate.SQL{
`CREATE TABLE nodes (
id bytea NOT NULL,
name text NOT NULL,
public_address text NOT NULL,
api_secret bytea NOT NULL,
PRIMARY KEY ( id )
);`,
},
},
},
}
}