Cotton code
182 lines · 4.6 KB · JSONRaw
{  "format_version": 1,  "id": "screenplay_document",  "name": "Screenplay document",  "plural": "Screenplay documents",  "picture": null,  "builtin": true,  "delete": false,  "engine": "screenplay",  "columns": [    {      "key": "screenplay_id",      "name": "Screenplay",      "type": "link",      "link_to": "screenplay",      "readonly": true    },    {      "key": "kind",      "type": "text",      "required": true,      "readonly": true,      "format": "words"    },    {      "key": "body",      "type": "longtext",      "required": true    }  ],  "title": "kind",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "kind",    "subtitle": null,    "trailing": null,    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "kind",        "body"      ]    }  ],  "empty": {    "title": "No documents yet",    "message": "Ask your assistant to write one — it lives beside the scenes, not inside them."  },  "instructions": "A screenplay document is supporting prose for one screenplay, one per kind, such as the story, the outline or notes. Rewrite the whole body when it changes, and keep the kind a short lowercase word.",  "tables": [    {      "name": "cotton_screenplay_documents",      "columns": [        {          "name": "id",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": true,          "declaration": "\n    id TEXT PRIMARY KEY",          "position": 0        },        {          "name": "workspace_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    workspace_id TEXT NOT NULL",          "position": 1        },        {          "name": "screenplay_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    screenplay_id TEXT NOT NULL",          "position": 2        },        {          "name": "kind",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    kind TEXT NOT NULL",          "position": 3        },        {          "name": "body",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    body TEXT NOT NULL",          "position": 4        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 5        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 6        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 7        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 8        },        {          "name": "trashed_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": " trashed_at TEXT",          "position": 9        }      ],      "constraints": [        {          "declaration": "\n    UNIQUE (screenplay_id, kind)",          "position": 10        },        {          "declaration": "\n    CHECK (length(kind) BETWEEN 1 AND 40 AND NOT kind GLOB '*[^a-z0-9_-]*')",          "position": 11        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 12        },        {          "declaration": "\n    FOREIGN KEY (screenplay_id) REFERENCES cotton_screenplays(id)\n  ",          "position": 13        }      ],      "prefix": "CREATE TABLE cotton_screenplay_documents (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_screenplay_documents_author ON cotton_screenplay_documents (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ]}