diff options
author | Julien Dessaux | 2021-04-09 23:56:16 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-04-09 23:56:16 +0200 |
commit | 824226ef686d604bc3b1e8675143dabfe8df6555 (patch) | |
tree | 913e16e3ac767f89bcb668500d7c3ef53fe58423 /pkg/database/migrations.go | |
parent | Made config tests more specific (diff) | |
download | trains-824226ef686d604bc3b1e8675143dabfe8df6555.tar.gz trains-824226ef686d604bc3b1e8675143dabfe8df6555.tar.bz2 trains-824226ef686d604bc3b1e8675143dabfe8df6555.zip |
Began implementing a database backend
Diffstat (limited to '')
-rw-r--r-- | pkg/database/migrations.go | 19 |
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 |