Files
Yggdrasil/data/ddl/20_auto_assign_random_default_skin.sql
T
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

23 lines
664 B
SQL

DROP TRIGGER IF EXISTS auto_assign_random_default_skin;
CREATE TRIGGER auto_assign_random_default_skin
AFTER INSERT ON players
FOR EACH ROW
BEGIN
INSERT INTO playersSkins (playerUuid, assetHash, variant, isSelected)
SELECT
NEW.uuid,
hash,
CASE
WHEN hash = '4c7b0468044bfecacc43d00a3a69335a834b73937688292c20d3988cae58248d' THEN 'CLASSIC'
ELSE 'SLIM'
END,
1
FROM textures
WHERE hash IN (
'4c7b0468044bfecacc43d00a3a69335a834b73937688292c20d3988cae58248d',
'df8ed96c557d441a63e7b6a4a911ab84fa453b42fc2ae6b01c3e1b02e138168c'
)
ORDER BY RAND()
LIMIT 1;
END;