From 3921db6166e2da895257496bb76dd115556699d3 Mon Sep 17 00:00:00 2001
From: Grail Finder <wohilas@gmail.com>
Date: Sat, 29 Mar 2025 11:12:53 +0300
Subject: init

---
 internal/database/migrations/001_init.up.sql | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 internal/database/migrations/001_init.up.sql

(limited to 'internal/database/migrations/001_init.up.sql')

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;
-- 
cgit v1.2.3

