set migrations table name

This commit is contained in:
Michael Quigley 2022-07-29 11:10:39 -04:00
parent e3f4eb33fe
commit abad64c808
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 13 additions and 0 deletions

View File

@ -15,3 +15,15 @@ create table accounts (
constraint chk_password check (username <> ''), constraint chk_password check (username <> ''),
constraint chk_token check(token <> '') constraint chk_token check(token <> '')
); );
--
-- services
--
create table services (
id integer primary key,
name string not null unique,
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
constraint chk_name check (name <> '')
);

View File

@ -54,6 +54,7 @@ func (self *Store) migrate() error {
FileSystem: sql.Fs, FileSystem: sql.Fs,
Root: "/", Root: "/",
} }
migrate.SetTable("migrations")
n, err := migrate.Exec(self.db.DB, "sqlite3", migrations, migrate.Up) n, err := migrate.Exec(self.db.DB, "sqlite3", migrations, migrate.Up)
if err != nil { if err != nil {
return errors.Wrap(err, "error running migrations") return errors.Wrap(err, "error running migrations")