ubiquitous-invention/packages/database/migrations/meta/0006_snapshot.json

2724 lines
71 KiB
JSON
Raw Normal View History

feat(invites): workspace_invites schema + tRPC router + role management (Task 2, part 1/2) Schema half of Task-workspace-invites-and-roles. Lands the table, the invites router (create/list/revoke/accept), and the two new workspaces procedures (updateMemberRole/removeMember). UI ships in part 2/2. This is a stable checkpoint for Task 3 (invite-recipient-autocomplete) to start building against — the procedure surface area is frozen and the new identity helper from Task 1 is in the accept path. Schema: * workspace_invites: id, workspace_id, email (lowercased), role (owner/admin/member), invited_by_user_id, token (base64url 32B), expires_at (DEFAULT now() + 14d), accepted_at, revoked_at, created_at. * Indexes: workspace_id, UNIQUE(token), and a PARTIAL UNIQUE on (workspace_id, email) WHERE accepted_at IS NULL AND revoked_at IS NULL. An open invite is unique per (workspace, email); closed invites (accepted or revoked) fall out of the constraint so re-invites work. * Drizzle relations wired: workspaceInvites.workspace, workspaceInvites.invitedBy, workspaces.invites. * Migration 0006_broad_lethal_legion applied to dev DB. invites router: * create({email, role}) on workspaceProcedure (owner/admin only). Generates a base64url token from 32 random bytes via node:crypto. Idempotent on (workspace, email) — if an open invite already exists, returns it instead of inserting (the partial unique would block it anyway). Refuses self-invite. Refuses if the email is already a member. * list() returns pending (non-accepted, non-revoked) invites with inviter name/email joined for UI display. * revoke({inviteId}) authorizes against the invite's workspace, not the caller's input (the inviteId carries its own tenant scope). * accept({token}) is protectedProcedure (no workspace handle). Calls userOwnsEmail() from Task 1 — if the caller doesn't own the invited email under any of their verified identities, throws FORBIDDEN with a structured cause ({reason: "email_not_owned", invitedEmail}) so the redeem page can render the "link this email" explainer. Handles expiry, revoked, already-accepted states with clear messages. Idempotent on existing membership — if you've already been added by another flow, accept just closes the invite without re-inserting. workspaces additions: * updateMemberRole: admin/owner only. Three guards: 1. Can't change your own role (avoids accidental lockout). 2. Can't demote the only owner-role member (would leave the membership-level ownership empty even though workspaces.owner_user_id still points there — see ADR-pragmatic decision documented in the Task-multi-email-identity convoy discussion). 3. Only owners can promote to owner; admins move people between admin/member but cannot create a new owner. * removeMember: admin/owner OR self (the leave-workspace affordance). Same last-owner guard. Admins can't remove owners (only owners can, via demote-then-remove). Wired both new routers into root.ts as `invites` and `identity` (identity was landed in Task 1; this commit just keeps the registration visible alongside invites). All three CI gates green: 0 lint errors, 14 unchanged warnings, 6/6 type-check, 14/14 tests (no new tests yet — apps/web vitest harness is filed as Task-bootstrap-vitest-for-apps-web P2). Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 11:27:44 -04:00
{
"id": "9cf27800-b2d4-43a3-83c6-eafe694857a7",
"prevId": "4ad15a0f-3541-4109-9dcc-a2ad1dec1556",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.workspace_invites": {
"name": "workspace_invites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"invited_by_user_id": {
"name": "invited_by_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"token": {
"name": "token",
"type": "varchar(128)",
"primaryKey": false,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now() + interval '14 days'"
},
"accepted_at": {
"name": "accepted_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"revoked_at": {
"name": "revoked_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"workspace_invites_workspace_id_idx": {
"name": "workspace_invites_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"workspace_invites_token_unique": {
"name": "workspace_invites_token_unique",
"columns": [
{
"expression": "token",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"workspace_invites_open_email_unique": {
"name": "workspace_invites_open_email_unique",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"where": "\"workspace_invites\".\"accepted_at\" IS NULL AND \"workspace_invites\".\"revoked_at\" IS NULL",
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"workspace_invites_workspace_id_workspaces_id_fk": {
"name": "workspace_invites_workspace_id_workspaces_id_fk",
"tableFrom": "workspace_invites",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"workspace_invites_invited_by_user_id_users_id_fk": {
"name": "workspace_invites_invited_by_user_id_users_id_fk",
"tableFrom": "workspace_invites",
"tableTo": "users",
"columnsFrom": [
"invited_by_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.workspaces": {
"name": "workspaces",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"slug": {
"name": "slug",
"type": "varchar(60)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"owner_user_id": {
"name": "owner_user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"plan_tier": {
"name": "plan_tier",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"archived_at": {
"name": "archived_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"workspaces_slug_unique": {
"name": "workspaces_slug_unique",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"workspaces_owner_user_id_idx": {
"name": "workspaces_owner_user_id_idx",
"columns": [
{
"expression": "owner_user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"workspaces_owner_user_id_users_id_fk": {
"name": "workspaces_owner_user_id_users_id_fk",
"tableFrom": "workspaces",
"tableTo": "users",
"columnsFrom": [
"owner_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.object_assignees": {
"name": "object_assignees",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"object_id": {
"name": "object_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true,
"default": "'assignee'"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"object_assignees_object_id_user_id_unique": {
"name": "object_assignees_object_id_user_id_unique",
"columns": [
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"object_assignees_object_id_idx": {
"name": "object_assignees_object_id_idx",
"columns": [
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"object_assignees_user_id_idx": {
"name": "object_assignees_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"object_assignees_object_id_objects_id_fk": {
"name": "object_assignees_object_id_objects_id_fk",
"tableFrom": "object_assignees",
"tableTo": "objects",
"columnsFrom": [
"object_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"object_assignees_user_id_users_id_fk": {
"name": "object_assignees_user_id_users_id_fk",
"tableFrom": "object_assignees",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.objects": {
"name": "objects",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"parent_id": {
"name": "parent_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "varchar(500)",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cover_image": {
"name": "cover_image",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"template_id": {
"name": "template_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_by": {
"name": "created_by",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"archived_at": {
"name": "archived_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"objects_parent_id_idx": {
"name": "objects_parent_id_idx",
"columns": [
{
"expression": "parent_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"objects_type_idx": {
"name": "objects_type_idx",
"columns": [
{
"expression": "type",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"objects_workspace_id_idx": {
"name": "objects_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"objects_template_id_idx": {
"name": "objects_template_id_idx",
"columns": [
{
"expression": "template_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"objects_created_by_idx": {
"name": "objects_created_by_idx",
"columns": [
{
"expression": "created_by",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"objects_type_workspace_id_idx": {
"name": "objects_type_workspace_id_idx",
"columns": [
{
"expression": "type",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"objects_workspace_id_workspaces_id_fk": {
"name": "objects_workspace_id_workspaces_id_fk",
"tableFrom": "objects",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"objects_created_by_users_id_fk": {
"name": "objects_created_by_users_id_fk",
"tableFrom": "objects",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"objects_parent_id_objects_id_fk": {
"name": "objects_parent_id_objects_id_fk",
"tableFrom": "objects",
"tableTo": "objects",
"columnsFrom": [
"parent_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"objects_template_id_templates_id_fk": {
"name": "objects_template_id_templates_id_fk",
"tableFrom": "objects",
"tableTo": "templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.workspace_members": {
"name": "workspace_members",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true,
"default": "'member'"
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"workspace_members_workspace_id_user_id_unique": {
"name": "workspace_members_workspace_id_user_id_unique",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"workspace_members_workspace_id_idx": {
"name": "workspace_members_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"workspace_members_user_id_idx": {
"name": "workspace_members_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"workspace_members_workspace_id_workspaces_id_fk": {
"name": "workspace_members_workspace_id_workspaces_id_fk",
"tableFrom": "workspace_members",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"workspace_members_user_id_users_id_fk": {
"name": "workspace_members_user_id_users_id_fk",
"tableFrom": "workspace_members",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.object_type_defs": {
"name": "object_type_defs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"slug": {
"name": "slug",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"layout": {
"name": "layout",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true,
"default": "'task'"
},
"default_properties": {
"name": "default_properties",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"object_type_defs_workspace_id_idx": {
"name": "object_type_defs_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"object_type_defs_slug_idx": {
"name": "object_type_defs_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"object_type_defs_workspace_id_workspaces_id_fk": {
"name": "object_type_defs_workspace_id_workspaces_id_fk",
"tableFrom": "object_type_defs",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.property_definitions": {
"name": "property_definitions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"field_type": {
"name": "field_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"config": {
"name": "config",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"property_definitions_workspace_id_idx": {
"name": "property_definitions_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"property_definitions_workspace_id_name_idx": {
"name": "property_definitions_workspace_id_name_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"property_definitions_workspace_id_workspaces_id_fk": {
"name": "property_definitions_workspace_id_workspaces_id_fk",
"tableFrom": "property_definitions",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.property_values": {
"name": "property_values",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"object_id": {
"name": "object_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"property_def_id": {
"name": "property_def_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"property_values_object_id_property_def_id_unique": {
"name": "property_values_object_id_property_def_id_unique",
"columns": [
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "property_def_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"property_values_object_id_idx": {
"name": "property_values_object_id_idx",
"columns": [
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"property_values_property_def_id_idx": {
"name": "property_values_property_def_id_idx",
"columns": [
{
"expression": "property_def_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"property_values_object_id_objects_id_fk": {
"name": "property_values_object_id_objects_id_fk",
"tableFrom": "property_values",
"tableTo": "objects",
"columnsFrom": [
"object_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"property_values_property_def_id_property_definitions_id_fk": {
"name": "property_values_property_def_id_property_definitions_id_fk",
"tableFrom": "property_values",
"tableTo": "property_definitions",
"columnsFrom": [
"property_def_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.views": {
"name": "views",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"object_id": {
"name": "object_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"view_type": {
"name": "view_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"config": {
"name": "config",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"views_object_id_idx": {
"name": "views_object_id_idx",
"columns": [
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"views_object_id_objects_id_fk": {
"name": "views_object_id_objects_id_fk",
"tableFrom": "views",
"tableTo": "objects",
"columnsFrom": [
"object_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.accounts": {
"name": "accounts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"provider": {
"name": "provider",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"provider_account_id": {
"name": "provider_account_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"refresh_token": {
"name": "refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"access_token": {
"name": "access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"token_type": {
"name": "token_type",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"scope": {
"name": "scope",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"id_token": {
"name": "id_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"session_state": {
"name": "session_state",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"accounts_provider_provider_account_id_unique": {
"name": "accounts_provider_provider_account_id_unique",
"columns": [
{
"expression": "provider",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "provider_account_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"accounts_user_id_idx": {
"name": "accounts_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"accounts_user_id_users_id_fk": {
"name": "accounts_user_id_users_id_fk",
"tableFrom": "accounts",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"session_token": {
"name": "session_token",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"expires": {
"name": "expires",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"sessions_user_id_idx": {
"name": "sessions_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"sessions_session_token_unique": {
"name": "sessions_session_token_unique",
"nullsNotDistinct": false,
"columns": [
"session_token"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_email_identities": {
"name": "user_email_identities",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"verified_at": {
"name": "verified_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"source": {
"name": "source",
"type": "varchar(30)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"last_used_at": {
"name": "last_used_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"user_email_identities_user_id_idx": {
"name": "user_email_identities_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_email_identities_email_idx": {
"name": "user_email_identities_email_idx",
"columns": [
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_email_identities_user_id_email_unique": {
"name": "user_email_identities_user_id_email_unique",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"user_email_identities_verified_email_unique": {
"name": "user_email_identities_verified_email_unique",
"columns": [
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"where": "\"user_email_identities\".\"verified_at\" IS NOT NULL",
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"user_email_identities_user_id_users_id_fk": {
"name": "user_email_identities_user_id_users_id_fk",
"tableFrom": "user_email_identities",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"avatar_url": {
"name": "avatar_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"users_email_idx": {
"name": "users_email_idx",
"columns": [
{
"expression": "email",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"users_email_lower_unique": {
"name": "users_email_lower_unique",
"columns": [
{
"expression": "lower(\"email\")",
"asc": true,
"isExpression": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_email_unique": {
"name": "users_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.verification_tokens": {
"name": "verification_tokens",
"schema": "",
"columns": {
"identifier": {
"name": "identifier",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"token": {
"name": "token",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"expires": {
"name": "expires",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"verification_tokens_identifier_token_pk": {
"name": "verification_tokens_identifier_token_pk",
"columns": [
"identifier",
"token"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.object_relations": {
"name": "object_relations",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"source_id": {
"name": "source_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"target_id": {
"name": "target_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"relation_type": {
"name": "relation_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"object_relations_source_id_idx": {
"name": "object_relations_source_id_idx",
"columns": [
{
"expression": "source_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"object_relations_target_id_idx": {
"name": "object_relations_target_id_idx",
"columns": [
{
"expression": "target_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"object_relations_relation_type_idx": {
"name": "object_relations_relation_type_idx",
"columns": [
{
"expression": "relation_type",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"object_relations_source_target_type_unique": {
"name": "object_relations_source_target_type_unique",
"columns": [
{
"expression": "source_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "target_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "relation_type",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"object_relations_source_id_objects_id_fk": {
"name": "object_relations_source_id_objects_id_fk",
"tableFrom": "object_relations",
"tableTo": "objects",
"columnsFrom": [
"source_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"object_relations_target_id_objects_id_fk": {
"name": "object_relations_target_id_objects_id_fk",
"tableFrom": "object_relations",
"tableTo": "objects",
"columnsFrom": [
"target_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.templates": {
"name": "templates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"target_type": {
"name": "target_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"schema": {
"name": "schema",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"templates_workspace_id_idx": {
"name": "templates_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"templates_workspace_id_workspaces_id_fk": {
"name": "templates_workspace_id_workspaces_id_fk",
"tableFrom": "templates",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.form_responses": {
"name": "form_responses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"form_id": {
"name": "form_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"respondent_id": {
"name": "respondent_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"created_object_id": {
"name": "created_object_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"data": {
"name": "data",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'"
},
"submitted_at": {
"name": "submitted_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"form_responses_form_id_idx": {
"name": "form_responses_form_id_idx",
"columns": [
{
"expression": "form_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"form_responses_respondent_id_idx": {
"name": "form_responses_respondent_id_idx",
"columns": [
{
"expression": "respondent_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"form_responses_form_id_forms_id_fk": {
"name": "form_responses_form_id_forms_id_fk",
"tableFrom": "form_responses",
"tableTo": "forms",
"columnsFrom": [
"form_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"form_responses_respondent_id_users_id_fk": {
"name": "form_responses_respondent_id_users_id_fk",
"tableFrom": "form_responses",
"tableTo": "users",
"columnsFrom": [
"respondent_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"form_responses_created_object_id_objects_id_fk": {
"name": "form_responses_created_object_id_objects_id_fk",
"tableFrom": "form_responses",
"tableTo": "objects",
"columnsFrom": [
"created_object_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.forms": {
"name": "forms",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(500)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"cover_image": {
"name": "cover_image",
"type": "text",
"primaryKey": false,
"notNull": false
},
"object_id": {
"name": "object_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"target_type": {
"name": "target_type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true,
"default": "'task'"
},
"fields": {
"name": "fields",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'[]'"
},
"settings": {
"name": "settings",
"type": "jsonb",
"primaryKey": false,
"notNull": true,
"default": "'{}'"
},
"is_published": {
"name": "is_published",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_by": {
"name": "created_by",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"forms_workspace_id_idx": {
"name": "forms_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"forms_object_id_idx": {
"name": "forms_object_id_idx",
"columns": [
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"forms_workspace_id_workspaces_id_fk": {
"name": "forms_workspace_id_workspaces_id_fk",
"tableFrom": "forms",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"forms_object_id_objects_id_fk": {
"name": "forms_object_id_objects_id_fk",
"tableFrom": "forms",
"tableTo": "objects",
"columnsFrom": [
"object_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"forms_created_by_users_id_fk": {
"name": "forms_created_by_users_id_fk",
"tableFrom": "forms",
"tableTo": "users",
"columnsFrom": [
"created_by"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user_favorites": {
"name": "user_favorites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"object_id": {
"name": "object_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"user_favorites_user_object_idx": {
"name": "user_favorites_user_object_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "object_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"user_favorites_user_id_users_id_fk": {
"name": "user_favorites_user_id_users_id_fk",
"tableFrom": "user_favorites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"user_favorites_object_id_objects_id_fk": {
"name": "user_favorites_object_id_objects_id_fk",
"tableFrom": "user_favorites",
"tableTo": "objects",
"columnsFrom": [
"object_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.markdown_backlog_items": {
"name": "markdown_backlog_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"kind": {
"name": "kind",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"slug": {
"name": "slug",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"plan_slug": {
"name": "plan_slug",
"type": "varchar(200)",
"primaryKey": false,
"notNull": true
},
"epic_slug": {
"name": "epic_slug",
"type": "varchar(200)",
"primaryKey": false,
"notNull": false
},
"parent_id": {
"name": "parent_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"repo_path": {
"name": "repo_path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(500)",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"priority": {
"name": "priority",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"owner": {
"name": "owner",
"type": "text",
"primaryKey": false,
"notNull": false
},
"frontmatter": {
"name": "frontmatter",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"body_markdown": {
"name": "body_markdown",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"content_hash": {
"name": "content_hash",
"type": "varchar(64)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"markdown_backlog_workspace_repo_path_unique": {
"name": "markdown_backlog_workspace_repo_path_unique",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "repo_path",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"markdown_backlog_workspace_plan_idx": {
"name": "markdown_backlog_workspace_plan_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "plan_slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"markdown_backlog_parent_id_idx": {
"name": "markdown_backlog_parent_id_idx",
"columns": [
{
"expression": "parent_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"markdown_backlog_workspace_kind_idx": {
"name": "markdown_backlog_workspace_kind_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "kind",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"markdown_backlog_items_workspace_id_workspaces_id_fk": {
"name": "markdown_backlog_items_workspace_id_workspaces_id_fk",
"tableFrom": "markdown_backlog_items",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"markdown_backlog_items_parent_id_markdown_backlog_items_id_fk": {
"name": "markdown_backlog_items_parent_id_markdown_backlog_items_id_fk",
"tableFrom": "markdown_backlog_items",
"tableTo": "markdown_backlog_items",
"columnsFrom": [
"parent_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.cursor_sync_mappings": {
"name": "cursor_sync_mappings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"workspace_id": {
"name": "workspace_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"backlog_item_id": {
"name": "backlog_item_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"cursor_plan_id": {
"name": "cursor_plan_id",
"type": "varchar(500)",
"primaryKey": false,
"notNull": false
},
"cursor_item_id": {
"name": "cursor_item_id",
"type": "varchar(500)",
"primaryKey": false,
"notNull": false
},
"last_pulled_at": {
"name": "last_pulled_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"last_pushed_at": {
"name": "last_pushed_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"sync_content_hash": {
"name": "sync_content_hash",
"type": "varchar(64)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"cursor_sync_mappings_backlog_item_id_unique": {
"name": "cursor_sync_mappings_backlog_item_id_unique",
"columns": [
{
"expression": "backlog_item_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"cursor_sync_mappings_workspace_id_idx": {
"name": "cursor_sync_mappings_workspace_id_idx",
"columns": [
{
"expression": "workspace_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"cursor_sync_mappings_workspace_id_workspaces_id_fk": {
"name": "cursor_sync_mappings_workspace_id_workspaces_id_fk",
"tableFrom": "cursor_sync_mappings",
"tableTo": "workspaces",
"columnsFrom": [
"workspace_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"cursor_sync_mappings_backlog_item_id_markdown_backlog_items_id_fk": {
"name": "cursor_sync_mappings_backlog_item_id_markdown_backlog_items_id_fk",
"tableFrom": "cursor_sync_mappings",
"tableTo": "markdown_backlog_items",
"columnsFrom": [
"backlog_item_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}