webapp
Build / build (push) Has been cancelled

This commit is contained in:
gpatruno
2026-06-06 21:59:51 +02:00
parent 02d2af0993
commit 48a1b900c7
279 changed files with 7488 additions and 238 deletions
@@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS player_profiles (
uuid TEXT PRIMARY KEY,
display_name TEXT NOT NULL,
level INTEGER NOT NULL DEFAULT 1,
experience INTEGER NOT NULL DEFAULT 0,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
);
@@ -0,0 +1,63 @@
-- MMORPG progression schema: classes, powers, jobs, races, groups.
-- New columns on player_profiles. SQLite ignores duplicate ADD COLUMN guarded by
-- the migration runner (each migration is applied at most once via schema_migrations).
ALTER TABLE player_profiles ADD COLUMN class_id TEXT;
ALTER TABLE player_profiles ADD COLUMN powers TEXT NOT NULL DEFAULT '[]';
ALTER TABLE player_profiles ADD COLUMN jobs TEXT NOT NULL DEFAULT '[]';
ALTER TABLE player_profiles ADD COLUMN guild_id TEXT;
ALTER TABLE player_profiles ADD COLUMN group_id TEXT;
ALTER TABLE player_profiles ADD COLUMN is_connected INTEGER NOT NULL DEFAULT 0;
ALTER TABLE player_profiles ADD COLUMN total_time_play INTEGER NOT NULL DEFAULT 0;
ALTER TABLE player_profiles ADD COLUMN last_date_connected INTEGER NOT NULL DEFAULT 0;
ALTER TABLE player_profiles ADD COLUMN date_creation INTEGER NOT NULL DEFAULT 0;
ALTER TABLE player_profiles ADD COLUMN money INTEGER NOT NULL DEFAULT 0;
ALTER TABLE player_profiles ADD COLUMN race_id TEXT NOT NULL DEFAULT 'human';
-- Backfill creation date for profiles that predate this migration.
UPDATE player_profiles SET date_creation = created_at WHERE date_creation = 0;
-- Reference tables (definitions persisted for inspection / future editing).
CREATE TABLE IF NOT EXISTS classes (
id TEXT PRIMARY KEY,
display_name TEXT NOT NULL,
description TEXT NOT NULL DEFAULT '',
weapons TEXT NOT NULL DEFAULT '[]'
);
CREATE TABLE IF NOT EXISTS powers (
id TEXT PRIMARY KEY,
display_name TEXT NOT NULL,
description TEXT NOT NULL DEFAULT '',
passive INTEGER NOT NULL DEFAULT 1
);
CREATE TABLE IF NOT EXISTS jobs (
id TEXT PRIMARY KEY,
display_name TEXT NOT NULL,
description TEXT NOT NULL DEFAULT ''
);
CREATE TABLE IF NOT EXISTS races (
id TEXT PRIMARY KEY,
display_name TEXT NOT NULL,
description TEXT NOT NULL DEFAULT '',
xp_multiplier REAL NOT NULL DEFAULT 1.0
);
-- Groups (parties): shared XP between members.
CREATE TABLE IF NOT EXISTS groups (
id TEXT PRIMARY KEY,
owner_uuid TEXT NOT NULL,
created_at INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS group_members (
group_id TEXT NOT NULL,
player_uuid TEXT NOT NULL,
joined_at INTEGER NOT NULL,
PRIMARY KEY (group_id, player_uuid),
FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_group_members_player ON group_members(player_uuid);