Cotton code
386 lines · 9.1 KB · JSONRaw
{  "format_version": 1,  "id": "release",  "setup": true,  "name": "Release",  "plural": "Releases",  "picture": null,  "builtin": true,  "delete": false,  "engine": "repos",  "columns": [    {      "key": "repo_id",      "name": "Repository",      "type": "link",      "link_to": "repository",      "readonly": true    },    {      "key": "tag",      "type": "text",      "required": true,      "readonly": true    },    {      "key": "name",      "type": "text",      "readonly": true    },    {      "key": "body",      "name": "Notes",      "type": "longtext",      "markdown": true,      "readonly": true    },    {      "key": "draft",      "type": "bool",      "readonly": true    },    {      "key": "prerelease",      "name": "Pre-release",      "type": "bool",      "readonly": true    },    {      "key": "target_sha",      "name": "Commit",      "type": "text",      "readonly": true    },    {      "key": "author",      "type": "text",      "readonly": true    },    {      "key": "published_at",      "name": "Published",      "type": "date",      "readonly": true    },    {      "key": "html_url",      "name": "Web address",      "type": "text",      "readonly": true    },    {      "key": "title_line",      "name": "Release",      "type": "text",      "readonly": true    },    {      "key": "stamp",      "type": "text",      "readonly": true    },    {      "key": "meta_line",      "name": "About it",      "type": "text",      "readonly": true    },    {      "key": "facts_line",      "name": "Made",      "type": "text",      "readonly": true    },    {      "key": "origin",      "name": "Hosted on",      "type": "text",      "readonly": true    },    {      "key": "assets",      "name": "Assets",      "type": "longtext",      "readonly": true    },    {      "key": "asset_keys",      "name": "Asset keys",      "type": "longtext",      "readonly": true    }  ],  "title": "title_line",  "date": "published_at",  "project": null,  "order": null,  "slip": {    "title": "title_line",    "subtitle": "meta_line",    "trailing": "stamp",    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "title_line",        "tag",        "stamp",        "facts_line"      ]    },    {      "heading": "Notes",      "columns": [        "body"      ]    },    {      "heading": "Assets",      "columns": [        "assets"      ]    },    {      "heading": "Details",      "columns": [        "name",        "draft",        "prerelease",        "author",        "published_at",        "target_sha",        "html_url",        "repo_id"      ]    }  ],  "instructions": "A release is a tagged version of a repository with its notes and downloadable files. The tag is unique within the repository; when the name is empty the tag stands in for it. An asset's bytes are fetched to this device only when the person asks for that one asset.",  "add": false,  "empty": {    "title": "No releases held yet.",    "message": "The Mac that serves you files a repository's releases, and their assets, once it holds the repository's bytes."  },  "tables": [    {      "name": "cotton_repo_releases",      "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": "repo_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    repo_id TEXT NOT NULL",          "position": 2        },        {          "name": "tag",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    tag TEXT NOT NULL",          "position": 3        },        {          "name": "name",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    name TEXT",          "position": 4        },        {          "name": "body",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    body TEXT",          "position": 5        },        {          "name": "draft",          "type": "INTEGER",          "default": "0",          "nullable": false,          "primary_key": false,          "declaration": "\n    draft INTEGER NOT NULL DEFAULT 0",          "position": 6        },        {          "name": "prerelease",          "type": "INTEGER",          "default": "0",          "nullable": false,          "primary_key": false,          "declaration": "\n    prerelease INTEGER NOT NULL DEFAULT 0",          "position": 7        },        {          "name": "target_sha",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    target_sha TEXT",          "position": 8        },        {          "name": "author",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    author TEXT",          "position": 9        },        {          "name": "published_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    published_at TEXT",          "position": 10        },        {          "name": "assets_json",          "type": "TEXT",          "default": "'[]'",          "nullable": false,          "primary_key": false,          "declaration": "\n    assets_json TEXT NOT NULL DEFAULT '[]'",          "position": 11        },        {          "name": "html_url",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    html_url TEXT",          "position": 12        },        {          "name": "remote_id",          "type": "INTEGER",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_id INTEGER",          "position": 13        },        {          "name": "synced_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    synced_at TEXT",          "position": 14        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 15        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 16        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 17        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 18        }      ],      "constraints": [        {          "declaration": "\n    UNIQUE (workspace_id, repo_id, tag)",          "position": 19        },        {          "declaration": "\n    CHECK (draft IN (0, 1))",          "position": 20        },        {          "declaration": "\n    CHECK (prerelease IN (0, 1))",          "position": 21        },        {          "declaration": "\n    CHECK (length(trim(tag)) > 0)",          "position": 22        },        {          "declaration": "\n    CHECK (json_type(assets_json) = 'array')",          "position": 23        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 24        },        {          "declaration": "\n    FOREIGN KEY (repo_id) REFERENCES cotton_repos(id)\n  ",          "position": 25        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_repo_releases (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_releases_repo ON cotton_repo_releases (workspace_id, repo_id, published_at DESC)",        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_releases_author ON cotton_repo_releases (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ]}