Files
Yggdrasil/data/ddl/16_players_skins.sql
azures04 87407fe604 Add DDL-based DB init and bootstrap
Add bootstrap entrypoint and migrate DB schema setup to SQL files. Introduces bootstrap.js, many data/ddl/*.sql files, and a new runDDL() in modules/database.js (exports pool and runDDL). Remove legacy modules/databaseGlobals.js. Update repositories and code to use database.pool.query calls. Bump package version and set main to bootstrap.js. Clean up server.js to remove inline DB/cert init (now handled by bootstrap). Overall: refactor DB initialization to run ordered SQL DDL files and centralize startup logic.
2026-09-06 23:52:25 +02:00

12 lines
501 B
SQL

CREATE TABLE IF NOT EXISTS playersSkins (
playerUuid VARCHAR(36) NOT NULL,
assetHash VARCHAR(64) NOT NULL,
variant VARCHAR(10) DEFAULT "CLASSIC",
isSelected TINYINT(1) DEFAULT 0,
createdAt DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (playerUuid, assetHash),
FOREIGN KEY (playerUuid) REFERENCES players(uuid) ON DELETE CASCADE,
FOREIGN KEY (assetHash) REFERENCES textures(hash)
);
CREATE INDEX IF NOT EXISTS idx_active_skin ON playersSkins (playerUuid, isSelected);