diff options
author | Grail Finder <wohilas@gmail.com> | 2025-03-29 11:12:53 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2025-03-29 11:12:53 +0300 |
commit | 3921db6166e2da895257496bb76dd115556699d3 (patch) | |
tree | 1be4f739121761085f69cb7706c60dbbe98a93e9 /internal/database/migrations/001_init.up.sql |
init
Diffstat (limited to 'internal/database/migrations/001_init.up.sql')
-rw-r--r-- | internal/database/migrations/001_init.up.sql | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/database/migrations/001_init.up.sql b/internal/database/migrations/001_init.up.sql new file mode 100644 index 0000000..141a045 --- /dev/null +++ b/internal/database/migrations/001_init.up.sql @@ -0,0 +1,25 @@ +BEGIN TRANSACTION; +CREATE TABLE IF NOT EXISTS user_score ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + username TEXT UNIQUE NOT NULL, + password TEXT NOT NULL, + burn_time TIMESTAMP NOT NULL, + score SMALLINT NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS action( + 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 CURRENT_TIMESTAMP, + UNIQUE(username, name), + CONSTRAINT fk_user_score + FOREIGN KEY(username) + REFERENCES user_score(username) +); +COMMIT; |