From 2512da7ca57dc4c52900417a50daf4f6f2f74054 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sun, 21 Jul 2024 18:12:49 +0900
Subject: add sqldef and sqlc

---
 backend/schema.sql | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 backend/schema.sql

(limited to 'backend/schema.sql')

diff --git a/backend/schema.sql b/backend/schema.sql
new file mode 100644
index 0000000..6a2db2d
--- /dev/null
+++ b/backend/schema.sql
@@ -0,0 +1,23 @@
+CREATE TABLE users (
+    user_id SERIAL PRIMARY KEY,
+    username VARCHAR(64) NOT NULL UNIQUE,
+    display_username VARCHAR(64) NOT NULL,
+    icon_url VARCHAR(255),
+    is_admin BOOLEAN NOT NULL,
+    created_at TIMESTAMP NOT NULL DEFAULT NOW()
+);
+
+CREATE TABLE user_auths (
+    user_auth_id SERIAL PRIMARY KEY,
+    user_id INT NOT NULL,
+    auth_type VARCHAR(16) NOT NULL,
+    password_hash VARCHAR(256),
+    CONSTRAINT fk_user_id FOREIGN KEY(user_id) REFERENCES users(user_id)
+);
+
+CREATE TABLE games (
+    game_id SERIAL PRIMARY KEY,
+    type VARCHAR(255) NOT NULL,
+    created_at TIMESTAMP NOT NULL DEFAULT NOW(),
+    state VARCHAR(255) NOT NULL
+);
-- 
cgit v1.3.1

