summaryrefslogtreecommitdiff
path: root/internal/database/migrations/001_init.up.sql
diff options
context:
space:
mode:
authorGrailFinder <wohilas@gmail.com>2024-05-18 13:27:28 +0300
committerGrailFinder <wohilas@gmail.com>2024-05-18 13:27:28 +0300
commit2e9b18944eac3dcaf8a006594cb338d94c07a447 (patch)
tree7715140a6951407d13781e0a5bbf83a6e8f9dbe9 /internal/database/migrations/001_init.up.sql
parentff86222fc9ab85fb4c5c5e8a063083595b323761 (diff)
Feat: auth; login; signup; migrate to sqlite
Diffstat (limited to 'internal/database/migrations/001_init.up.sql')
-rw-r--r--internal/database/migrations/001_init.up.sql11
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/database/migrations/001_init.up.sql b/internal/database/migrations/001_init.up.sql
index 80ebcad..f7e41c1 100644
--- a/internal/database/migrations/001_init.up.sql
+++ b/internal/database/migrations/001_init.up.sql
@@ -1,21 +1,22 @@
BEGIN;
CREATE TABLE user_score (
- id INT GENERATED BY DEFAULT AS IDENTITY,
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
- burn_time TIMESTAMP NOT NULL DEFAULT NOW() + interval '1 day',
+ password TEXT NOT NULL,
+ burn_time TIMESTAMP NOT NULL,
score SMALLINT NOT NULL,
- created_at TIMESTAMP NOT NULL DEFAULT NOW()
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE action (
- id INT GENERATED BY DEFAULT AS IDENTITY,
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
magnitude SMALLINT NOT NULL DEFAULT 1,
repeatable BOOLEAN NOT NULL DEFAULT FALSE,
type TEXT NOT NULL,
done BOOLEAN NOT NULL DEFAULT FALSE,
username TEXT NOT NULL,
- created_at TIMESTAMP NOT NULL DEFAULT NOW(),
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE(username, name),
CONSTRAINT fk_user_score
FOREIGN KEY(username)