Update server/src/schema.sql

This commit is contained in:
2025-11-13 15:36:45 +00:00
parent 7a46d7bab1
commit 3733769c3b

View File

@@ -1,14 +1,10 @@
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
username TEXT UNIQUE NOT NULL,
passhash TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT now()
);
-- Characters are now the primary login entity.
-- Each character has its own username + password hash.
CREATE TABLE IF NOT EXISTS characters (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
name TEXT NOT NULL,
username TEXT UNIQUE NOT NULL,
passhash TEXT NOT NULL,
x INTEGER NOT NULL DEFAULT 100,
y INTEGER NOT NULL DEFAULT 100,
level INTEGER NOT NULL DEFAULT 1,
@@ -31,4 +27,4 @@ CREATE TABLE IF NOT EXISTS inventory (
);
CREATE UNIQUE INDEX IF NOT EXISTS inventory_unique_item
ON inventory (character_id, item_key);
ON inventory (character_id, item_key);