Cotton code
276 lines · 6.6 KB · JSONRaw
{  "format_version": 1,  "id": "person_language",  "name": "Language",  "plural": "Languages",  "builtin": true,  "visibility": "owner",  "title": "language",  "columns": [    {      "key": "person_id",      "name": "Person",      "type": "link",      "link_to": "person",      "required": true,      "contributes": false    },    {      "key": "language",      "name": "Language",      "type": "text",      "required": true    },    {      "key": "proficiency",      "name": "How well",      "type": "choice",      "choices": [        "native",        "fluent",        "conversational",        "basic"      ],      "labels": {        "native": "Native speaker",        "fluent": "Fluent",        "conversational": "Conversational",        "basic": "Basic"      }    },    {      "key": "position",      "name": "Position",      "type": "number",      "readonly": true    },    {      "key": "trashed_at",      "type": "date",      "format": "calendar-datetime",      "readonly": true    }  ],  "instructions": "A language is one language a person speaks, with how well: native, fluent, conversational or basic. Write the language's own English name (Hindi, Portuguese). To change how well, update proficiency; to correct the language, update language. Remove takes only the language away, never the person.",  "tables": [    {      "name": "cotton_person_languages",      "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": "person_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    person_id TEXT NOT NULL",          "position": 2        },        {          "name": "language",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    language TEXT NOT NULL CHECK (length(trim(language)) > 0)",          "position": 3        },        {          "name": "proficiency",          "type": "TEXT",          "default": "'fluent'",          "nullable": false,          "primary_key": false,          "declaration": "\n    proficiency TEXT NOT NULL DEFAULT 'fluent' CHECK (proficiency IN ('native','fluent','conversational','basic'))",          "position": 4        },        {          "name": "position",          "type": "INTEGER",          "default": "0",          "nullable": false,          "primary_key": false,          "declaration": "\n    position INTEGER NOT NULL DEFAULT 0",          "position": 5        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 6        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 7        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 8        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 9        },        {          "name": "trashed_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": " trashed_at TEXT",          "position": 10        }      ],      "constraints": [        {          "declaration": "\n    FOREIGN KEY (person_id) REFERENCES cotton_people(id)",          "position": 11        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n  ",          "position": 12        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_person_languages (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_person_languages_author ON cotton_person_languages (substr(_hlc, 20), _hlc)",        "CREATE INDEX idx_cotton_person_languages_person ON cotton_person_languages (person_id)"      ],      "full_text": [],      "triggers": []    }  ],  "card": {    "face": "plain",    "fields": [      {        "slot": "title",        "column": "language"      },      {        "slot": "subtitle",        "column": "proficiency"      }    ]  },  "picture": null,  "engine": "people",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "language",    "subtitle": "proficiency",    "trailing": null,    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "language",        "proficiency",        "person_id"      ]    }  ],  "sort": {    "column": "position"  },  "empty": {    "title": "No languages yet.",    "message": "Add the languages this person speaks, and how well."  },  "search": [    "language"  ],  "deletion": {    "confirm": "Remove this language from the person?",    "label": "Remove",    "asks": true  },  "commands": [    {      "id": "remove",      "label": "Remove",      "kind": "delete",      "verb": "delete_record",      "data": {        "table": "person_language"      },      "confirm": "Remove this language from the person?",      "bindings": {        "id": "$id"      },      "receipt": "Removed",      "does": "destroys"    },    {      "id": "person",      "label": "Open person",      "kind": "open",      "opens": "person_id"    }  ],  "parts": {    "shape": "sheet",    "head": {      "facts": []    },    "links": [],    "lists": [],    "acts": {      "more": [        "person"      ],      "away": "remove"    },    "cards": [      {        "column": "proficiency",        "object": "message"      }    ],    "strip": []  }}