aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/migrations.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/database/migrations.go')
-rw-r--r--pkg/database/migrations.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/database/migrations.go b/pkg/database/migrations.go
new file mode 100644
index 0000000..cec3c41
--- /dev/null
+++ b/pkg/database/migrations.go
@@ -0,0 +1,19 @@
+package database
+
+import "database/sql"
+
+// allMigrations is the list of migrations to perform to get an up to date database
+// Order is important. Add new migrations at the end of the list.
+var allMigrations = []func(tx *sql.Tx) error{
+ func(tx *sql.Tx) (err error) {
+ sql := `
+ CREATE TABLE schema_version (
+ version INTEGER NOT NULL
+ );`
+ _, err = tx.Exec(sql)
+ return err
+ },
+}
+
+// This variable exists so that tests can override it
+var migrations = allMigrations