summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-04-05 12:40:13 +0300
committerGrail Finder <wohilas@gmail.com>2025-04-05 12:40:13 +0300
commit55ed7d6bb605680a21e406a4084edb5df9f5eaec (patch)
tree3b7a306a41fb4f9ee9d2769a36ae28dfc42fe8e6
parent59a1e23dcc69fb5dd33f505e3b8f4923770e73a2 (diff)
Enha: users table
-rw-r--r--go.mod2
-rw-r--r--go.sum2
-rw-r--r--internal/database/migrations/001_init.up.sql19
3 files changed, 4 insertions, 19 deletions
diff --git a/go.mod b/go.mod
index 73fae74..42e9089 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.23
require (
github.com/jmoiron/sqlx v1.3.5
- github.com/mattn/go-sqlite3 v1.14.6
+ github.com/mattn/go-sqlite3 v1.14.27
github.com/pkg/errors v0.9.1
github.com/playwright-community/playwright-go v0.5001.0
github.com/spf13/cobra v1.8.0
diff --git a/go.sum b/go.sum
index ad9bd40..32f5761 100644
--- a/go.sum
+++ b/go.sum
@@ -34,6 +34,8 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
+github.com/mattn/go-sqlite3 v1.14.27 h1:drZCnuvf37yPfs95E5jd9s3XhdVWLal+6BOK6qrv6IU=
+github.com/mattn/go-sqlite3 v1.14.27/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
diff --git a/internal/database/migrations/001_init.up.sql b/internal/database/migrations/001_init.up.sql
index 141a045..e3b052d 100644
--- a/internal/database/migrations/001_init.up.sql
+++ b/internal/database/migrations/001_init.up.sql
@@ -1,25 +1,8 @@
BEGIN TRANSACTION;
-CREATE TABLE IF NOT EXISTS user_score (
+CREATE TABLE IF NOT EXISTS users (
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;