Files
Forge-Engine/screens/animations/ensure_animation_schema.py
T
williamandwilliam 3f4ebc4527
Build and deploy / build-and-push (push) Successful in 17s
Build and deploy / deploy (push) Successful in 10s
first commit
2026-08-21 16:23:49 +02:00

30 lines
1.1 KiB
Python

import db
def ensure_animation_schema(slug):
"""Crée la table des clips d'animation si elle n'existe pas encore —
même principe que ensure_flow_schema.py : un jeu créé avant l'ajout de
cette fonctionnalité n'a pas besoin d'être migré à la main, la première
ouverture du panneau timeline suffit."""
conn = db.connect(slug)
conn.executescript(
"""
CREATE TABLE IF NOT EXISTS _animation_clips (
id INTEGER PRIMARY KEY AUTOINCREMENT,
screen_id INTEGER NOT NULL REFERENCES _screens(id) ON DELETE CASCADE,
element_id INTEGER NOT NULL REFERENCES _screen_elements(id) ON DELETE CASCADE,
kind TEXT NOT NULL DEFAULT 'animate_css',
animate_name TEXT,
custom_keyframes TEXT,
start_time REAL NOT NULL DEFAULT 0,
duration REAL NOT NULL DEFAULT 1,
delay REAL NOT NULL DEFAULT 0,
easing TEXT NOT NULL DEFAULT 'ease',
iteration_count TEXT NOT NULL DEFAULT '1',
created_at TEXT DEFAULT CURRENT_TIMESTAMP
);
"""
)
conn.commit()
conn.close()