refact: migrate sqlx + sqlite to tokio-postgresql

This commit is contained in:
Henri Bourcereau 2026-04-22 21:36:56 +02:00
parent 4f5e21becb
commit 03b614c62e
12 changed files with 838 additions and 250 deletions

View file

@ -1,24 +1,24 @@
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
email TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
created_at INTEGER NOT NULL
id BIGSERIAL PRIMARY KEY,
username TEXT NOT NULL UNIQUE,
email TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
created_at BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS game_records (
id INTEGER PRIMARY KEY AUTOINCREMENT,
game_id TEXT NOT NULL,
room_code TEXT NOT NULL,
started_at INTEGER NOT NULL,
ended_at INTEGER,
id BIGSERIAL PRIMARY KEY,
game_id TEXT NOT NULL,
room_code TEXT NOT NULL,
started_at BIGINT NOT NULL,
ended_at BIGINT,
result TEXT
);
CREATE TABLE IF NOT EXISTS game_participants (
id INTEGER PRIMARY KEY AUTOINCREMENT,
game_record_id INTEGER NOT NULL REFERENCES game_records(id),
user_id INTEGER REFERENCES users(id),
player_id INTEGER NOT NULL,
id BIGSERIAL PRIMARY KEY,
game_record_id BIGINT NOT NULL REFERENCES game_records(id),
user_id BIGINT REFERENCES users(id),
player_id BIGINT NOT NULL,
outcome TEXT
);