diff --git a/db.js b/db.js index 7e81ccb..fd7e44a 100644 --- a/db.js +++ b/db.js @@ -31,6 +31,11 @@ try { db.exec(`ALTER TABLE fiddles ADD COLUMN listed INTEGER NOT NULL DEFAULT 1`); } catch (_) { /* column already exists */ } +// Migration: add options column (JSON string for per-fiddle settings like tailwind) +try { + db.exec(`ALTER TABLE fiddles ADD COLUMN options TEXT NOT NULL DEFAULT '{}'`); +} catch (_) { /* column already exists */ } + // Tags tables db.exec(` CREATE TABLE IF NOT EXISTS tags ( @@ -51,14 +56,14 @@ db.exec(`CREATE INDEX IF NOT EXISTS idx_fiddles_listed_updated ON fiddles(listed export const stmts = { insert: db.prepare(` - INSERT INTO fiddles (id, title, html, css, css_type, js, js_type, listed) - VALUES (@id, @title, @html, @css, @css_type, @js, @js_type, @listed) + INSERT INTO fiddles (id, title, html, css, css_type, js, js_type, listed, options) + VALUES (@id, @title, @html, @css, @css_type, @js, @js_type, @listed, @options) `), get: db.prepare('SELECT * FROM fiddles WHERE id = ?'), update: db.prepare(` UPDATE fiddles SET title = @title, html = @html, css = @css, css_type = @css_type, js = @js, js_type = @js_type, listed = @listed, - updated_at = datetime('now') + options = @options, updated_at = datetime('now') WHERE id = @id `), list: db.prepare('SELECT id, title, css_type, js_type, created_at, updated_at FROM fiddles ORDER BY updated_at DESC LIMIT 50'), diff --git a/public/browse.html b/public/browse.html index ea4b7bc..dd6a40b 100644 --- a/public/browse.html +++ b/public/browse.html @@ -22,6 +22,8 @@ + + + Tailwind +