-
Notifications
You must be signed in to change notification settings - Fork 33
/
sqlite_dialect.go
44 lines (40 loc) · 1.37 KB
/
sqlite_dialect.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
package darwin
// SqliteDialect a Dialect configured for Sqlite3
type SqliteDialect struct{}
// CreateTableSQL returns the SQL to create the schema table
func (s SqliteDialect) CreateTableSQL() string {
return `CREATE TABLE IF NOT EXISTS darwin_migrations
(
id INTEGER PRIMARY KEY,
version FLOAT NOT NULL,
description TEXT NOT NULL,
checksum TEXT NOT NULL,
applied_at DATETIME NOT NULL,
execution_time FLOAT NOT NULL,
UNIQUE (version)
);`
}
// InsertSQL returns the SQL to insert a new migration in the schema table
func (s SqliteDialect) InsertSQL() string {
return `INSERT INTO darwin_migrations
(
version,
description,
checksum,
applied_at,
execution_time
)
VALUES (?, ?, ?, ?, ?);`
}
// AllSQL returns a SQL to get all entries in the table
func (s SqliteDialect) AllSQL() string {
return `SELECT
version,
description,
checksum,
applied_at,
execution_time
FROM
darwin_migrations
ORDER BY version ASC;`
}