@@ -432,6 +454,29 @@ export default function CardPage({ isTemplate }: { isTemplate?: boolean }) {
setActiveChecklistForm={setActiveChecklistForm}
viewOnly={!canEdit}
/>
+ {card.children && card.children.length > 0 && (
+
+
+ {t`Sub-tasks`}
+
+
+ {card.children.map((child) => (
+
+
+ {child.title}
+
+
+ {child.list.name}
+
+
+ ))}
+
+
+ )}
{!isTemplate && (
<>
{card?.attachments.length > 0 && (
diff --git a/packages/api/src/routers/card.ts b/packages/api/src/routers/card.ts
index a7aa1f6e7..cef2c3fd3 100644
--- a/packages/api/src/routers/card.ts
+++ b/packages/api/src/routers/card.ts
@@ -1357,4 +1357,140 @@ export const cardRouter = createTRPCRouter({
return { publicId: newCard.publicId };
}),
+ setParent: protectedProcedure
+ .meta({
+ openapi: {
+ summary: "Set or remove a card's parent (epic)",
+ method: "PUT",
+ path: "/cards/{cardPublicId}/parent",
+ description: "Sets a parent card (epic) for a card, or removes it",
+ tags: ["Cards"],
+ protect: true,
+ },
+ })
+ .input(
+ z.object({
+ cardPublicId: z.string().min(12),
+ parentPublicId: z.string().min(12).nullable(),
+ }),
+ )
+ .output(z.object({ success: z.boolean() }))
+ .mutation(async ({ ctx, input }) => {
+ const userId = ctx.user?.id;
+
+ if (!userId)
+ throw new TRPCError({
+ message: "User not authenticated",
+ code: "UNAUTHORIZED",
+ });
+
+ const card = await cardRepo.getWorkspaceAndCardIdByCardPublicId(
+ ctx.db,
+ input.cardPublicId,
+ );
+
+ if (!card)
+ throw new TRPCError({
+ message: `Card with public ID ${input.cardPublicId} not found`,
+ code: "NOT_FOUND",
+ });
+
+ await assertPermission(ctx.db, userId, card.workspaceId, "card:edit");
+
+ let parentId: number | null = null;
+
+ if (input.parentPublicId) {
+ const parentCard = await cardRepo.getByPublicId(
+ ctx.db,
+ input.parentPublicId,
+ );
+
+ if (!parentCard)
+ throw new TRPCError({
+ message: `Parent card with public ID ${input.parentPublicId} not found`,
+ code: "NOT_FOUND",
+ });
+
+ // Prevent self-reference
+ if (parentCard.id === card.id)
+ throw new TRPCError({
+ message: "A card cannot be its own parent",
+ code: "BAD_REQUEST",
+ });
+
+ parentId = parentCard.id;
+ }
+
+ await cardRepo.setParent(ctx.db, {
+ cardId: card.id,
+ parentId,
+ });
+
+ return { success: true };
+ }),
+ getEpics: protectedProcedure
+ .meta({
+ openapi: {
+ summary: "Get epics for a board",
+ method: "GET",
+ path: "/boards/{boardPublicId}/epics",
+ description: "Returns all cards that have children (epics) for a board, with progress",
+ tags: ["Cards"],
+ protect: true,
+ },
+ })
+ .input(
+ z.object({
+ boardPublicId: z.string().min(12),
+ }),
+ )
+ .output(
+ z.array(
+ z.object({
+ publicId: z.string(),
+ title: z.string(),
+ dueDate: z.date().nullable(),
+ listName: z.string(),
+ totalChildren: z.number(),
+ doneChildren: z.number(),
+ }),
+ ),
+ )
+ .query(async ({ ctx, input }) => {
+ const userId = ctx.user?.id;
+
+ if (!userId)
+ throw new TRPCError({
+ message: "User not authenticated",
+ code: "UNAUTHORIZED",
+ });
+
+ const board = await ctx.db.query.boards.findFirst({
+ columns: { id: true, workspaceId: true },
+ where: (boards, { eq, isNull, and }) =>
+ and(
+ eq(boards.publicId, input.boardPublicId),
+ isNull(boards.deletedAt),
+ ),
+ });
+
+ if (!board)
+ throw new TRPCError({
+ message: `Board with public ID ${input.boardPublicId} not found`,
+ code: "NOT_FOUND",
+ });
+
+ await assertPermission(ctx.db, userId, board.workspaceId, "card:view");
+
+ const epics = await cardRepo.getEpicsByBoard(ctx.db, board.id);
+
+ return epics.map((epic: any) => ({
+ publicId: epic.publicId,
+ title: epic.title,
+ dueDate: epic.dueDate ?? null,
+ listName: epic.list_name,
+ totalChildren: Number(epic.total_children),
+ doneChildren: Number(epic.done_children),
+ }));
+ }),
});
diff --git a/packages/api/src/schemas/board.ts b/packages/api/src/schemas/board.ts
index 5327087e6..e143e60d1 100644
--- a/packages/api/src/schemas/board.ts
+++ b/packages/api/src/schemas/board.ts
@@ -40,6 +40,12 @@ const boardDetailCardSchema = z.object({
description: z.string().nullable(),
index: z.number(),
dueDate: z.date().nullable(),
+ parent: z
+ .object({
+ publicId: z.string(),
+ title: z.string(),
+ })
+ .nullable(),
labels: z.array(labelSchema),
members: z.array(boardCardMemberSchema),
attachments: z.array(z.object({ publicId: z.string() })),
diff --git a/packages/api/src/schemas/card.ts b/packages/api/src/schemas/card.ts
index 2a13b28cb..39dcb3b14 100644
--- a/packages/api/src/schemas/card.ts
+++ b/packages/api/src/schemas/card.ts
@@ -48,6 +48,23 @@ export const cardDetailSchema = z.object({
description: z.string().nullable(),
dueDate: z.date().nullable(),
createdBy: z.string().nullable(),
+ parent: z
+ .object({
+ publicId: z.string(),
+ title: z.string(),
+ })
+ .nullable(),
+ children: z.array(
+ z.object({
+ publicId: z.string(),
+ title: z.string(),
+ index: z.number(),
+ list: z.object({
+ publicId: z.string(),
+ name: z.string(),
+ }),
+ }),
+ ),
labels: z.array(labelSchema),
attachments: z.array(
z.object({
diff --git a/packages/db/migrations/20260422101444_add-parent-id-to-card.sql b/packages/db/migrations/20260422101444_add-parent-id-to-card.sql
new file mode 100644
index 000000000..1d9a9bedd
--- /dev/null
+++ b/packages/db/migrations/20260422101444_add-parent-id-to-card.sql
@@ -0,0 +1,6 @@
+ALTER TABLE "card" ADD COLUMN "parentId" bigint;--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "card" ADD CONSTRAINT "card_parentId_card_id_fk" FOREIGN KEY ("parentId") REFERENCES "public"."card"("id") ON DELETE set null ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
diff --git a/packages/db/migrations/meta/20260422101444_snapshot.json b/packages/db/migrations/meta/20260422101444_snapshot.json
new file mode 100644
index 000000000..e6c756a98
--- /dev/null
+++ b/packages/db/migrations/meta/20260422101444_snapshot.json
@@ -0,0 +1,3888 @@
+{
+ "id": "ea4d42cb-8562-4cc3-b103-59dcac81e5cb",
+ "prevId": "8a9c9a82-a807-45ab-97cc-95d0ea84d2aa",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "accountId": {
+ "name": "accountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "providerId": {
+ "name": "providerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accessToken": {
+ "name": "accessToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refreshToken": {
+ "name": "refreshToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idToken": {
+ "name": "idToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accessTokenExpiresAt": {
+ "name": "accessTokenExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refreshTokenExpiresAt": {
+ "name": "refreshTokenExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.apiKey": {
+ "name": "apiKey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refillInterval": {
+ "name": "refillInterval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refillAmount": {
+ "name": "refillAmount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastRefillAt": {
+ "name": "lastRefillAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rateLimitEnabled": {
+ "name": "rateLimitEnabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rateLimitTimeWindow": {
+ "name": "rateLimitTimeWindow",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rateLimitMax": {
+ "name": "rateLimitMax",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requestCount": {
+ "name": "requestCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastRequest": {
+ "name": "lastRequest",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "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": {},
+ "foreignKeys": {
+ "apiKey_userId_user_id_fk": {
+ "name": "apiKey_userId_user_id_fk",
+ "tableFrom": "apiKey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ipAddress": {
+ "name": "ipAddress",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userAgent": {
+ "name": "userAgent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.board": {
+ "name": "board",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "importId": {
+ "name": "importId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "board_visibility",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'private'"
+ },
+ "type": {
+ "name": "type",
+ "type": "board_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'regular'"
+ },
+ "isArchived": {
+ "name": "isArchived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "sourceBoardId": {
+ "name": "sourceBoardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "board_is_archived_idx": {
+ "name": "board_is_archived_idx",
+ "columns": [
+ {
+ "expression": "isArchived",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "board_visibility_idx": {
+ "name": "board_visibility_idx",
+ "columns": [
+ {
+ "expression": "visibility",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "board_type_idx": {
+ "name": "board_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "board_source_idx": {
+ "name": "board_source_idx",
+ "columns": [
+ {
+ "expression": "sourceBoardId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "unique_slug_per_workspace": {
+ "name": "unique_slug_per_workspace",
+ "columns": [
+ {
+ "expression": "workspaceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"board\".\"deletedAt\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "board_createdBy_user_id_fk": {
+ "name": "board_createdBy_user_id_fk",
+ "tableFrom": "board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "board_deletedBy_user_id_fk": {
+ "name": "board_deletedBy_user_id_fk",
+ "tableFrom": "board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "board_importId_import_id_fk": {
+ "name": "board_importId_import_id_fk",
+ "tableFrom": "board",
+ "tableTo": "import",
+ "columnsFrom": [
+ "importId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "board_workspaceId_workspace_id_fk": {
+ "name": "board_workspaceId_workspace_id_fk",
+ "tableFrom": "board",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "board_publicId_unique": {
+ "name": "board_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.user_board_favorites": {
+ "name": "user_board_favorites",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "boardId": {
+ "name": "boardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_board_favorite_user_idx": {
+ "name": "user_board_favorite_user_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_board_favorite_board_idx": {
+ "name": "user_board_favorite_board_idx",
+ "columns": [
+ {
+ "expression": "boardId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_board_favorites_userId_user_id_fk": {
+ "name": "user_board_favorites_userId_user_id_fk",
+ "tableFrom": "user_board_favorites",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_board_favorites_boardId_board_id_fk": {
+ "name": "user_board_favorites_boardId_board_id_fk",
+ "tableFrom": "user_board_favorites",
+ "tableTo": "board",
+ "columnsFrom": [
+ "boardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "user_board_favorites_userId_boardId_pk": {
+ "name": "user_board_favorites_userId_boardId_pk",
+ "columns": [
+ "userId",
+ "boardId"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.card_activity": {
+ "name": "card_activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "card_activity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fromIndex": {
+ "name": "fromIndex",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toIndex": {
+ "name": "toIndex",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fromListId": {
+ "name": "fromListId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toListId": {
+ "name": "toListId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "labelId": {
+ "name": "labelId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspaceMemberId": {
+ "name": "workspaceMemberId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fromTitle": {
+ "name": "fromTitle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toTitle": {
+ "name": "toTitle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fromDescription": {
+ "name": "fromDescription",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toDescription": {
+ "name": "toDescription",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "commentId": {
+ "name": "commentId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fromComment": {
+ "name": "fromComment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toComment": {
+ "name": "toComment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fromDueDate": {
+ "name": "fromDueDate",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "toDueDate": {
+ "name": "toDueDate",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sourceBoardId": {
+ "name": "sourceBoardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachmentId": {
+ "name": "attachmentId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_activity_cardId_card_id_fk": {
+ "name": "card_activity_cardId_card_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_activity_fromListId_list_id_fk": {
+ "name": "card_activity_fromListId_list_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "list",
+ "columnsFrom": [
+ "fromListId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_activity_toListId_list_id_fk": {
+ "name": "card_activity_toListId_list_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "list",
+ "columnsFrom": [
+ "toListId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_activity_labelId_label_id_fk": {
+ "name": "card_activity_labelId_label_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "label",
+ "columnsFrom": [
+ "labelId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_activity_workspaceMemberId_workspace_members_id_fk": {
+ "name": "card_activity_workspaceMemberId_workspace_members_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "workspace_members",
+ "columnsFrom": [
+ "workspaceMemberId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_activity_createdBy_user_id_fk": {
+ "name": "card_activity_createdBy_user_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_activity_commentId_card_comments_id_fk": {
+ "name": "card_activity_commentId_card_comments_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "card_comments",
+ "columnsFrom": [
+ "commentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_activity_sourceBoardId_board_id_fk": {
+ "name": "card_activity_sourceBoardId_board_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "board",
+ "columnsFrom": [
+ "sourceBoardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_activity_attachmentId_card_attachment_id_fk": {
+ "name": "card_activity_attachmentId_card_attachment_id_fk",
+ "tableFrom": "card_activity",
+ "tableTo": "card_attachment",
+ "columnsFrom": [
+ "attachmentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "card_activity_publicId_unique": {
+ "name": "card_activity_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.card_attachment": {
+ "name": "card_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "originalFilename": {
+ "name": "originalFilename",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contentType": {
+ "name": "contentType",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3Key": {
+ "name": "s3Key",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_attachment_cardId_card_id_fk": {
+ "name": "card_attachment_cardId_card_id_fk",
+ "tableFrom": "card_attachment",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_attachment_createdBy_user_id_fk": {
+ "name": "card_attachment_createdBy_user_id_fk",
+ "tableFrom": "card_attachment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "card_attachment_publicId_unique": {
+ "name": "card_attachment_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public._card_workspace_members": {
+ "name": "_card_workspace_members",
+ "schema": "",
+ "columns": {
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspaceMemberId": {
+ "name": "workspaceMemberId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "_card_workspace_members_cardId_card_id_fk": {
+ "name": "_card_workspace_members_cardId_card_id_fk",
+ "tableFrom": "_card_workspace_members",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "_card_workspace_members_workspaceMemberId_workspace_members_id_fk": {
+ "name": "_card_workspace_members_workspaceMemberId_workspace_members_id_fk",
+ "tableFrom": "_card_workspace_members",
+ "tableTo": "workspace_members",
+ "columnsFrom": [
+ "workspaceMemberId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "_card_workspace_members_cardId_workspaceMemberId_pk": {
+ "name": "_card_workspace_members_cardId_workspaceMemberId_pk",
+ "columns": [
+ "cardId",
+ "workspaceMemberId"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.card": {
+ "name": "card",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "index": {
+ "name": "index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "listId": {
+ "name": "listId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "importId": {
+ "name": "importId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dueDate": {
+ "name": "dueDate",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_createdBy_user_id_fk": {
+ "name": "card_createdBy_user_id_fk",
+ "tableFrom": "card",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_deletedBy_user_id_fk": {
+ "name": "card_deletedBy_user_id_fk",
+ "tableFrom": "card",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_listId_list_id_fk": {
+ "name": "card_listId_list_id_fk",
+ "tableFrom": "card",
+ "tableTo": "list",
+ "columnsFrom": [
+ "listId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_importId_import_id_fk": {
+ "name": "card_importId_import_id_fk",
+ "tableFrom": "card",
+ "tableTo": "import",
+ "columnsFrom": [
+ "importId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "card_parentId_card_id_fk": {
+ "name": "card_parentId_card_id_fk",
+ "tableFrom": "card",
+ "tableTo": "card",
+ "columnsFrom": [
+ "parentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "card_publicId_unique": {
+ "name": "card_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public._card_labels": {
+ "name": "_card_labels",
+ "schema": "",
+ "columns": {
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "labelId": {
+ "name": "labelId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "_card_labels_cardId_card_id_fk": {
+ "name": "_card_labels_cardId_card_id_fk",
+ "tableFrom": "_card_labels",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "_card_labels_labelId_label_id_fk": {
+ "name": "_card_labels_labelId_label_id_fk",
+ "tableFrom": "_card_labels",
+ "tableTo": "label",
+ "columnsFrom": [
+ "labelId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "_card_labels_cardId_labelId_pk": {
+ "name": "_card_labels_cardId_labelId_pk",
+ "columns": [
+ "cardId",
+ "labelId"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.card_comments": {
+ "name": "card_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "comment": {
+ "name": "comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_comments_cardId_card_id_fk": {
+ "name": "card_comments_cardId_card_id_fk",
+ "tableFrom": "card_comments",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_comments_createdBy_user_id_fk": {
+ "name": "card_comments_createdBy_user_id_fk",
+ "tableFrom": "card_comments",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_comments_deletedBy_user_id_fk": {
+ "name": "card_comments_deletedBy_user_id_fk",
+ "tableFrom": "card_comments",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "card_comments_publicId_unique": {
+ "name": "card_comments_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.card_checklist_item": {
+ "name": "card_checklist_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed": {
+ "name": "completed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "index": {
+ "name": "index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "checklistId": {
+ "name": "checklistId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_checklist_item_checklistId_card_checklist_id_fk": {
+ "name": "card_checklist_item_checklistId_card_checklist_id_fk",
+ "tableFrom": "card_checklist_item",
+ "tableTo": "card_checklist",
+ "columnsFrom": [
+ "checklistId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_checklist_item_createdBy_user_id_fk": {
+ "name": "card_checklist_item_createdBy_user_id_fk",
+ "tableFrom": "card_checklist_item",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_checklist_item_deletedBy_user_id_fk": {
+ "name": "card_checklist_item_deletedBy_user_id_fk",
+ "tableFrom": "card_checklist_item",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "card_checklist_item_publicId_unique": {
+ "name": "card_checklist_item_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.card_checklist": {
+ "name": "card_checklist",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "index": {
+ "name": "index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_checklist_cardId_card_id_fk": {
+ "name": "card_checklist_cardId_card_id_fk",
+ "tableFrom": "card_checklist",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "card_checklist_createdBy_user_id_fk": {
+ "name": "card_checklist_createdBy_user_id_fk",
+ "tableFrom": "card_checklist",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "card_checklist_deletedBy_user_id_fk": {
+ "name": "card_checklist_deletedBy_user_id_fk",
+ "tableFrom": "card_checklist",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "card_checklist_publicId_unique": {
+ "name": "card_checklist_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.feedback": {
+ "name": "feedback",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reviewed": {
+ "name": "reviewed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "feedback_createdBy_user_id_fk": {
+ "name": "feedback_createdBy_user_id_fk",
+ "tableFrom": "feedback",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.import": {
+ "name": "import",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "import_createdBy_user_id_fk": {
+ "name": "import_createdBy_user_id_fk",
+ "tableFrom": "import",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "import_publicId_unique": {
+ "name": "import_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "colourCode": {
+ "name": "colourCode",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boardId": {
+ "name": "boardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "importId": {
+ "name": "importId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_createdBy_user_id_fk": {
+ "name": "label_createdBy_user_id_fk",
+ "tableFrom": "label",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "label_boardId_board_id_fk": {
+ "name": "label_boardId_board_id_fk",
+ "tableFrom": "label",
+ "tableTo": "board",
+ "columnsFrom": [
+ "boardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "label_importId_import_id_fk": {
+ "name": "label_importId_import_id_fk",
+ "tableFrom": "label",
+ "tableTo": "import",
+ "columnsFrom": [
+ "importId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "label_deletedBy_user_id_fk": {
+ "name": "label_deletedBy_user_id_fk",
+ "tableFrom": "label",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_publicId_unique": {
+ "name": "label_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.list": {
+ "name": "list",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "index": {
+ "name": "index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boardId": {
+ "name": "boardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "importId": {
+ "name": "importId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "list_createdBy_user_id_fk": {
+ "name": "list_createdBy_user_id_fk",
+ "tableFrom": "list",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "list_deletedBy_user_id_fk": {
+ "name": "list_deletedBy_user_id_fk",
+ "tableFrom": "list",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "list_boardId_board_id_fk": {
+ "name": "list_boardId_board_id_fk",
+ "tableFrom": "list",
+ "tableTo": "board",
+ "columnsFrom": [
+ "boardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "list_importId_import_id_fk": {
+ "name": "list_importId_import_id_fk",
+ "tableFrom": "list",
+ "tableTo": "import",
+ "columnsFrom": [
+ "importId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "list_publicId_unique": {
+ "name": "list_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "uuid_generate_v4()"
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.integration": {
+ "name": "integration",
+ "schema": "",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accessToken": {
+ "name": "accessToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refreshToken": {
+ "name": "refreshToken",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integration_userId_user_id_fk": {
+ "name": "integration_userId_user_id_fk",
+ "tableFrom": "integration",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integration_pkey": {
+ "name": "integration_pkey",
+ "columns": [
+ "userId",
+ "provider"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_slug_checks": {
+ "name": "workspace_slug_checks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "available": {
+ "name": "available",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reserved": {
+ "name": "reserved",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_slug_checks_workspaceId_workspace_id_fk": {
+ "name": "workspace_slug_checks_workspaceId_workspace_id_fk",
+ "tableFrom": "workspace_slug_checks",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "workspace_slug_checks_createdBy_user_id_fk": {
+ "name": "workspace_slug_checks_createdBy_user_id_fk",
+ "tableFrom": "workspace_slug_checks",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_slugs": {
+ "name": "workspace_slugs",
+ "schema": "",
+ "columns": {
+ "slug": {
+ "name": "slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "slug_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slugs_slug_unique": {
+ "name": "workspace_slugs_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_members": {
+ "name": "workspace_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "role",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "roleId": {
+ "name": "roleId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "member_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invited'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_members_userId_user_id_fk": {
+ "name": "workspace_members_userId_user_id_fk",
+ "tableFrom": "workspace_members",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_members_workspaceId_workspace_id_fk": {
+ "name": "workspace_members_workspaceId_workspace_id_fk",
+ "tableFrom": "workspace_members",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_members_deletedBy_user_id_fk": {
+ "name": "workspace_members_deletedBy_user_id_fk",
+ "tableFrom": "workspace_members",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_members_roleId_workspace_roles_id_fk": {
+ "name": "workspace_members_roleId_workspace_roles_id_fk",
+ "tableFrom": "workspace_members",
+ "tableTo": "workspace_roles",
+ "columnsFrom": [
+ "roleId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_members_publicId_unique": {
+ "name": "workspace_members_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plan": {
+ "name": "plan",
+ "type": "workspace_plan",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'free'"
+ },
+ "showEmailsToMembers": {
+ "name": "showEmailsToMembers",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "weekStartDay": {
+ "name": "weekStartDay",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletedBy": {
+ "name": "deletedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_createdBy_user_id_fk": {
+ "name": "workspace_createdBy_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_deletedBy_user_id_fk": {
+ "name": "workspace_deletedBy_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": [
+ "deletedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_publicId_unique": {
+ "name": "workspace_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ },
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.subscription": {
+ "name": "subscription",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "plan": {
+ "name": "plan",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "referenceId": {
+ "name": "referenceId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripeSubscriptionId": {
+ "name": "stripeSubscriptionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "periodStart": {
+ "name": "periodStart",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "periodEnd": {
+ "name": "periodEnd",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelAtPeriodEnd": {
+ "name": "cancelAtPeriodEnd",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seats": {
+ "name": "seats",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unlimitedSeats": {
+ "name": "unlimitedSeats",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trialStart": {
+ "name": "trialStart",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trialEnd": {
+ "name": "trialEnd",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "subscription_referenceId_workspace_publicId_fk": {
+ "name": "subscription_referenceId_workspace_publicId_fk",
+ "tableFrom": "subscription",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "referenceId"
+ ],
+ "columnsTo": [
+ "publicId"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_invite_links": {
+ "name": "workspace_invite_links",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "invite_link_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedBy": {
+ "name": "updatedBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_invite_links_workspaceId_workspace_id_fk": {
+ "name": "workspace_invite_links_workspaceId_workspace_id_fk",
+ "tableFrom": "workspace_invite_links",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_invite_links_createdBy_user_id_fk": {
+ "name": "workspace_invite_links_createdBy_user_id_fk",
+ "tableFrom": "workspace_invite_links",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_invite_links_updatedBy_user_id_fk": {
+ "name": "workspace_invite_links_updatedBy_user_id_fk",
+ "tableFrom": "workspace_invite_links",
+ "tableTo": "user",
+ "columnsFrom": [
+ "updatedBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_invite_links_publicId_unique": {
+ "name": "workspace_invite_links_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ },
+ "workspace_invite_links_code_unique": {
+ "name": "workspace_invite_links_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_member_permissions": {
+ "name": "workspace_member_permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspaceMemberId": {
+ "name": "workspaceMemberId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted": {
+ "name": "granted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "unique_member_permission": {
+ "name": "unique_member_permission",
+ "columns": [
+ {
+ "expression": "workspaceMemberId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_member_idx": {
+ "name": "permission_member_idx",
+ "columns": [
+ {
+ "expression": "workspaceMemberId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_role_permissions": {
+ "name": "workspace_role_permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspaceRoleId": {
+ "name": "workspaceRoleId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted": {
+ "name": "granted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_role_permission": {
+ "name": "unique_role_permission",
+ "columns": [
+ {
+ "expression": "workspaceRoleId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "role_permissions_role_idx": {
+ "name": "role_permissions_role_idx",
+ "columns": [
+ {
+ "expression": "workspaceRoleId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_role_permissions_workspaceRoleId_workspace_roles_id_fk": {
+ "name": "workspace_role_permissions_workspaceRoleId_workspace_roles_id_fk",
+ "tableFrom": "workspace_role_permissions",
+ "tableTo": "workspace_roles",
+ "columnsFrom": [
+ "workspaceRoleId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_roles": {
+ "name": "workspace_roles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hierarchyLevel": {
+ "name": "hierarchyLevel",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "isSystem": {
+ "name": "isSystem",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "unique_role_per_workspace": {
+ "name": "unique_role_per_workspace",
+ "columns": [
+ {
+ "expression": "workspaceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_roles_workspace_idx": {
+ "name": "workspace_roles_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspaceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_roles_workspaceId_workspace_id_fk": {
+ "name": "workspace_roles_workspaceId_workspace_id_fk",
+ "tableFrom": "workspace_roles",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_roles_publicId_unique": {
+ "name": "workspace_roles_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "notification_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cardId": {
+ "name": "cardId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commentId": {
+ "name": "commentId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "readAt": {
+ "name": "readAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deletedAt": {
+ "name": "deletedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "notification_user_deleted_idx": {
+ "name": "notification_user_deleted_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deletedAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_read_deleted_idx": {
+ "name": "notification_user_read_deleted_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "readAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deletedAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_type_card_idx": {
+ "name": "notification_user_type_card_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cardId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_type_workspace_idx": {
+ "name": "notification_user_type_workspace_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspaceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_created_idx": {
+ "name": "notification_user_created_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "createdAt",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_userId_user_id_fk": {
+ "name": "notification_userId_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_cardId_card_id_fk": {
+ "name": "notification_cardId_card_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "card",
+ "columnsFrom": [
+ "cardId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_commentId_card_comments_id_fk": {
+ "name": "notification_commentId_card_comments_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "card_comments",
+ "columnsFrom": [
+ "commentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_workspaceId_workspace_id_fk": {
+ "name": "notification_workspaceId_workspace_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "notification_publicId_unique": {
+ "name": "notification_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ },
+ "public.workspace_webhooks": {
+ "name": "workspace_webhooks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicId": {
+ "name": "publicId",
+ "type": "varchar(12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspaceId": {
+ "name": "workspaceId",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "varchar(2048)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "events": {
+ "name": "events",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "createdBy": {
+ "name": "createdBy",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workspace_webhooks_workspace_idx": {
+ "name": "workspace_webhooks_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspaceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_webhooks_workspaceId_workspace_id_fk": {
+ "name": "workspace_webhooks_workspaceId_workspace_id_fk",
+ "tableFrom": "workspace_webhooks",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_webhooks_createdBy_user_id_fk": {
+ "name": "workspace_webhooks_createdBy_user_id_fk",
+ "tableFrom": "workspace_webhooks",
+ "tableTo": "user",
+ "columnsFrom": [
+ "createdBy"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_webhooks_publicId_unique": {
+ "name": "workspace_webhooks_publicId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "publicId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": true
+ }
+ },
+ "enums": {
+ "public.board_type": {
+ "name": "board_type",
+ "schema": "public",
+ "values": [
+ "regular",
+ "template"
+ ]
+ },
+ "public.board_visibility": {
+ "name": "board_visibility",
+ "schema": "public",
+ "values": [
+ "private",
+ "public"
+ ]
+ },
+ "public.card_activity_type": {
+ "name": "card_activity_type",
+ "schema": "public",
+ "values": [
+ "card.created",
+ "card.updated.title",
+ "card.updated.description",
+ "card.updated.index",
+ "card.updated.list",
+ "card.updated.label.added",
+ "card.updated.label.removed",
+ "card.updated.member.added",
+ "card.updated.member.removed",
+ "card.updated.comment.added",
+ "card.updated.comment.updated",
+ "card.updated.comment.deleted",
+ "card.updated.checklist.added",
+ "card.updated.checklist.renamed",
+ "card.updated.checklist.deleted",
+ "card.updated.checklist.item.added",
+ "card.updated.checklist.item.updated",
+ "card.updated.checklist.item.completed",
+ "card.updated.checklist.item.uncompleted",
+ "card.updated.checklist.item.deleted",
+ "card.updated.attachment.added",
+ "card.updated.attachment.removed",
+ "card.updated.dueDate.added",
+ "card.updated.dueDate.updated",
+ "card.updated.dueDate.removed",
+ "card.archived"
+ ]
+ },
+ "public.source": {
+ "name": "source",
+ "schema": "public",
+ "values": [
+ "trello",
+ "github"
+ ]
+ },
+ "public.status": {
+ "name": "status",
+ "schema": "public",
+ "values": [
+ "started",
+ "success",
+ "failed"
+ ]
+ },
+ "public.role": {
+ "name": "role",
+ "schema": "public",
+ "values": [
+ "admin",
+ "member",
+ "guest"
+ ]
+ },
+ "public.member_status": {
+ "name": "member_status",
+ "schema": "public",
+ "values": [
+ "invited",
+ "active",
+ "removed",
+ "paused"
+ ]
+ },
+ "public.slug_type": {
+ "name": "slug_type",
+ "schema": "public",
+ "values": [
+ "reserved",
+ "premium"
+ ]
+ },
+ "public.workspace_plan": {
+ "name": "workspace_plan",
+ "schema": "public",
+ "values": [
+ "free",
+ "team",
+ "pro",
+ "enterprise"
+ ]
+ },
+ "public.invite_link_status": {
+ "name": "invite_link_status",
+ "schema": "public",
+ "values": [
+ "active",
+ "inactive"
+ ]
+ },
+ "public.notification_type": {
+ "name": "notification_type",
+ "schema": "public",
+ "values": [
+ "mention",
+ "workspace.member.added",
+ "workspace.member.removed",
+ "workspace.role.changed"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json
index 88c394fef..f0687b5d0 100644
--- a/packages/db/migrations/meta/_journal.json
+++ b/packages/db/migrations/meta/_journal.json
@@ -225,6 +225,13 @@
"when": 1775170588247,
"tag": "20260402225628_AddTeamWorkspacePlan",
"breakpoints": true
+ },
+ {
+ "idx": 32,
+ "version": "7",
+ "when": 1776852884243,
+ "tag": "20260422101444_add-parent-id-to-card",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/repository/board.repo.ts b/packages/db/src/repository/board.repo.ts
index 11c165626..76237db40 100644
--- a/packages/db/src/repository/board.repo.ts
+++ b/packages/db/src/repository/board.repo.ts
@@ -257,6 +257,12 @@ export const getByPublicId = async (
dueDate: true,
},
with: {
+ parent: {
+ columns: {
+ publicId: true,
+ title: true,
+ },
+ },
labels: {
with: {
label: {
@@ -452,6 +458,12 @@ export const getBySlug = async (
dueDate: true,
},
with: {
+ parent: {
+ columns: {
+ publicId: true,
+ title: true,
+ },
+ },
labels: {
with: {
label: {
diff --git a/packages/db/src/repository/card.repo.ts b/packages/db/src/repository/card.repo.ts
index f20d5500c..b5f25f596 100644
--- a/packages/db/src/repository/card.repo.ts
+++ b/packages/db/src/repository/card.repo.ts
@@ -434,8 +434,32 @@ export const getWithListAndMembersByPublicId = async (
description: true,
dueDate: true,
createdBy: true,
+ parentId: true,
},
with: {
+ parent: {
+ columns: {
+ publicId: true,
+ title: true,
+ },
+ },
+ children: {
+ columns: {
+ publicId: true,
+ title: true,
+ index: true,
+ },
+ with: {
+ list: {
+ columns: {
+ publicId: true,
+ name: true,
+ },
+ },
+ },
+ where: isNull(cards.deletedAt),
+ orderBy: asc(cards.index),
+ },
labels: {
with: {
label: {
@@ -981,3 +1005,69 @@ export const getWorkspaceAndCardIdByCardPublicId = async (
}
: null;
};
+
+export const setParent = async (
+ db: dbClient,
+ args: { cardId: number; parentId: number | null },
+) => {
+ const [result] = await db
+ .update(cards)
+ .set({ parentId: args.parentId, updatedAt: new Date() })
+ .where(and(eq(cards.id, args.cardId), isNull(cards.deletedAt)))
+ .returning({
+ id: cards.id,
+ publicId: cards.publicId,
+ parentId: cards.parentId,
+ });
+
+ return result;
+};
+
+export const getChildren = async (
+ db: dbClient,
+ parentId: number,
+) => {
+ return db.query.cards.findMany({
+ columns: {
+ id: true,
+ publicId: true,
+ title: true,
+ index: true,
+ dueDate: true,
+ },
+ with: {
+ list: {
+ columns: {
+ publicId: true,
+ name: true,
+ },
+ },
+ },
+ where: and(eq(cards.parentId, parentId), isNull(cards.deletedAt)),
+ orderBy: asc(cards.index),
+ });
+};
+
+export const getEpicsByBoard = async (
+ db: dbClient,
+ boardId: number,
+) => {
+ // Epics = cards that have at least one child, scoped to a board
+ const result = await db.execute(sql`
+ SELECT DISTINCT p."publicId", p.title, p."dueDate", p.id,
+ l.name AS list_name,
+ (SELECT count(*) FROM card c2 WHERE c2."parentId" = p.id AND c2."deletedAt" IS NULL) AS total_children,
+ (SELECT count(*) FROM card c3
+ JOIN list l2 ON c3."listId" = l2.id
+ WHERE c3."parentId" = p.id AND c3."deletedAt" IS NULL
+ AND l2.name ILIKE '%done%') AS done_children
+ FROM card p
+ JOIN list l ON p."listId" = l.id
+ WHERE l."boardId" = ${boardId}
+ AND p."deletedAt" IS NULL
+ AND EXISTS (SELECT 1 FROM card c WHERE c."parentId" = p.id AND c."deletedAt" IS NULL)
+ ORDER BY p.title
+ `);
+
+ return result.rows;
+};
diff --git a/packages/db/src/schema/cards.ts b/packages/db/src/schema/cards.ts
index fb5719728..e8102a1d9 100644
--- a/packages/db/src/schema/cards.ts
+++ b/packages/db/src/schema/cards.ts
@@ -74,6 +74,10 @@ export const cards = pgTable("card", {
.references(() => lists.id, { onDelete: "cascade" }),
importId: bigint("importId", { mode: "number" }).references(() => imports.id),
dueDate: timestamp("dueDate"),
+ parentId: bigint("parentId", { mode: "number" }).references(
+ (): any => cards.id,
+ { onDelete: "set null" },
+ ),
}).enableRLS();
export const cardsRelations = relations(cards, ({ one, many }) => ({
@@ -92,6 +96,14 @@ export const cardsRelations = relations(cards, ({ one, many }) => ({
references: [users.id],
relationName: "cardsDeletedByUser",
}),
+ parent: one(cards, {
+ fields: [cards.parentId],
+ references: [cards.id],
+ relationName: "cardParentChild",
+ }),
+ children: many(cards, {
+ relationName: "cardParentChild",
+ }),
labels: many(cardsToLabels),
members: many(cardToWorkspaceMembers),
import: one(imports, {