diff --git a/controller/store/sql/000_base.sql b/controller/store/sql/000_base.sql index 699109be..9aa7569e 100644 --- a/controller/store/sql/000_base.sql +++ b/controller/store/sql/000_base.sql @@ -15,3 +15,15 @@ create table accounts ( constraint chk_password check (username <> ''), 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 <> '') +); \ No newline at end of file diff --git a/controller/store/store.go b/controller/store/store.go index f471a7a5..5285d956 100644 --- a/controller/store/store.go +++ b/controller/store/store.go @@ -54,6 +54,7 @@ func (self *Store) migrate() error { FileSystem: sql.Fs, Root: "/", } + migrate.SetTable("migrations") n, err := migrate.Exec(self.db.DB, "sqlite3", migrations, migrate.Up) if err != nil { return errors.Wrap(err, "error running migrations")