diff options
author | Julien Dessaux | 2021-04-10 20:11:35 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-04-12 11:11:38 +0200 |
commit | b7c3e058e9b161065b9024458fc7be0b3c5e8cb5 (patch) | |
tree | d8a5d047f2aaabb7118a86123cd61761aa4bda6a /pkg/database/migrations.go | |
parent | Began implementing a database backend (diff) | |
download | trains-b7c3e058e9b161065b9024458fc7be0b3c5e8cb5.tar.gz trains-b7c3e058e9b161065b9024458fc7be0b3c5e8cb5.tar.bz2 trains-b7c3e058e9b161065b9024458fc7be0b3c5e8cb5.zip |
Implemented a user table and the CreateUser function
Diffstat (limited to '')
-rw-r--r-- | pkg/database/migrations.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/database/migrations.go b/pkg/database/migrations.go index cec3c41..8d23ed2 100644 --- a/pkg/database/migrations.go +++ b/pkg/database/migrations.go @@ -9,6 +9,14 @@ var allMigrations = []func(tx *sql.Tx) error{ sql := ` CREATE TABLE schema_version ( version INTEGER NOT NULL + ); + CREATE TABLE users ( + id INTEGER PRIMARY KEY, + username TEXT NOT NULL UNIQUE, + password TEXT, + email TEXT, + created_at DATE DEFAULT (datetime('now')), + last_login_at DATE DEFAULT NULL );` _, err = tx.Exec(sql) return err |