Cotton code
204 lines · 4.7 KB · JSONRaw
{  "format_version": 1,  "id": "screenplay_draft",  "name": "Draft",  "plural": "Drafts",  "builtin": true,  "visibility": "owner",  "date": "created_at",  "title": "name",  "columns": [    {      "key": "screenplay_id",      "name": "Screenplay",      "type": "link",      "link_to": "screenplay",      "required": true,      "readonly": true    },    {      "key": "name",      "name": "Draft",      "type": "text",      "readonly": true    },    {      "key": "created_at",      "name": "Frozen",      "type": "date",      "readonly": true    },    {      "key": "script",      "name": "Script",      "type": "longtext",      "readonly": true    }  ],  "instructions": "A draft is a frozen copy of a screenplay's scenes, kept under a name. It is read-only: the script is the scenes as they stood when it was frozen, assembled as Fountain by the engine.",  "card": {    "face": "plain",    "fields": [      {        "slot": "title",        "column": "name"      },      {        "slot": "facts",        "column": "created_at"      }    ],    "pages": [      "script"    ]  },  "tables": [    {      "name": "cotton_screenplay_drafts",      "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": "name",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    name TEXT NOT NULL",          "position": 3        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 4        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 5        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 6        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 7        }      ],      "constraints": [        {          "declaration": "\n    CHECK (length(trim(name)) > 0)",          "position": 8        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 9        },        {          "declaration": "\n    FOREIGN KEY (screenplay_id) REFERENCES cotton_screenplays(id)\n  ",          "position": 10        }      ],      "prefix": "CREATE TABLE cotton_screenplay_drafts (",      "suffix": ")",      "indexes": [        "CREATE INDEX idx_cotton_screenplay_drafts_screenplay ON cotton_screenplay_drafts (screenplay_id, created_at)",        "CREATE INDEX IF NOT EXISTS idx_cotton_screenplay_drafts_author ON cotton_screenplay_drafts (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ],  "picture": null,  "engine": "screenplay",  "project": null,  "order": null,  "slip": {    "title": "name",    "subtitle": null,    "trailing": "created_at",    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name"      ]    },    {      "heading": null,      "columns": [        "screenplay_id",        "created_at"      ],      "role": "facts"    },    {      "heading": null,      "columns": [        "script"      ],      "role": "main"    }  ],  "page_parts": [    "title",    "facts",    "script",    "grid"  ],  "sort": {    "column": "created_at",    "descending": true  },  "delete": false}