monorepo/visions/server/migrations/01-initial-db/up.sql

39 lines
681 B
MySQL
Raw Normal View History

CREATE TABLE users(
uuid TEXT PRIMARY KEY,
2024-12-27 19:02:43 +00:00
name TEXT UNIQUE,
password TEXT,
admin BOOLEAN,
enabled BOOLEAN
);
2024-12-27 19:02:43 +00:00
CREATE TABLE sessions(
id TEXT PRIMARY KEY,
user_id TEXT,
FOREIGN KEY(user_id) REFERENCES users(uuid)
);
CREATE TABLE games(
uuid TEXT PRIMARY KEY,
name TEXT
);
CREATE TABLE characters(
uuid TEXT PRIMARY KEY,
game TEXT,
data TEXT,
FOREIGN KEY(game) REFERENCES games(uuid)
);
CREATE TABLE roles(
user_id TEXT,
game_id TEXT,
role TEXT,
FOREIGN KEY(user_id) REFERENCES users(uuid),
FOREIGN KEY(game_id) REFERENCES games(uuid)
);
2024-12-31 17:56:05 +00:00
INSERT INTO users VALUES ('admin', 'admin', '', true, true);