{ "format_version": 1, "id": "news_settings", "name": "News setting", "plural": "News settings", "builtin": true, "visibility": "owner", "columns": [ { "key": "edition_times", "type": "longtext", "readonly": true }, { "key": "timezone", "name": "Time zone", "type": "text", "zone": true }, { "key": "stale_after_minutes", "type": "number", "readonly": true }, { "key": "stale_refresh", "name": "Refresh when I open Cotton", "type": "bool" }, { "key": "notify", "name": "Tell me when an edition is ready", "type": "bool" }, { "key": "next_edition_at", "type": "date", "format": "calendar-datetime", "readonly": true }, { "key": "name", "type": "text", "readonly": true }, { "key": "first_edition", "name": "First edition", "type": "time" }, { "key": "second_edition", "name": "Second edition", "type": "time" } ], "instructions": "The news schedule: one record holding the two times of day an edition is written, the time zone they are read in, whether a stale edition is written again, and whether a new edition notifies the owner. A database that never saved a schedule reads 07:00 and 19:00 with both switches on. stale_after_minutes is set by Cotton.", "tables": [ { "name": "cotton_news_settings", "columns": [ { "name": "workspace_id", "type": "TEXT", "default": null, "nullable": true, "primary_key": true, "declaration": "\n workspace_id TEXT PRIMARY KEY", "position": 0 }, { "name": "edition_times", "type": "TEXT", "default": "'[\"07:00\", \"19:00\"]'", "nullable": false, "primary_key": false, "declaration": "\n edition_times TEXT NOT NULL DEFAULT '[\"07:00\", \"19:00\"]'", "position": 1 }, { "name": "timezone", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n timezone TEXT NOT NULL", "position": 2 }, { "name": "stale_after_minutes", "type": "INTEGER", "default": "360", "nullable": false, "primary_key": false, "declaration": "\n stale_after_minutes INTEGER NOT NULL DEFAULT 360", "position": 3 }, { "name": "stale_refresh", "type": "INTEGER", "default": "1", "nullable": false, "primary_key": false, "declaration": "\n stale_refresh INTEGER NOT NULL DEFAULT 1", "position": 4 }, { "name": "notify", "type": "INTEGER", "default": "1", "nullable": false, "primary_key": false, "declaration": "\n notify INTEGER NOT NULL DEFAULT 1", "position": 5 }, { "name": "next_edition_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n next_edition_at TEXT", "position": 6 }, { "name": "created_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n created_at TEXT NOT NULL", "position": 7 }, { "name": "updated_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n updated_at TEXT NOT NULL", "position": 8 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 9 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 10 } ], "constraints": [ { "declaration": "\n CHECK (json_type(edition_times) = 'array')", "position": 11 }, { "declaration": "\n CHECK (stale_after_minutes > 0)", "position": 12 }, { "declaration": "\n CHECK (length(trim(timezone)) > 0)", "position": 13 }, { "declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ", "position": 14 } ], "prefix": "CREATE TABLE cotton_news_settings (", "suffix": ")", "indexes": [ "CREATE INDEX IF NOT EXISTS idx_cotton_news_settings_author ON cotton_news_settings (substr(_hlc, 20), _hlc)" ], "full_text": [], "triggers": [] } ], "picture": { "photo": "photo:54118bbc8327cc8d43e587bd19db1841feff49cc5220ae6ca7384167e9cb414e", "object": "tool-news" }, "engine": "news", "title": "name", "date": null, "project": null, "order": null, "slip": { "title": "name", "subtitle": null, "trailing": null, "photo": null, "toggle": null }, "tile": { "face": "slip-list" }, "page": [ { "heading": null, "columns": [ "first_edition", "second_edition", "timezone", "stale_refresh", "notify" ] } ], "add": false, "delete": false, "related": [ { "label": "Topics", "table": "news_topic", "new": true }, { "label": "Past editions", "table": "news_edition" } ] }