From 9fb9a94aa2d3bdb90f088f7188053374155a6715 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 6 Jun 2026 16:15:14 +0530 Subject: Add video/gif generation + add wavey example --- setup.sql | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'setup.sql') diff --git a/setup.sql b/setup.sql index 3a80a8c..0a56f55 100644 --- a/setup.sql +++ b/setup.sql @@ -4,7 +4,17 @@ PRAGMA temp_store = MEMORY; CREATE TABLE images ( id TEXT PRIMARY KEY, width INTEGER NOT NULL, - height INTEGER NOT NULL + height INTEGER NOT NULL, + video_id TEXT, + frame INTEGER DEFAULT 0, + FOREIGN KEY(video_id) REFERENCES videos(id) ON DELETE CASCADE +); + +CREATE TABLE videos ( + id TEXT PRIMARY KEY, + width INTEGER NOT NULL, + height INTEGER NOT NULL, + fps INTEGER NOT NULL ); CREATE TABLE pixels ( @@ -15,7 +25,7 @@ CREATE TABLE pixels ( r INTEGER NOT NULL CHECK(r >= 0 AND r <= 255), g INTEGER NOT NULL CHECK(g >= 0 AND g <= 255), b INTEGER NOT NULL CHECK(b >= 0 AND b <= 255), - -- FOREIGN KEY(image_id) REFERENCES images(id) ON DELETE CASCADE, + FOREIGN KEY(image_id) REFERENCES images(id) ON DELETE CASCADE, UNIQUE(image_id, x, y) ); @@ -24,3 +34,9 @@ BEFORE INSERT ON images BEGIN DELETE FROM pixels WHERE image_id = NEW.id; END; + +CREATE TRIGGER delete_frames_when_video_reinserted_because_i_said_so_and_to_make_rerunning_easier +BEFORE INSERT ON videos +BEGIN + DELETE FROM images WHERE video_id = NEW.id; +END; -- cgit v1.3.1