// A presentation's theme, whether or not the model produced a structured deck. // // The theme lived only inside the deck JSON, so a presentation that fell back // to markdown slides — 28 of the 41 in production — had nowhere to keep one, // and "change template" answered that it had no layout to change. The column // holds the author's choice for every presentation; a deck's own theme field // is kept in step with it. exports.up = pgm => pgm.sql(` ALTER TABLE user_resources ADD COLUMN IF NOT EXISTS theme TEXT; UPDATE user_resources SET theme = deck->>'theme' WHERE theme IS NULL AND deck IS NOT NULL AND deck->>'theme' IS NOT NULL; `); exports.down = pgm => pgm.sql(` ALTER TABLE user_resources DROP COLUMN IF EXISTS theme; `);