Cotton code
437 lines · 10.2 KB · JSONRaw
{  "format_version": 1,  "id": "repo_comment",  "name": "Repository comment",  "plural": "Repository comments",  "picture": null,  "builtin": true,  "delete": false,  "engine": "repos",  "screen_family": "core",  "columns": [    {      "key": "repo_id",      "name": "Repository",      "type": "link",      "link_to": "repository",      "readonly": true    },    {  "key": "target_kind",  "name": "On",  "type": "choice",  "choices": [    "pull",    "issue"  ],  "readonly": true,  "labels": {    "pull": "Pull request",    "issue": "Issue"  }},    {      "key": "target_number",      "name": "Number",      "type": "number",      "readonly": true    },    {  "key": "kind",  "type": "choice",  "choices": [    "comment",    "review",    "review_comment"  ],  "readonly": true,  "labels": {    "comment": "Comment",    "review": "Review",    "review_comment": "Review comment"  }},    {      "key": "author",      "type": "text",      "placeholder": "Somebody",      "readonly": true    },    {      "key": "body",      "name": "Comment",      "type": "longtext",      "markdown": true,      "readonly": true    },    {  "key": "review_state",  "name": "Verdict",  "type": "text",  "readonly": true,  "labels": {    "APPROVED": "Approved",    "CHANGES_REQUESTED": "Changes requested",    "REQUEST_CHANGES": "Changes requested",    "COMMENTED": "Commented",    "PENDING": "Pending",    "DISMISSED": "Dismissed",    "approved": "Approved",    "changes_requested": "Changes requested",    "commented": "Commented",    "pending": "Pending",    "dismissed": "Dismissed"  }},    {      "key": "path",      "name": "File",      "type": "text",      "readonly": true    },    {      "key": "line",      "type": "number",      "readonly": true    },    {      "key": "html_url",      "name": "Web address",      "type": "text",      "readonly": true    },    {      "key": "remote_created_at",      "name": "Written",      "type": "date",      "readonly": true    },    {      "key": "pull_id",      "name": "Pull request",      "type": "link",      "link_to": "pull",      "readonly": true    },    {      "key": "issue_id",      "name": "Issue",      "type": "link",      "link_to": "issue",      "readonly": true    },    {  "key": "by",  "name": "By",  "type": "choice",  "choices": [    "owner",    "other"  ],  "readonly": true,  "labels": {    "owner": "You",    "other": "Someone else"  }},    {      "key": "verdict",      "name": "Review verdict",      "type": "choice",      "choices": [        "approved",        "changes_requested",        "commented",        "pending",        "dismissed"      ],      "labels": {        "approved": "approved",        "changes_requested": "changes requested",        "commented": "commented",        "pending": "pending",        "dismissed": "dismissed"      },      "readonly": true    },    {      "key": "verdict_said",      "name": "Verdict as words",      "type": "choice",      "choices": [        "approved",        "changes_requested",        "commented",        "pending",        "dismissed"      ],      "labels": {        "approved": "Approved.",        "changes_requested": "Changes requested.",        "commented": "Commented.",        "pending": "Pending.",        "dismissed": "Dismissed."      },      "readonly": true    },    {      "key": "place",      "name": "Place in the diff",      "type": "text",      "readonly": true    }  ],  "title": "body",  "date": "remote_created_at",  "project": null,  "order": null,  "slip": {    "title": "body",    "subtitle": "author",    "trailing": null,    "photo": null,    "toggle": null,    "photo_name": "author"  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "author",        "body",        "remote_created_at"      ]    },    {      "heading": "On",      "columns": [        "target_kind",        "target_number",        "kind",        "review_state",        "path",        "line",        "html_url",        "repo_id"      ]    }  ],  "instructions": "A repository comment is one entry in a pull request's or an issue's conversation: a comment, a review with its verdict, or a comment on one line of a file. Comments are indexed from the host and quoted as written.",  "add": false,  "sort": {    "column": "remote_created_at",    "descending": true  },  "tables": [    {      "name": "cotton_repo_comments",      "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": "target_kind",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    target_kind TEXT NOT NULL",          "position": 3        },        {          "name": "target_number",          "type": "INTEGER",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    target_number INTEGER NOT NULL",          "position": 4        },        {          "name": "kind",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    kind TEXT NOT NULL",          "position": 5        },        {          "name": "remote_id",          "type": "INTEGER",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    remote_id INTEGER NOT NULL",          "position": 6        },        {          "name": "author",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    author TEXT",          "position": 7        },        {          "name": "body",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    body TEXT",          "position": 8        },        {          "name": "review_state",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    review_state TEXT",          "position": 9        },        {          "name": "path",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    path TEXT",          "position": 10        },        {          "name": "line",          "type": "INTEGER",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    line INTEGER",          "position": 11        },        {          "name": "html_url",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    html_url TEXT",          "position": 12        },        {          "name": "remote_created_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_created_at TEXT",          "position": 13        },        {          "name": "remote_updated_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_updated_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, kind, remote_id)",          "position": 19        },        {          "declaration": "\n    CHECK (target_kind IN ('pull', 'issue'))",          "position": 20        },        {          "declaration": "\n    CHECK (kind IN ('comment', 'review', 'review_comment'))",          "position": 21        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 22        },        {          "declaration": "\n    FOREIGN KEY (repo_id) REFERENCES cotton_repos(id)\n  ",          "position": 23        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_repo_comments (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_comments_target ON cotton_repo_comments (workspace_id, repo_id, target_kind, target_number, remote_created_at)",        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_comments_author ON cotton_repo_comments (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ]}