Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(api): suffix taken column slugs on create

Tin0798a0556436
diff --git a/apps/api/drizzle/0064_wakeful_maximus.sql b/apps/api/drizzle/0064_wakeful_maximus.sql
deleted file mode 100644
index 2ffbf7e5d..000000000
--- a/apps/api/drizzle/0064_wakeful_maximus.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE "column" ADD CONSTRAINT "column_project_slug_unique" UNIQUE("project_id","slug");
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0064_snapshot.json b/apps/api/drizzle/meta/0064_snapshot.json
deleted file mode 100644
index b87bd4a77..000000000
--- a/apps/api/drizzle/meta/0064_snapshot.json
+++ /dev/null
@@ -1,5400 +0,0 @@
-{
- "id": "913edc30-fde8-47b1-adad-4799b64fb4d8",
- "prevId": "f569b31a-0316-4069-acb6-0443dcf0a86f",
- "version": "7",
- "dialect": "postgresql",
- "tables": {
- "public.account": {
- "name": "account",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "account_userId_idx": {
- "name": "account_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "account_user_id_user_id_fk": {
- "name": "account_user_id_user_id_fk",
- "tableFrom": "account",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.activity": {
- "name": "activity",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "event_data": {
- "name": "event_data",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "external_user_name": {
- "name": "external_user_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "external_user_avatar": {
- "name": "external_user_avatar",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "external_source": {
- "name": "external_source",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "external_url": {
- "name": "external_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "activity_task_id_idx": {
- "name": "activity_task_id_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "activity_userId_idx": {
- "name": "activity_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "activity_createdAt_idx": {
- "name": "activity_createdAt_idx",
- "columns": [
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "activity_task_id_task_id_fk": {
- "name": "activity_task_id_task_id_fk",
- "tableFrom": "activity",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "activity_user_id_user_id_fk": {
- "name": "activity_user_id_user_id_fk",
- "tableFrom": "activity",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "activity_task_external_source_external_url_unique": {
- "name": "activity_task_external_source_external_url_unique",
- "nullsNotDistinct": false,
- "columns": [
- "task_id",
- "external_source",
- "external_url"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.apikey": {
- "name": "apikey",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "config_id": {
- "name": "config_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'default'"
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "start": {
- "name": "start",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "reference_id": {
- "name": "reference_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "prefix": {
- "name": "prefix",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "refill_interval": {
- "name": "refill_interval",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "refill_amount": {
- "name": "refill_amount",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "last_refill_at": {
- "name": "last_refill_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": true
- },
- "rate_limit_enabled": {
- "name": "rate_limit_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": true
- },
- "rate_limit_time_window": {
- "name": "rate_limit_time_window",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "default": 86400000
- },
- "rate_limit_max": {
- "name": "rate_limit_max",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "default": 10
- },
- "request_count": {
- "name": "request_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "default": 0
- },
- "remaining": {
- "name": "remaining",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "last_request": {
- "name": "last_request",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "permissions": {
- "name": "permissions",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "apikey_configId_idx": {
- "name": "apikey_configId_idx",
- "columns": [
- {
- "expression": "config_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "apikey_key_idx": {
- "name": "apikey_key_idx",
- "columns": [
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "apikey_referenceId_idx": {
- "name": "apikey_referenceId_idx",
- "columns": [
- {
- "expression": "reference_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "apikey_userId_idx": {
- "name": "apikey_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "apikey_reference_id_user_id_fk": {
- "name": "apikey_reference_id_user_id_fk",
- "tableFrom": "apikey",
- "tableTo": "user",
- "columnsFrom": [
- "reference_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "apikey_user_id_user_id_fk": {
- "name": "apikey_user_id_user_id_fk",
- "tableFrom": "apikey",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.asset": {
- "name": "asset",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "activity_id": {
- "name": "activity_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "object_key": {
- "name": "object_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "filename": {
- "name": "filename",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "size": {
- "name": "size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'image'"
- },
- "surface": {
- "name": "surface",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'description'"
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "asset_workspaceId_idx": {
- "name": "asset_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "asset_projectId_idx": {
- "name": "asset_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "asset_taskId_idx": {
- "name": "asset_taskId_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "asset_activityId_idx": {
- "name": "asset_activityId_idx",
- "columns": [
- {
- "expression": "activity_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "asset_createdBy_idx": {
- "name": "asset_createdBy_idx",
- "columns": [
- {
- "expression": "created_by",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "asset_draft_expiry_idx": {
- "name": "asset_draft_expiry_idx",
- "columns": [
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"asset\".\"task_id\" is null and \"asset\".\"surface\" in ('draft', 'draft-pending')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "asset_workspace_id_workspace_id_fk": {
- "name": "asset_workspace_id_workspace_id_fk",
- "tableFrom": "asset",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "asset_project_id_project_id_fk": {
- "name": "asset_project_id_project_id_fk",
- "tableFrom": "asset",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "asset_task_id_task_id_fk": {
- "name": "asset_task_id_task_id_fk",
- "tableFrom": "asset",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "asset_activity_id_activity_id_fk": {
- "name": "asset_activity_id_activity_id_fk",
- "tableFrom": "asset",
- "tableTo": "activity",
- "columnsFrom": [
- "activity_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "asset_created_by_user_id_fk": {
- "name": "asset_created_by_user_id_fk",
- "tableFrom": "asset",
- "tableTo": "user",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "asset_object_key_unique": {
- "name": "asset_object_key_unique",
- "nullsNotDistinct": false,
- "columns": [
- "object_key"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.billing_event": {
- "name": "billing_event",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "event_type": {
- "name": "event_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "processed_at": {
- "name": "processed_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.billing_reminder_sent": {
- "name": "billing_reminder_sent",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "reminder_type": {
- "name": "reminder_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "trial_ends_at": {
- "name": "trial_ends_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "billing_reminder_sent_workspaceId_idx": {
- "name": "billing_reminder_sent_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "billing_reminder_sent_userId_idx": {
- "name": "billing_reminder_sent_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "billing_reminder_sent_user_id_user_id_fk": {
- "name": "billing_reminder_sent_user_id_user_id_fk",
- "tableFrom": "billing_reminder_sent",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "billing_reminder_sent_workspace_id_workspace_id_fk": {
- "name": "billing_reminder_sent_workspace_id_workspace_id_fk",
- "tableFrom": "billing_reminder_sent",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "billing_reminder_sent_user_type_unique": {
- "name": "billing_reminder_sent_user_type_unique",
- "nullsNotDistinct": false,
- "columns": [
- "user_id",
- "reminder_type"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.calendar_feed": {
- "name": "calendar_feed",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "label_ids": {
- "name": "label_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "time_zone": {
- "name": "time_zone",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'UTC'"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "calendar_feed_project_id_idx": {
- "name": "calendar_feed_project_id_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "calendar_feed_project_id_project_id_fk": {
- "name": "calendar_feed_project_id_project_id_fk",
- "tableFrom": "calendar_feed",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "calendar_feed_token_unique": {
- "name": "calendar_feed_token_unique",
- "nullsNotDistinct": false,
- "columns": [
- "token"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.column": {
- "name": "column",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "position": {
- "name": "position",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "icon": {
- "name": "icon",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "is_final": {
- "name": "is_final",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "column_projectId_idx": {
- "name": "column_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "column_project_id_project_id_fk": {
- "name": "column_project_id_project_id_fk",
- "tableFrom": "column",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "column_project_slug_unique": {
- "name": "column_project_slug_unique",
- "nullsNotDistinct": false,
- "columns": [
- "project_id",
- "slug"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.comment": {
- "name": "comment",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "comment_task_idx": {
- "name": "comment_task_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "comment_user_idx": {
- "name": "comment_user_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "comment_task_id_task_id_fk": {
- "name": "comment_task_id_task_id_fk",
- "tableFrom": "comment",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "comment_user_id_user_id_fk": {
- "name": "comment_user_id_user_id_fk",
- "tableFrom": "comment",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.custom_field_definition": {
- "name": "custom_field_definition",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "required": {
- "name": "required",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "default_value": {
- "name": "default_value",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "options": {
- "name": "options",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "position": {
- "name": "position",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "custom_field_def_projectId_idx": {
- "name": "custom_field_def_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "custom_field_definition_project_id_project_id_fk": {
- "name": "custom_field_definition_project_id_project_id_fk",
- "tableFrom": "custom_field_definition",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.custom_field_value": {
- "name": "custom_field_value",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "field_id": {
- "name": "field_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "custom_field_value_taskId_idx": {
- "name": "custom_field_value_taskId_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "custom_field_value_fieldId_idx": {
- "name": "custom_field_value_fieldId_idx",
- "columns": [
- {
- "expression": "field_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "custom_field_value_task_id_task_id_fk": {
- "name": "custom_field_value_task_id_task_id_fk",
- "tableFrom": "custom_field_value",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "custom_field_value_field_id_custom_field_definition_id_fk": {
- "name": "custom_field_value_field_id_custom_field_definition_id_fk",
- "tableFrom": "custom_field_value",
- "tableTo": "custom_field_definition",
- "columnsFrom": [
- "field_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "custom_field_value_task_field_unique": {
- "name": "custom_field_value_task_field_unique",
- "nullsNotDistinct": false,
- "columns": [
- "task_id",
- "field_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.data_migration": {
- "name": "data_migration",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.device_code": {
- "name": "device_code",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "device_code": {
- "name": "device_code",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_code": {
- "name": "user_code",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "last_polled_at": {
- "name": "last_polled_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "polling_interval": {
- "name": "polling_interval",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "client_id": {
- "name": "client_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "device_code_device_code_uidx": {
- "name": "device_code_device_code_uidx",
- "columns": [
- {
- "expression": "device_code",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "device_code_user_code_uidx": {
- "name": "device_code_user_code_uidx",
- "columns": [
- {
- "expression": "user_code",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "device_code_user_id_idx": {
- "name": "device_code_user_id_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "device_code_user_id_user_id_fk": {
- "name": "device_code_user_id_user_id_fk",
- "tableFrom": "device_code",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.external_link": {
- "name": "external_link",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "integration_id": {
- "name": "integration_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resource_type": {
- "name": "resource_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "external_id": {
- "name": "external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "url": {
- "name": "url",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "external_link_taskId_idx": {
- "name": "external_link_taskId_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_link_integrationId_idx": {
- "name": "external_link_integrationId_idx",
- "columns": [
- {
- "expression": "integration_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_link_externalId_idx": {
- "name": "external_link_externalId_idx",
- "columns": [
- {
- "expression": "external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_link_resourceType_idx": {
- "name": "external_link_resourceType_idx",
- "columns": [
- {
- "expression": "resource_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_link_deferred_issue_idx": {
- "name": "external_link_deferred_issue_idx",
- "columns": [
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"external_link\".\"resource_type\" = 'issue' AND \"external_link\".\"metadata\" LIKE '%\"deferredIssueEdit\":%'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "external_link_task_id_task_id_fk": {
- "name": "external_link_task_id_task_id_fk",
- "tableFrom": "external_link",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "external_link_integration_id_integration_id_fk": {
- "name": "external_link_integration_id_integration_id_fk",
- "tableFrom": "external_link",
- "tableTo": "integration",
- "columnsFrom": [
- "integration_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.github_import": {
- "name": "github_import",
- "schema": "",
- "columns": {
- "integration_id": {
- "name": "integration_id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "github_import_integration_id_integration_id_fk": {
- "name": "github_import_integration_id_integration_id_fk",
- "tableFrom": "github_import",
- "tableTo": "integration",
- "columnsFrom": [
- "integration_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.github_integration": {
- "name": "github_integration",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "repository_owner": {
- "name": "repository_owner",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "repository_name": {
- "name": "repository_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "installation_id": {
- "name": "installation_id",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "is_active": {
- "name": "is_active",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "github_integration_project_id_project_id_fk": {
- "name": "github_integration_project_id_project_id_fk",
- "tableFrom": "github_integration",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "github_integration_project_id_unique": {
- "name": "github_integration_project_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "project_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.import_run": {
- "name": "import_run",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source": {
- "name": "source",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'running'"
- },
- "include_comments": {
- "name": "include_comments",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "message": {
- "name": "message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "projects": {
- "name": "projects",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "heartbeat_at": {
- "name": "heartbeat_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "import_run_workspace_created_idx": {
- "name": "import_run_workspace_created_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "import_run_workspace_id_workspace_id_fk": {
- "name": "import_run_workspace_id_workspace_id_fk",
- "tableFrom": "import_run",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "import_run_user_id_user_id_fk": {
- "name": "import_run_user_id_user_id_fk",
- "tableFrom": "import_run",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.integration": {
- "name": "integration",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "config": {
- "name": "config",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "is_active": {
- "name": "is_active",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "integration_projectId_idx": {
- "name": "integration_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "integration_type_idx": {
- "name": "integration_type_idx",
- "columns": [
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "integration_project_id_project_id_fk": {
- "name": "integration_project_id_project_id_fk",
- "tableFrom": "integration",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "integration_project_type_unique": {
- "name": "integration_project_type_unique",
- "nullsNotDistinct": false,
- "columns": [
- "project_id",
- "type"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.invitation": {
- "name": "invitation",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "team_id": {
- "name": "team_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "inviter_id": {
- "name": "inviter_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "project_access": {
- "name": "project_access",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'all'"
- },
- "project_ids": {
- "name": "project_ids",
- "type": "text[]",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::text[]"
- }
- },
- "indexes": {
- "invitation_workspaceId_idx": {
- "name": "invitation_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "invitation_email_idx": {
- "name": "invitation_email_idx",
- "columns": [
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "invitation_inviterId_idx": {
- "name": "invitation_inviterId_idx",
- "columns": [
- {
- "expression": "inviter_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "invitation_workspace_id_workspace_id_fk": {
- "name": "invitation_workspace_id_workspace_id_fk",
- "tableFrom": "invitation",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "invitation_inviter_id_user_id_fk": {
- "name": "invitation_inviter_id_user_id_fk",
- "tableFrom": "invitation",
- "tableTo": "user",
- "columnsFrom": [
- "inviter_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.job_lease": {
- "name": "job_lease",
- "schema": "",
- "columns": {
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "owner": {
- "name": "owner",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.label": {
- "name": "label",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "deletion_started_at": {
- "name": "deletion_started_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "label_task_id_idx": {
- "name": "label_task_id_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "label_workspace_id_idx": {
- "name": "label_workspace_id_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "label_workspace_cascade_idx": {
- "name": "label_workspace_cascade_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"label\".\"task_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "label_workspace_name_unique": {
- "name": "label_workspace_name_unique",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"label\".\"task_id\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "label_task_id_task_id_fk": {
- "name": "label_task_id_task_id_fk",
- "tableFrom": "label",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "label_workspace_id_workspace_id_fk": {
- "name": "label_workspace_id_workspace_id_fk",
- "tableFrom": "label",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "label_task_name_unique": {
- "name": "label_task_name_unique",
- "nullsNotDistinct": false,
- "columns": [
- "task_id",
- "name"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_state": {
- "name": "mcp_oauth_state",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "mcp_oauth_state_kind_key_uidx": {
- "name": "mcp_oauth_state_kind_key_uidx",
- "columns": [
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_oauth_state_expiresAt_idx": {
- "name": "mcp_oauth_state_expiresAt_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.notification": {
- "name": "notification",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'info'"
- },
- "event_data": {
- "name": "event_data",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "is_read": {
- "name": "is_read",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": false
- },
- "resource_id": {
- "name": "resource_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resource_type": {
- "name": "resource_type",
- "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": {
- "notification_userId_idx": {
- "name": "notification_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "notification_user_id_user_id_fk": {
- "name": "notification_user_id_user_id_fk",
- "tableFrom": "notification",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace_role": {
- "name": "workspace_role",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "permission": {
- "name": "permission",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "workspace_role_workspaceId_idx": {
- "name": "workspace_role_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_role_role_idx": {
- "name": "workspace_role_role_idx",
- "columns": [
- {
- "expression": "role",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_role_workspace_id_workspace_id_fk": {
- "name": "workspace_role_workspace_id_workspace_id_fk",
- "tableFrom": "workspace_role",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.project": {
- "name": "project",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "icon": {
- "name": "icon",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "default": "'Layout'"
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "is_public": {
- "name": "is_public",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "last_task_number": {
- "name": "last_task_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "position": {
- "name": "position",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "background_object_key": {
- "name": "background_object_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "background_mime_type": {
- "name": "background_mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "background_version": {
- "name": "background_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "project_background_object_key_idx": {
- "name": "project_background_object_key_idx",
- "columns": [
- {
- "expression": "background_object_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"project\".\"background_object_key\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_workspaceId_position_idx": {
- "name": "project_workspaceId_position_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "position",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "project_workspace_id_workspace_id_fk": {
- "name": "project_workspace_id_workspace_id_fk",
- "tableFrom": "project",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "project_workspace_id_id_unique": {
- "name": "project_workspace_id_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.session": {
- "name": "session",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "active_organization_id": {
- "name": "active_organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "active_team_id": {
- "name": "active_team_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "impersonated_by": {
- "name": "impersonated_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "session_userId_idx": {
- "name": "session_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "session_user_id_user_id_fk": {
- "name": "session_user_id_user_id_fk",
- "tableFrom": "session",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "session_token_unique": {
- "name": "session_token_unique",
- "nullsNotDistinct": false,
- "columns": [
- "token"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.storage_cleanup": {
- "name": "storage_cleanup",
- "schema": "",
- "columns": {
- "object_key": {
- "name": "object_key",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "last_attempt_at": {
- "name": "last_attempt_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.task_relation": {
- "name": "task_relation",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "source_task_id": {
- "name": "source_task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_task_id": {
- "name": "target_task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "relation_type": {
- "name": "relation_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "task_relation_source_idx": {
- "name": "task_relation_source_idx",
- "columns": [
- {
- "expression": "source_task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "task_relation_target_idx": {
- "name": "task_relation_target_idx",
- "columns": [
- {
- "expression": "target_task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "task_relation_source_task_id_task_id_fk": {
- "name": "task_relation_source_task_id_task_id_fk",
- "tableFrom": "task_relation",
- "tableTo": "task",
- "columnsFrom": [
- "source_task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "task_relation_target_task_id_task_id_fk": {
- "name": "task_relation_target_task_id_task_id_fk",
- "tableFrom": "task_relation",
- "tableTo": "task",
- "columnsFrom": [
- "target_task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.task_reminder_sent": {
- "name": "task_reminder_sent",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "reminder_type": {
- "name": "reminder_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "task_reminder_sent_taskId_idx": {
- "name": "task_reminder_sent_taskId_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "task_reminder_sent_task_id_task_id_fk": {
- "name": "task_reminder_sent_task_id_task_id_fk",
- "tableFrom": "task_reminder_sent",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "task_reminder_sent_task_type_unique": {
- "name": "task_reminder_sent_task_type_unique",
- "nullsNotDistinct": false,
- "columns": [
- "task_id",
- "reminder_type"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.task": {
- "name": "task",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "position": {
- "name": "position",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "default": 0
- },
- "number": {
- "name": "number",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "default": 1
- },
- "assignee_id": {
- "name": "assignee_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'to-do'"
- },
- "column_id": {
- "name": "column_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "priority": {
- "name": "priority",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'low'"
- },
- "start_date": {
- "name": "start_date",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "due_date": {
- "name": "due_date",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "task_projectId_idx": {
- "name": "task_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "task_project_scheduled_id_idx": {
- "name": "task_project_scheduled_id_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"task\".\"start_date\" is not null or \"task\".\"due_date\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "task_dueDate_idx": {
- "name": "task_dueDate_idx",
- "columns": [
- {
- "expression": "due_date",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "task_assigneeId_idx": {
- "name": "task_assigneeId_idx",
- "columns": [
- {
- "expression": "assignee_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "task_columnId_idx": {
- "name": "task_columnId_idx",
- "columns": [
- {
- "expression": "column_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "task_project_id_project_id_fk": {
- "name": "task_project_id_project_id_fk",
- "tableFrom": "task",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "task_assignee_id_user_id_fk": {
- "name": "task_assignee_id_user_id_fk",
- "tableFrom": "task",
- "tableTo": "user",
- "columnsFrom": [
- "assignee_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "task_column_id_column_id_fk": {
- "name": "task_column_id_column_id_fk",
- "tableFrom": "task",
- "tableTo": "column",
- "columnsFrom": [
- "column_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "task_project_number_unique": {
- "name": "task_project_number_unique",
- "nullsNotDistinct": false,
- "columns": [
- "project_id",
- "number"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.team": {
- "name": "team",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "team_workspaceId_idx": {
- "name": "team_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "team_workspace_id_workspace_id_fk": {
- "name": "team_workspace_id_workspace_id_fk",
- "tableFrom": "team",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.team_member": {
- "name": "team_member",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "team_id": {
- "name": "team_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "teamMember_teamId_idx": {
- "name": "teamMember_teamId_idx",
- "columns": [
- {
- "expression": "team_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "teamMember_userId_idx": {
- "name": "teamMember_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "team_member_team_id_team_id_fk": {
- "name": "team_member_team_id_team_id_fk",
- "tableFrom": "team_member",
- "tableTo": "team",
- "columnsFrom": [
- "team_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "team_member_user_id_user_id_fk": {
- "name": "team_member_user_id_user_id_fk",
- "tableFrom": "team_member",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.time_entry": {
- "name": "time_entry",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "start_time": {
- "name": "start_time",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "end_time": {
- "name": "end_time",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "duration": {
- "name": "duration",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "default": 0
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "time_entry_taskId_idx": {
- "name": "time_entry_taskId_idx",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "time_entry_userId_idx": {
- "name": "time_entry_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "time_entry_task_id_task_id_fk": {
- "name": "time_entry_task_id_task_id_fk",
- "tableFrom": "time_entry",
- "tableTo": "task",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "time_entry_user_id_user_id_fk": {
- "name": "time_entry_user_id_user_id_fk",
- "tableFrom": "time_entry",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.trial_grant": {
- "name": "trial_grant",
- "schema": "",
- "columns": {
- "email_hash": {
- "name": "email_hash",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "trial_ends_at": {
- "name": "trial_ends_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user": {
- "name": "user",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "email_verified": {
- "name": "email_verified",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "locale": {
- "name": "locale",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "is_anonymous": {
- "name": "is_anonymous",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "banned": {
- "name": "banned",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false,
- "default": false
- },
- "ban_reason": {
- "name": "ban_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "ban_expires": {
- "name": "ban_expires",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "user_email_unique": {
- "name": "user_email_unique",
- "nullsNotDistinct": false,
- "columns": [
- "email"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_avatar": {
- "name": "user_avatar",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "size": {
- "name": "size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "data": {
- "name": "data",
- "type": "bytea",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "user_avatar_userId_idx": {
- "name": "user_avatar_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_avatar_user_id_user_id_fk": {
- "name": "user_avatar_user_id_user_id_fk",
- "tableFrom": "user_avatar",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "user_avatar_user_id_unique": {
- "name": "user_avatar_user_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "user_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_notification_preference": {
- "name": "user_notification_preference",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "email_enabled": {
- "name": "email_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "ntfy_enabled": {
- "name": "ntfy_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "ntfy_server_url": {
- "name": "ntfy_server_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "ntfy_topic": {
- "name": "ntfy_topic",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "ntfy_token": {
- "name": "ntfy_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "gotify_enabled": {
- "name": "gotify_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "gotify_server_url": {
- "name": "gotify_server_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "gotify_token": {
- "name": "gotify_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "webhook_enabled": {
- "name": "webhook_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "webhook_url": {
- "name": "webhook_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "webhook_secret": {
- "name": "webhook_secret",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "task_assignment_enabled": {
- "name": "task_assignment_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "task_comment_enabled": {
- "name": "task_comment_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "task_status_change_enabled": {
- "name": "task_status_change_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "due_date_reminder_enabled": {
- "name": "due_date_reminder_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "due_date_reminder_lead_time_minutes": {
- "name": "due_date_reminder_lead_time_minutes",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1440
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "user_notification_preference_user_id_user_id_fk": {
- "name": "user_notification_preference_user_id_user_id_fk",
- "tableFrom": "user_notification_preference",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "user_notification_preference_user_id_unique": {
- "name": "user_notification_preference_user_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "user_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_notification_workspace_project": {
- "name": "user_notification_workspace_project",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_rule_id": {
- "name": "workspace_rule_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "user_notification_workspace_project_ruleId_idx": {
- "name": "user_notification_workspace_project_ruleId_idx",
- "columns": [
- {
- "expression": "workspace_rule_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_notification_workspace_project_projectId_idx": {
- "name": "user_notification_workspace_project_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_notification_workspace_project_workspaceId_projectId_idx": {
- "name": "user_notification_workspace_project_workspaceId_projectId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "unwp_workspaceId_workspaceRuleId_idx": {
- "name": "unwp_workspaceId_workspaceRuleId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "workspace_rule_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_notification_workspace_project_workspace_id_workspace_id_fk": {
- "name": "user_notification_workspace_project_workspace_id_workspace_id_fk",
- "tableFrom": "user_notification_workspace_project",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "user_notification_workspace_project_workspace_id_workspace_rule_id_user_notification_workspace_rule_workspace_id_id_fk": {
- "name": "user_notification_workspace_project_workspace_id_workspace_rule_id_user_notification_workspace_rule_workspace_id_id_fk",
- "tableFrom": "user_notification_workspace_project",
- "tableTo": "user_notification_workspace_rule",
- "columnsFrom": [
- "workspace_id",
- "workspace_rule_id"
- ],
- "columnsTo": [
- "workspace_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "user_notification_workspace_project_workspace_id_project_id_project_workspace_id_id_fk": {
- "name": "user_notification_workspace_project_workspace_id_project_id_project_workspace_id_id_fk",
- "tableFrom": "user_notification_workspace_project",
- "tableTo": "project",
- "columnsFrom": [
- "workspace_id",
- "project_id"
- ],
- "columnsTo": [
- "workspace_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "user_notification_workspace_project_rule_project_unique": {
- "name": "user_notification_workspace_project_rule_project_unique",
- "nullsNotDistinct": false,
- "columns": [
- "workspace_rule_id",
- "project_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_notification_workspace_rule": {
- "name": "user_notification_workspace_rule",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "is_active": {
- "name": "is_active",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "email_enabled": {
- "name": "email_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "ntfy_enabled": {
- "name": "ntfy_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "gotify_enabled": {
- "name": "gotify_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "webhook_enabled": {
- "name": "webhook_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "project_mode": {
- "name": "project_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'all'"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "user_notification_workspace_rule_userId_idx": {
- "name": "user_notification_workspace_rule_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_notification_workspace_rule_workspaceId_idx": {
- "name": "user_notification_workspace_rule_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_notification_workspace_rule_user_id_user_id_fk": {
- "name": "user_notification_workspace_rule_user_id_user_id_fk",
- "tableFrom": "user_notification_workspace_rule",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "user_notification_workspace_rule_workspace_id_workspace_id_fk": {
- "name": "user_notification_workspace_rule_workspace_id_workspace_id_fk",
- "tableFrom": "user_notification_workspace_rule",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "user_notification_workspace_rule_user_workspace_unique": {
- "name": "user_notification_workspace_rule_user_workspace_unique",
- "nullsNotDistinct": false,
- "columns": [
- "user_id",
- "workspace_id"
- ]
- },
- "user_notification_workspace_rule_workspace_id_id_unique": {
- "name": "user_notification_workspace_rule_workspace_id_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.verification": {
- "name": "verification",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "verification_identifier_idx": {
- "name": "verification_identifier_idx",
- "columns": [
- {
- "expression": "identifier",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workflow_rule": {
- "name": "workflow_rule",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "integration_type": {
- "name": "integration_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "event_type": {
- "name": "event_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "column_id": {
- "name": "column_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "workflow_rule_projectId_idx": {
- "name": "workflow_rule_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workflow_rule_columnId_idx": {
- "name": "workflow_rule_columnId_idx",
- "columns": [
- {
- "expression": "column_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workflow_rule_project_id_project_id_fk": {
- "name": "workflow_rule_project_id_project_id_fk",
- "tableFrom": "workflow_rule",
- "tableTo": "project",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "workflow_rule_column_id_column_id_fk": {
- "name": "workflow_rule_column_id_column_id_fk",
- "tableFrom": "workflow_rule",
- "tableTo": "column",
- "columnsFrom": [
- "column_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace": {
- "name": "workspace",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "logo": {
- "name": "logo",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "workspace_slug_unique": {
- "name": "workspace_slug_unique",
- "nullsNotDistinct": false,
- "columns": [
- "slug"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace_billing": {
- "name": "workspace_billing",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "founding_free": {
- "name": "founding_free",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "trial_ends_at": {
- "name": "trial_ends_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "creem_customer_id": {
- "name": "creem_customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "creem_subscription_id": {
- "name": "creem_subscription_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "creem_product_id": {
- "name": "creem_product_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "plan": {
- "name": "plan",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "billing_interval": {
- "name": "billing_interval",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "seats": {
- "name": "seats",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "current_period_end": {
- "name": "current_period_end",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "canceled_at": {
- "name": "canceled_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "workspace_billing_workspaceId_idx": {
- "name": "workspace_billing_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_billing_workspace_id_workspace_id_fk": {
- "name": "workspace_billing_workspace_id_workspace_id_fk",
- "tableFrom": "workspace_billing",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "workspace_billing_workspace_id_unique": {
- "name": "workspace_billing_workspace_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "workspace_id"
- ]
- },
- "workspace_billing_creem_subscription_id_unique": {
- "name": "workspace_billing_creem_subscription_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "creem_subscription_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace_member_access": {
- "name": "workspace_member_access",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "project_access": {
- "name": "project_access",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'all'"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "workspace_member_access_userId_idx": {
- "name": "workspace_member_access_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_member_access_workspace_id_workspace_id_fk": {
- "name": "workspace_member_access_workspace_id_workspace_id_fk",
- "tableFrom": "workspace_member_access",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "workspace_member_access_user_id_user_id_fk": {
- "name": "workspace_member_access_user_id_user_id_fk",
- "tableFrom": "workspace_member_access",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "workspace_member_access_workspace_user_unique": {
- "name": "workspace_member_access_workspace_user_unique",
- "nullsNotDistinct": false,
- "columns": [
- "workspace_id",
- "user_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace_member_project": {
- "name": "workspace_member_project",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true,
- "default": "(now() AT TIME ZONE 'utc')"
- }
- },
- "indexes": {
- "workspace_member_project_projectId_idx": {
- "name": "workspace_member_project_projectId_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_member_project_user_id_user_id_fk": {
- "name": "workspace_member_project_user_id_user_id_fk",
- "tableFrom": "workspace_member_project",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "workspace_member_project_workspace_id_project_id_project_workspace_id_id_fk": {
- "name": "workspace_member_project_workspace_id_project_id_project_workspace_id_id_fk",
- "tableFrom": "workspace_member_project",
- "tableTo": "project",
- "columnsFrom": [
- "workspace_id",
- "project_id"
- ],
- "columnsTo": [
- "workspace_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "workspace_member_project_workspace_user_project_unique": {
- "name": "workspace_member_project_workspace_user_project_unique",
- "nullsNotDistinct": false,
- "columns": [
- "workspace_id",
- "user_id",
- "project_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace_member": {
- "name": "workspace_member",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'member'"
- },
- "joined_at": {
- "name": "joined_at",
- "type": "timestamp",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "workspace_member_workspaceId_idx": {
- "name": "workspace_member_workspaceId_idx",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_member_userId_idx": {
- "name": "workspace_member_userId_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_member_workspace_id_workspace_id_fk": {
- "name": "workspace_member_workspace_id_workspace_id_fk",
- "tableFrom": "workspace_member",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "workspace_member_user_id_user_id_fk": {
- "name": "workspace_member_user_id_user_id_fk",
- "tableFrom": "workspace_member",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- }
- },
- "enums": {},
- "schemas": {},
- "sequences": {},
- "roles": {},
- "policies": {},
- "views": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-}
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json
index d29e227e2..b20531503 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -449,13 +449,6 @@
"when": 1791727180448,
"tag": "0063_import_runs",
"breakpoints": true
- },
- {
- "idx": 64,
- "version": "7",
- "when": 1791845931443,
- "tag": "0064_wakeful_maximus",
- "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/apps/api/src/column/available-slug.test.ts b/apps/api/src/column/available-slug.test.ts
new file mode 100644
index 000000000..14e11cade
--- /dev/null
+++ b/apps/api/src/column/available-slug.test.ts
@@ -0,0 +1,14 @@
+import { describe, expect, it } from "vite-plus/test";
+import { availableSlug } from "./available-slug";
+
+describe("availableSlug", () => {
+ it("keeps a free slug", () => {
+ expect(availableSlug("in-review", new Set(["to-do"]))).toBe("in-review");
+ });
+
+ it("suffixes a taken slug with the first free number", () => {
+ expect(
+ availableSlug("in-review", new Set(["in-review", "in-review-2"])),
+ ).toBe("in-review-3");
+ });
+});
diff --git a/apps/api/src/column/available-slug.ts b/apps/api/src/column/available-slug.ts
new file mode 100644
index 000000000..9f18f2f37
--- /dev/null
+++ b/apps/api/src/column/available-slug.ts
@@ -0,0 +1,9 @@
+// Renamed columns keep their slug because it is also the task status, so a
+// new column's name can derive a slug that is already taken.
+export function availableSlug(base: string, taken: ReadonlySet<string>) {
+ let slug = base;
+ for (let suffix = 2; taken.has(slug); suffix++) {
+ slug = `${base}-${suffix}`;
+ }
+ return slug;
+}
diff --git a/apps/api/src/column/controllers/create-column.ts b/apps/api/src/column/controllers/create-column.ts
index 1e620d0ce..89e978237 100644
--- a/apps/api/src/column/controllers/create-column.ts
+++ b/apps/api/src/column/controllers/create-column.ts
@@ -1,3 +1,4 @@
+import { availableSlug } from "../available-slug";
import { toSlug } from "../to-slug";
import { publishEvent } from "../../events";
import { eq, sql } from "drizzle-orm";
@@ -33,40 +34,32 @@ async function createColumn({
});
}
- const existing = await db
- .select({ id: columnTable.id })
- .from(columnTable)
- .where(
- sql`${columnTable.projectId} = ${projectId} AND ${columnTable.slug} = ${slug}`,
+ const created = await db.transaction(async (tx) => {
+ // Serialize creates per project so concurrent requests cannot pick the
+ // same slug or position.
+ await tx.execute(
+ sql`SELECT pg_advisory_xact_lock(1525, hashtext(${projectId}))`,
);
- if (existing.length > 0) {
- throw new HTTPException(409, {
- message: `Column with slug "${slug}" already exists in this project`,
- });
- }
-
- const [maxPos] = await db
- .select({
- maxPosition: sql<number>`COALESCE(MAX(${columnTable.position}), -1)`,
- })
- .from(columnTable)
- .where(eq(columnTable.projectId, projectId));
-
- const position = (maxPos?.maxPosition ?? -1) + 1;
+ const columns = await tx
+ .select({ slug: columnTable.slug, position: columnTable.position })
+ .from(columnTable)
+ .where(eq(columnTable.projectId, projectId));
- const [created] = await db
- .insert(columnTable)
- .values({
- projectId,
- name,
- slug,
- position,
- icon: icon || null,
- color: color || null,
- isFinal: isFinal ?? false,
- })
- .returning();
+ const [row] = await tx
+ .insert(columnTable)
+ .values({
+ projectId,
+ name,
+ slug: availableSlug(slug, new Set(columns.map((c) => c.slug))),
+ position: Math.max(-1, ...columns.map((c) => c.position)) + 1,
+ icon: icon || null,
+ color: color || null,
+ isFinal: isFinal ?? false,
+ })
+ .returning();
+ return row;
+ });
if (!created) {
throw new HTTPException(500, { message: "Failed to create column" });
diff --git a/apps/api/src/column/controllers/update-column.ts b/apps/api/src/column/controllers/update-column.ts
index 1bb6b73d6..f42ebbeb1 100644
--- a/apps/api/src/column/controllers/update-column.ts
+++ b/apps/api/src/column/controllers/update-column.ts
@@ -1,11 +1,9 @@
-import { eq, and, ne } from "drizzle-orm";
+import { eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { columnTable, taskTable } from "../../database/schema";
+import { columnTable } from "../../database/schema";
import { publishEvent } from "../../events";
import { getProjectSubtaskParentProjects } from "../../task/get-subtask-parent-projects";
-import { VIRTUAL_STATUSES } from "../../task/validate-task-fields";
-import { toSlug } from "./create-column";
async function updateColumn(
id: string,
@@ -24,75 +22,22 @@ async function updateColumn(
throw new HTTPException(404, { message: "Column not found" });
}
- let newSlug: string | undefined;
-
- if (data.name !== undefined && data.name !== existing.name) {
- const slug = toSlug(data.name);
-
- if (!slug) {
- throw new HTTPException(400, {
- message: "Column name must contain at least one alphanumeric character",
- });
- }
-
- if ((VIRTUAL_STATUSES as readonly string[]).includes(slug)) {
- throw new HTTPException(409, {
- message: `Column slug "${slug}" is reserved for virtual task statuses`,
- });
- }
-
- if (slug !== existing.slug) {
- const conflict = await db.query.columnTable.findFirst({
- where: and(
- eq(columnTable.projectId, existing.projectId),
- eq(columnTable.slug, slug),
- ne(columnTable.id, id),
- ),
- });
-
- if (conflict) {
- throw new HTTPException(409, {
- message: `Column with slug "${slug}" already exists in this project`,
- });
- }
-
- newSlug = slug;
- }
+ const [updated] = await db
+ .update(columnTable)
+ .set({
+ ...(data.name !== undefined && { name: data.name }),
+ ...(data.icon !== undefined && { icon: data.icon }),
+ ...(data.color !== undefined && { color: data.color }),
+ ...(data.isFinal !== undefined && { isFinal: data.isFinal }),
+ })
+ .where(eq(columnTable.id, id))
+ .returning();
+
+ if (!updated) {
+ throw new HTTPException(500, { message: "Failed to update column" });
}
- const updated = await db.transaction(async (tx) => {
- const [updatedColumn] = await tx
- .update(columnTable)
- .set({
- ...(data.name !== undefined && { name: data.name }),
- ...(newSlug !== undefined && { slug: newSlug }),
- ...(data.icon !== undefined && { icon: data.icon }),
- ...(data.color !== undefined && { color: data.color }),
- ...(data.isFinal !== undefined && { isFinal: data.isFinal }),
- })
- .where(eq(columnTable.id, id))
- .returning();
-
- if (!updatedColumn) {
- throw new HTTPException(500, { message: "Failed to update column" });
- }
-
- if (newSlug !== undefined) {
- await tx
- .update(taskTable)
- .set({ status: newSlug })
- .where(
- and(
- eq(taskTable.projectId, existing.projectId),
- eq(taskTable.status, existing.slug),
- ),
- );
- }
-
- return updatedColumn;
- });
-
- if (existing.isFinal !== updated.isFinal || existing.slug !== updated.slug) {
+ if (existing.isFinal !== updated.isFinal) {
const parents = await getProjectSubtaskParentProjects(
updated.projectId,
updated.slug,
diff --git a/apps/api/src/column/index.ts b/apps/api/src/column/index.ts
index 23d665f49..1da9fa88a 100644
--- a/apps/api/src/column/index.ts
+++ b/apps/api/src/column/index.ts
@@ -43,7 +43,7 @@ const createColumnRoute = createRoute({
tags: ["Columns"],
summary: "Create column",
description:
- "Add a column to the end of a project's board. The slug is derived from the name.",
+ "Add a column to the end of a project's board. The slug is derived from the name, with a numeric suffix such as `-2` when another column in the project already uses it.",
middleware: [
workspaceAccess.fromProject("projectId"),
requireWorkspacePermission({ project: ["update"] }),
@@ -61,7 +61,7 @@ const createColumnRoute = createRoute({
403: errorResponse(
"No access to the project, or missing project:update permission",
),
- 409: errorResponse("The slug is reserved, or already used in this project"),
+ 409: errorResponse("The slug is reserved for a virtual task status"),
404: errorResponse("Project not found"),
},
});
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index 78585e9c5..d905f0951 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -464,10 +464,7 @@ export const columnTable = pgTable(
.$onUpdate(() => new Date())
.notNull(),
},
- (table) => [
- index("column_projectId_idx").on(table.projectId),
- unique("column_project_slug_unique").on(table.projectId, table.slug),
- ],
+ (table) => [index("column_projectId_idx").on(table.projectId)],
);
export const workflowRuleTable = pgTable(
diff --git a/apps/docs/cli/reference.mdx b/apps/docs/cli/reference.mdx
index aaf82b8e3..f03529a26 100644
--- a/apps/docs/cli/reference.mdx
+++ b/apps/docs/cli/reference.mdx
@@ -605,7 +605,7 @@ Lists a project's columns in board order.
kaneo column create [<name>] [-p <project>] [--final] [--icon <name>] [--color <hex>]
```
-Adds a column to the end of the board. The slug comes from the name. `--final` marks it as a done column, which stops overdue reminders for its tasks.
+Adds a column to the end of the board. The slug comes from the name, with a suffix such as `-2` if another column already uses it. `--final` marks it as a done column, which stops overdue reminders for its tasks.
### `kaneo column edit`
diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json
index 45c88f56d..e196867dc 100644
--- a/apps/docs/openapi.json
+++ b/apps/docs/openapi.json
@@ -13057,7 +13057,7 @@
"Columns"
],
"summary": "Create column",
- "description": "Add a column to the end of a project's board. The slug is derived from the name.",
+ "description": "Add a column to the end of a project's board. The slug is derived from the name, with a numeric suffix such as `-2` when another column in the project already uses it.",
"parameters": [
{
"schema": {
@@ -13147,7 +13147,7 @@
}
},
"409": {
- "description": "The slug is reserved, or already used in this project",
+ "description": "The slug is reserved for a virtual task status",
"content": {
"application/json": {
"schema": {
diff --git a/apps/web/src/hooks/use-project-websocket-cache.test.tsx b/apps/web/src/hooks/use-project-websocket-cache.test.tsx
index 4eaaa9e6d..8f9be5afd 100644
--- a/apps/web/src/hooks/use-project-websocket-cache.test.tsx
+++ b/apps/web/src/hooks/use-project-websocket-cache.test.tsx
@@ -492,6 +492,16 @@ it("refreshes workspace label filters when a remote project event changes labels
});
});
+it("refreshes the project's column list when a remote project event arrives", async () => {
+ renderHook(() => useProjectWebSocket("p"));
+ Socket.current.message("PROJECT_UPDATED", {});
+ await vi.waitFor(() =>
+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({
+ queryKey: ["columns", "p"],
+ }),
+ );
+});
+
it("refreshes task link details when a project event explicitly changes links", async () => {
renderHook(() => useProjectWebSocket("p"));
Socket.current.message("PROJECT_UPDATED", { linksChanged: true });
diff --git a/tests/api-integration/assigned-tasks.test.ts b/tests/api-integration/assigned-tasks.test.ts
index 720939eaf..fca09a906 100644
--- a/tests/api-integration/assigned-tasks.test.ts
+++ b/tests/api-integration/assigned-tasks.test.ts
@@ -156,7 +156,7 @@ describe("API integration: assigned tasks", () => {
});
});
- it("counts open tasks by column reference and resolves legacy tasks by status slug", async () => {
+ it("uses column references when duplicate slugs include final columns", async () => {
const member = await createWorkspaceMember();
const { project, columns } = await createProjectFixture({
workspaceId: member.workspace.id,
@@ -166,7 +166,7 @@ describe("API integration: assigned tasks", () => {
.values({
projectId: project.id,
name: "Duplicate to-do",
- slug: `${columns.todo.slug}-final`,
+ slug: columns.todo.slug,
position: -1,
isFinal: true,
})
@@ -181,38 +181,35 @@ describe("API integration: assigned tasks", () => {
userId: member.user.id,
})
.returning();
- const [, legacy] = await db
- .insert(schema.taskTable)
- .values([
- {
- projectId: project.id,
- title: "In the final duplicate",
- status: columns.todo.slug,
- columnId: finalColumn.id,
- userId: member.user.id,
- number: 2,
- },
- {
- projectId: project.id,
- title: "Legacy status without column",
- status: columns.todo.slug,
- userId: member.user.id,
- number: 3,
- },
- ])
- .returning();
+ await db.insert(schema.taskTable).values([
+ {
+ projectId: project.id,
+ title: "In the final duplicate",
+ status: columns.todo.slug,
+ columnId: finalColumn.id,
+ userId: member.user.id,
+ number: 2,
+ },
+ {
+ projectId: project.id,
+ title: "Legacy ambiguous status",
+ status: columns.todo.slug,
+ userId: member.user.id,
+ number: 3,
+ },
+ ]);
mockAuthenticatedSession(member.user);
const { app } = createApp();
const countResponse = await app.request(
`/api/task/assigned?workspaceId=${member.workspace.id}&countOnly=true`,
);
- expect(await countResponse.json()).toEqual({ tasks: [], total: 2 });
+ expect(await countResponse.json()).toEqual({ tasks: [], total: 1 });
const response = await app.request(
`/api/task/assigned?workspaceId=${member.workspace.id}`,
);
expect(response.status).toBe(200);
const body = (await response.json()) as AssignedTasksResponse;
- expect(body.total).toBe(2);
+ expect(body.total).toBe(1);
const details = await app.request(`/api/task/${task.id}`);
expect(details.status).toBe(200);
expect(await details.json()).toMatchObject({
@@ -220,12 +217,9 @@ describe("API integration: assigned tasks", () => {
columnId: columns.todo.id,
workspaceId: member.workspace.id,
});
- expect(body.tasks.map((t) => t.id).sort()).toEqual(
- [task.id, legacy.id].sort(),
- );
- expect(body.tasks.every((t) => t.statusName === columns.todo.name)).toBe(
- true,
- );
+ expect(body.tasks).toEqual([
+ expect.objectContaining({ id: task.id, statusName: columns.todo.name }),
+ ]);
});
it("refuses a workspace the caller does not belong to", async () => {
diff --git a/tests/api-integration/column-live-updates.test.ts b/tests/api-integration/column-live-updates.test.ts
index b6e8f6ec3..e0e55832a 100644
--- a/tests/api-integration/column-live-updates.test.ts
+++ b/tests/api-integration/column-live-updates.test.ts
@@ -24,20 +24,19 @@ it("announces committed column changes for focused remote boards", async () => {
await updateColumn(column.id, { name: "Reviewed", color: "#123456" });
await reorderColumns(project.id, [{ id: column.id, position: 0 }]);
await deleteColumn(column.id);
- expect(publish.mock.calls).toEqual([
- ["project.updated", { projectId: project.id }],
- ["subtask-parents.refresh", { projects: [{ projectId: project.id }] }],
- ["project.updated", { projectId: project.id }],
- ["project.updated", { projectId: project.id }],
- ["project.updated", { projectId: project.id }],
- ]);
+ expect(publish.mock.calls).toEqual(
+ Array.from({ length: 4 }, () => [
+ "project.updated",
+ { projectId: project.id },
+ ]),
+ );
expect(
await db.query.columnTable.findFirst({
where: (table, { eq }) => eq(table.id, column.id),
}),
).toBeUndefined();
await expect(deleteColumn(column.id)).rejects.toThrow("Column not found");
- expect(publish).toHaveBeenCalledTimes(5);
+ expect(publish).toHaveBeenCalledTimes(4);
});
it.each(["missing", "foreign"])(
diff --git a/tests/api-integration/column-slug.test.ts b/tests/api-integration/column-slug.test.ts
new file mode 100644
index 000000000..71a513c66
--- /dev/null
+++ b/tests/api-integration/column-slug.test.ts
@@ -0,0 +1,125 @@
+import { eq } from "drizzle-orm";
+import { beforeEach, describe, expect, it } from "vite-plus/test";
+import db, { schema } from "../../apps/api/src/database";
+import createColumn from "../../apps/api/src/column/controllers/create-column";
+import { createApp } from "../../apps/api/src/index";
+import { mockAuthenticatedSession } from "./helpers/auth";
+import { resetTestDatabase } from "./helpers/database";
+import {
+ createProjectFixture,
+ createWorkspaceMember,
+} from "./helpers/fixtures";
+
+beforeEach(resetTestDatabase);
+
+async function setup() {
+ const { user, workspace } = await createWorkspaceMember({ role: "owner" });
+ const { project, columns } = await createProjectFixture({
+ workspaceId: workspace.id,
+ });
+ const [task] = await db
+ .insert(schema.taskTable)
+ .values({
+ projectId: project.id,
+ title: "Waiting for review",
+ status: columns.inReview.slug,
+ columnId: columns.inReview.id,
+ userId: user.id,
+ number: 1,
+ })
+ .returning();
+ if (!task) throw new Error("Failed to seed task");
+ mockAuthenticatedSession(user);
+ const { app } = createApp();
+ const send = (method: string, path: string, body: object) =>
+ app.request(path, {
+ method,
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(body),
+ });
+ return { project, columns, task, send };
+}
+
+describe("column slugs", () => {
+ it("keeps the slug and task statuses when a column is renamed", async () => {
+ const { columns, task, send } = await setup();
+
+ const response = await send("PUT", `/api/column/${columns.inReview.id}`, {
+ name: "Review Queue",
+ });
+
+ expect(response.status).toBe(200);
+ expect(await response.json()).toMatchObject({
+ name: "Review Queue",
+ slug: "in-review",
+ });
+ expect(
+ await db.query.taskTable.findFirst({
+ where: eq(schema.taskTable.id, task.id),
+ }),
+ ).toMatchObject({ status: "in-review", columnId: columns.inReview.id });
+ });
+
+ it("creates a column whose name derives a slug a renamed column still holds", async () => {
+ const { project, columns, task, send } = await setup();
+ await send("PUT", `/api/column/${columns.inReview.id}`, {
+ name: "Review Queue",
+ });
+
+ const first = await send("POST", `/api/column/${project.id}`, {
+ name: "In Review",
+ });
+ const second = await send("POST", `/api/column/${project.id}`, {
+ name: "in review",
+ });
+
+ expect(first.status).toBe(200);
+ expect(await first.json()).toMatchObject({
+ name: "In Review",
+ slug: "in-review-2",
+ position: 4,
+ });
+ expect(second.status).toBe(200);
+ expect(await second.json()).toMatchObject({
+ name: "in review",
+ slug: "in-review-3",
+ position: 5,
+ });
+ expect(
+ await db.query.taskTable.findFirst({
+ where: eq(schema.taskTable.id, task.id),
+ }),
+ ).toMatchObject({ status: "in-review", columnId: columns.inReview.id });
+ });
+
+ it("still rejects names reserved for virtual statuses", async () => {
+ const { project, send } = await setup();
+
+ const response = await send("POST", `/api/column/${project.id}`, {
+ name: "Planned",
+ });
+
+ expect(response.status).toBe(409);
+ });
+
+ it("gives concurrent creates distinct slugs and positions", async () => {
+ const { project } = await setup();
+
+ const created = await Promise.all(
+ Array.from({ length: 5 }, () =>
+ createColumn({ projectId: project.id, name: "QA" }),
+ ),
+ );
+
+ expect(created.map((column) => column.slug).sort()).toEqual([
+ "qa",
+ "qa-2",
+ "qa-3",
+ "qa-4",
+ "qa-5",
+ ]);
+ expect(created.map((column) => column.position).sort()).toEqual([
+ 4, 5, 6, 7, 8,
+ ]);
+ });
+});
diff --git a/tests/api-integration/workspace-activity.test.ts b/tests/api-integration/workspace-activity.test.ts
index e3b538821..d62f3bcdf 100644
--- a/tests/api-integration/workspace-activity.test.ts
+++ b/tests/api-integration/workspace-activity.test.ts
@@ -197,14 +197,14 @@ describe("API integration: workspace activity", () => {
expect(invalid.status).toBe(400);
}
});
- it("resolves historical column names by exact status slug", async () => {
+ it("does not guess a historical column name when its status slug is ambiguous", async () => {
const member = await createWorkspaceMember();
const { project, columns } = await createProjectFixture({
workspaceId: member.workspace.id,
});
await db.insert(schema.columnTable).values({
projectId: project.id,
- slug: `${columns.todo.slug}-other`,
+ slug: columns.todo.slug,
name: "Other queue",
position: -1,
});
@@ -232,9 +232,9 @@ describe("API integration: workspace activity", () => {
);
expect(response.status).toBe(200);
const [event] = await response.json();
+ expect(event.eventData).not.toHaveProperty("oldStatusName");
expect(event.eventData).toMatchObject({
oldStatus: "to-do",
- oldStatusName: "To Do",
newStatusName: "In Progress",
});
});