text_templates / catalog_schema.sql
Visecall's picture
Replace text template catalog with 2159 classified entries and pinned download assets
ddc766a verified
Raw History Blame Contribute Delete
2.18 kB
CREATE TABLE categories(name TEXT PRIMARY KEY,position INTEGER NOT NULL);
CREATE TABLE component_scripts(resource_id TEXT REFERENCES components(id),path TEXT,sha256 TEXT,language TEXT,hooks_json TEXT,PRIMARY KEY(resource_id,path));
CREATE TABLE components(id TEXT PRIMARY KEY,status TEXT,type TEXT,md5 TEXT,source_sha256 TEXT,engine TEXT,families_json TEXT,script_variant TEXT);
CREATE TABLE dependencies(template_id TEXT REFERENCES templates(id),resource_id TEXT REFERENCES components(id),type TEXT,status TEXT,bundle_path TEXT,resource_path TEXT,PRIMARY KEY(template_id,resource_id));
CREATE TABLE meta(key TEXT PRIMARY KEY,value TEXT NOT NULL);
CREATE TABLE template_categories(template_id TEXT REFERENCES templates(id),category TEXT REFERENCES categories(name),PRIMARY KEY(template_id,category));
CREATE TABLE template_families(template_id TEXT REFERENCES templates(id),family TEXT,PRIMARY KEY(template_id,family));
CREATE TABLE template_scripts(template_id TEXT REFERENCES templates(id),path TEXT,sha256 TEXT,language TEXT,hooks_json TEXT,PRIMARY KEY(template_id,path));
CREATE TABLE templates(id TEXT PRIMARY KEY,name TEXT,category TEXT,categories_json TEXT,
position INTEGER,engine TEXT,runtime_version TEXT,script_variant TEXT,source_timestamp TEXT,
status TEXT,downloadable INTEGER,download_url TEXT,package_url TEXT,package_path TEXT,
package_sha256 TEXT,package_md5 TEXT,package_bytes INTEGER,source_sha256 TEXT,source_md5 TEXT,
preview_url TEXT,preview_path TEXT,preview_sha256 TEXT,preview_bytes INTEGER,
fallback_preview_url TEXT,poster_path TEXT,poster_sha256 TEXT,poster_bytes INTEGER,
duration_ms INTEGER,preview_duration_ms INTEGER,animated INTEGER,encoded_frames INTEGER,
preview_text TEXT,capture_size INTEGER,width INTEGER,height INTEGER,fps INTEGER,playback_rate REAL,
is_vip INTEGER,text_template_json TEXT,style_json TEXT,diagnostics_json TEXT);
CREATE INDEX template_family_idx ON template_families(family,template_id);
CREATE INDEX template_status_idx ON templates(downloadable,position);
CREATE VIEW available_templates AS SELECT * FROM templates WHERE downloadable=1;