⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
feat: personal workspaces, workspace settings and instance-wide SCIM (#478)
Croffa32ab660d457
diff --git a/apps/api/AGENTS.md b/apps/api/AGENTS.mdindex f7a9c5ab..4856c814 100644--- a/apps/api/AGENTS.md+++ b/apps/api/AGENTS.md@@ -119,9 +119,27 @@ Enforced declaratively through macros, never imperative calls in handlers.from the route once it expands the macro, so there is nothing else to read it from.- Guards/macros wrap the `shared/access.ts` primitives. Handlers that still need`user` (project create, invite accept/reject, self-removal) call `requireUser(user)`.-- **Only the owner of a workspace creates a team in it** (`POST /teams`, `createTeam` in- `teams/service.ts`). `workspaceId` in the body names the workspace; left out, it is the- instance workspace, which is the only one a self-hosted instance has. Anyone else gets 403.+- **The workspace decides who creates a team in it** (`POST /teams`, `createTeam` in+ `teams/service.ts`, `assertMayCreateTeam` in `workspaces/service.ts`): its owner by+ default, also its admins, or anyone in one of its teams, as its owner sets+ `teamCreation`. `workspaceId` in the body names the workspace; left out, it is the+ instance workspace, the one the instance owner owns. Anyone else gets 403.+- **Every person owns one workspace.** No route creates one: sign-up makes it+ (`@repo/auth`), and `authContext` makes it on the next request for an account that has+ none (`ensurePersonalWorkspace`), while `personalWorkspaces` is on in the auth settings.+ A build that lets a person own more mounts its own route on `createOwnWorkspace` and+ `workspaceCreation` (`workspaces/service.ts`, which refuse an agent's bot user) and+ raises the number with `setOwnedWorkspaceLimit` (`shared/limits.ts`). When an account is deleted (`deleteAccount`), a workspace it+ owned goes with it while it holds no project and no AI agent; any other passes to the+ instance owner with what the account owned alone in it (`releaseOwnedWorkspaces` in+ `teams/service.ts`). God mode asks about sole-owned projects only outside the account's+ own workspaces. The owner deletes a workspace under the same rule+ (`DELETE /workspaces/:id`, `workspaceDeletion` in `workspaces/service.ts`); the instance+ workspace never goes. No core route hands a workspace over; `transferWorkspace` is+ there for a build that offers it. SCIM provisioning creates and attaches accounts across the+ instance, so its routes (`workspaceScim` guard) are the instance owner's alone; a hosted+ build sets SCIM up per workspace with `setWorkspaceScim()` from `@repo/auth`, which lets+ every workspace owner (see SCIM below).- **A member of the team joins a project directly** (`POST /projects/:key/members`,from the candidate list); anyone else joins through an invite, which puts them inthe team as well. A team invite (`/teams/:teamId/invites`) names no project. One@@ -210,29 +228,42 @@ advertises exactly that. A create inserts the `user` row directly, the way `creadoes, which deliberately skips the registration gate — with SCIM on, the identity providerbrings people in, and that is what makes `registration: 'closed'` plus SSO work.-An account is one `user` row across the instance, and a workspace's provider decides who is-in the workspace, not who has an account. What it says about a person — its own id for them-and whether they are active — is a `scim_user` row per (workspace, user), so the same person-can be linked by several workspaces. The provider sees the accounts it linked and the people-in the workspace's teams (`inWorkspace` in `service.ts`). A create for an address that has an-account links it; a name or address sent on a create, PUT or PATCH is accepted and the-account keeps its own. Groups belong to a workspace (`scim_group.workspace_id`), their names-are unique within it, and their members must be accounts it sees. The group mappings and the-settings are routes of `modules/workspaces/`, open to the workspace owner only.+An account is one `user` row across the instance. What a provider says about a person — its+own id for them and whether they are active — is a `scim_user` row per (workspace, user).+Groups belong to a workspace (`scim_group.workspace_id`), their names are unique within it,+and their members must be accounts it sees. A create for an address that has an account+links it. The group mappings and the settings are routes of `modules/workspaces/` (see the+`workspaceScim` guard above). How far a provider reaches is `workspaceScim()` from+`@repo/auth`:++- **Off, as on a self-hosted instance, SCIM is the instance's.** God mode sets it up for the+ instance workspace, and only that workspace's token opens `/scim/v2`. The provider sees+ every account, PUT and PATCH write the name and address, a group maps to any project, and+ DELETE removes the account the way god mode does (409 for the only owner of a project+ outside the workspaces they own, whose projects pass to the instance owner).+ A deactivated account (`user.active` false, written alongside `scim_user.active`) keeps+ its teams and projects but cannot sign in, and `isAccountDeactivated` makes+ `authContext`, `/me` and the MCP key check refuse what it already holds.+- **On, as in a hosted build, SCIM is each workspace's.** A workspace's provider decides who+ is in the workspace, not who has an account, so the same person can be linked by several+ workspaces. It sees the accounts it linked and the people in the workspace's teams+ (`inWorkspace` in `service.ts`), a name or address it sends is accepted and the account+ keeps its own, and a group maps to projects of its workspace only.A create first asks the installed policy whether the workspace may provision the address-(`email-policy.ts`). A self-hosted instance has one workspace and allows any address; a-hosted build calls `setScimEmailPolicy` with a check against the domains the workspace has+(`email-policy.ts`). A self-hosted instance allows any address, since only its owner sets+up provisioning; a hosted build calls `setScimEmailPolicy` with a check against the domains the workspace hasverified, and a refused address answers 400 `invalidValue`.-Deactivation (`active: false`) and DELETE take the person out of every team of the-workspace through `dropWorkspaceMemberships` in `teams/service.ts`, invite memberships+Set up per workspace, deactivation (`active: false`) and DELETE take the person out of every+team of the workspace through `dropWorkspaceMemberships` in `teams/service.ts`, invite membershipsincluded, and a team or project they owned alone passes to the workspace owner. Neithertouches the account or its sessions. A deactivated person stays linked, so the provider canturn them back on, and `reconcile.ts` grants them nothing through the groups until then.-The `god`-role account and the workspace owner are refused (409): the first because nothing-about the instance owner is provider-owned, the second because the owner is who receives-what a deprovisioned person owned alone. A create for an address the provider already linked++The `god`-role account is refused (409), because nothing about the instance owner is+provider-owned; set up per workspace, so is the workspace owner, who receives what a+deprovisioned person owned alone. A create for an address the provider already linkedwith an `externalId` is refused the same way — it is a retry, not a new person, and must notoverwrite the link the first create wrote.diff --git a/apps/api/src/app.ts b/apps/api/src/app.tsindex d07f29c6..3b8cddaf 100644--- a/apps/api/src/app.ts+++ b/apps/api/src/app.ts@@ -8,6 +8,7 @@ import {hasConfiguredGoogle,hasConfiguredOidc,getOidcLabel,+ isAccountDeactivated,} from '@repo/auth';import { db, hasConfiguredEmailProvider, user } from '@repo/db';import { cors } from '@elysiajs/cors';@@ -248,7 +249,12 @@ export const app = new Elysia()'/me',async ({ request }) => {const session = await getSessionFromHeaders(request.headers);- if (!session) return { authenticated: false };+ // A deactivated account is not signed in as far as the app is concerned:+ // every planner route answers 401 for it, and this is what the screens ask+ // first. Deactivation arrives over SCIM, after the session was opened.+ if (!session || isAccountDeactivated(session.user)) {+ return { authenticated: false };+ }return { authenticated: true, user: session.user };},{@@ -257,7 +263,8 @@ export const app = new Elysia()summary: 'Get the current session user',description:'Resolve the request credentials to a session and return the user it belongs to. ' +- 'Without a session it answers `{ authenticated: false }` instead of failing.',+ 'Without a session, or for a deactivated account, it answers ' ++ '`{ authenticated: false }` instead of failing.',},},)diff --git a/apps/api/src/mcp/__tests__/integration/mcp-auth.test.ts b/apps/api/src/mcp/__tests__/integration/mcp-auth.test.tsindex c131d043..bff0c33d 100644--- a/apps/api/src/mcp/__tests__/integration/mcp-auth.test.ts+++ b/apps/api/src/mcp/__tests__/integration/mcp-auth.test.ts@@ -3,6 +3,7 @@ import { auth } from '@repo/auth';import { app } from '#tests/helpers/app';import { resetDb } from '#tests/helpers/db';import { signUpTestUser } from '#tests/helpers/auth';+import { patchOps, setupScim } from '#modules/scim/__tests__/helpers';// The MCP endpoint resolves the API key itself instead of going through// authContext, so the rules that gate a planner route have to hold here too.@@ -45,12 +46,19 @@ describe('MCP authentication', () => {expect(res.status).toBe(401);});- it('accepts a key of the account', async () => {+ it('refuses a key whose account was deactivated over SCIM', async () => {+ const { scim } = await setupScim();const member = await signUpTestUser({ email: '[email protected]' });const created = await auth.api.createApiKey({body: { userId: member.userId, name: 'mcp' },});expect((await initialize(created.key)).status).not.toBe(401);++ await scim.scim.v2+ .Users({ id: member.userId })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ expect((await initialize(created.key)).status).toBe(401);});});diff --git a/apps/api/src/mcp/mount.ts b/apps/api/src/mcp/mount.tsindex 36568800..88f005de 100644--- a/apps/api/src/mcp/mount.ts+++ b/apps/api/src/mcp/mount.ts@@ -1,6 +1,6 @@import { t } from 'elysia';import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';-import { auth, withMcpAuth } from '@repo/auth';+import { auth, isAccountDeactivated, withMcpAuth } from '@repo/auth';import { buildMcpServer } from './server';import type { McpApp } from './types';import type { McpCredential } from './credential';@@ -46,7 +46,11 @@ export function mountMcp(app: any): void {headers.set('x-api-key', apiKey);try {const session = await auth.api.getSession({ headers });- if (session) return serve({ kind: 'api-key', apiKey }, session.user.id);+ // A deactivated account is refused here too, the way shared/auth-context.ts+ // refuses it for every planner route. Deactivation arrives over SCIM, after+ // the key was issued.+ if (session && !isAccountDeactivated(session.user))+ return serve({ kind: 'api-key', apiKey }, session.user.id);} catch {// Not an API key: let the native OAuth handler validate the bearer token.}diff --git a/apps/api/src/modules/god/__tests__/integration/god-users.test.ts b/apps/api/src/modules/god/__tests__/integration/god-users.test.tsindex af098258..1f789dbc 100644--- a/apps/api/src/modules/god/__tests__/integration/god-users.test.ts+++ b/apps/api/src/modules/god/__tests__/integration/god-users.test.ts@@ -447,6 +447,25 @@ describe('god users', () => {expect((await god.api.god.users({ userId: bob.id }).get()).data?.projects).toHaveLength(1);});+ it('hands a project in their own workspace to the instance owner without asking', async () => {+ const { god } = await setup();+ const alice = await addUser({ email: '[email protected]' });+ const [own] = (await alice.api.workspaces.get()).data!;+ const team = await alice.api.teams.post({ name: 'Solo', slug: 'solo', workspaceId: own!.id });+ await alice.api.teams({ teamId: team.data!.id }).projects.post({ key: 'SOL', name: 'Solo' });++ const detail = await god.api.god.users({ userId: alice.id }).get();+ expect(detail.data?.projects[0]).toMatchObject({ ownerCount: 1, inOwnWorkspace: true });++ const res = await god.api.god.users({ userId: alice.id }).delete();++ expect(res.status).toBe(204);+ const kept = await god.api.god.users({ userId: god.id }).get();+ expect(kept.data?.projects).toEqual([+ expect.objectContaining({ projectKey: 'SOL', role: 'owner' }),+ ]);+ });+it('deletes the sole-owned projects with the account when asked', async () => {const { god } = await setup();const alice = await addUser({ email: '[email protected]' });diff --git a/apps/api/src/modules/god/index.ts b/apps/api/src/modules/god/index.tsindex 60884178..0c0463e9 100644--- a/apps/api/src/modules/god/index.ts+++ b/apps/api/src/modules/god/index.ts@@ -476,11 +476,14 @@ export const godRoutes = new Elysia({ name: 'god', detail: { tags: ['God'] } })if (target.isAgent) {throw new HttpError(400, 'Delete the AI agent from its project instead');}- // Projects this user owns alone. Their membership goes with the account, so- // the project would be left with nobody who can manage it (god mode does not- // bypass project membership). Either the caller takes those projects down- // with the account, or the request is refused until another owner is added.- const sole = target.projects.filter((p) => p.role === 'owner' && p.ownerCount === 1);+ // Projects this user owns alone outside the workspaces they own. Their membership+ // goes with the account, so the project would be left with nobody who can manage+ // it (god mode does not bypass project membership). Either the caller takes those+ // projects down with the account, or the request is refused until another owner is+ // added. The ones in their own workspaces pass to the instance owner with it.+ const sole = target.projects.filter(+ (p) => p.role === 'owner' && p.ownerCount === 1 && !p.inOwnWorkspace,+ );if (sole.length > 0 && !query.withProjects) {throw new HttpError(400,@@ -500,7 +503,7 @@ export const godRoutes = new Elysia({ name: 'god', detail: { tags: ['God'] } })detail: {summary: 'Delete a user',description:- 'Remove an account from the instance, with its sessions, memberships and preferences. Optionally deletes the projects it owns alone.',+ 'Remove an account from the instance, with its sessions, memberships and preferences. Optionally deletes the projects it owns alone; a workspace it owns goes with it while it holds no project or AI agent, and passes to the instance owner otherwise.',},},)diff --git a/apps/api/src/modules/god/model.ts b/apps/api/src/modules/god/model.tsindex 9d1ddbd3..d84a98ac 100644--- a/apps/api/src/modules/god/model.ts+++ b/apps/api/src/modules/god/model.ts@@ -37,6 +37,7 @@ export const AuthSettingsResponse = t.Object({magicLink: t.Boolean(),emailPassword: t.Boolean(),trustProviderEmails: t.Boolean(),+ personalWorkspaces: t.Boolean(),// The settings that depend on outbound email cannot be turned on without a mail// provider, and the UI explains why.hasEmailProvider: t.Boolean(),@@ -46,11 +47,14 @@ export const AuthSettingsResponse = t.Object({});export const AuthSettingsBody = t.Object({- registration: t.Optional(t.UnionEnum([...REGISTRATION_MODES])),+ // t.UnionEnum defaults to its first value, which would fill in the mode for a request+ // that leaves it out and so reset it; the update is partial.+ registration: t.Optional(t.UnionEnum([...REGISTRATION_MODES], { default: undefined })),requireEmailVerification: t.Optional(t.Boolean()),magicLink: t.Optional(t.Boolean()),emailPassword: t.Optional(t.Boolean()),trustProviderEmails: t.Optional(t.Boolean()),+ personalWorkspaces: t.Optional(t.Boolean()),});export const EmailSettingsResponse = t.Object({@@ -174,6 +178,7 @@ export const InstanceUserDetailResponse = t.Composite([roleName: t.Nullable(t.String()),permissions: PermissionMatrixSchema,ownerCount: t.Number(),+ inOwnWorkspace: t.Boolean(),joinedAt: t.String(),}),),diff --git a/apps/api/src/modules/god/service.ts b/apps/api/src/modules/god/service.tsindex 58a9f9f9..750d76f0 100644--- a/apps/api/src/modules/god/service.ts+++ b/apps/api/src/modules/god/service.ts@@ -16,6 +16,7 @@ import {teamMember,teamRole,projectView,+ workspaceManager,} from '@repo/db';import {and,@@ -79,8 +80,12 @@ export interface InstanceUserProject {// member, the default member matrix when no role is assigned.permissions: Permissions;// How many owners the project has. 1 on a project this user owns means deleting- // the account would leave the project with nobody who can manage it.+ // the account would leave the project with nobody who can manage it, unless it is in a+ // workspace of theirs.ownerCount: number;+ // Whether the project's team is in a workspace this user owns. That workspace passes to+ // the instance owner with the account, and with it what the user owned alone there.+ inOwnWorkspace: boolean;joinedAt: string;}@@ -231,13 +236,14 @@ export async function getInstanceUser(userId: string): Promise<InstanceUserDetaiconst row = rows[0];if (!row) return null;- const [facts, memberships] = await Promise.all([+ const [facts, memberships, ownedWorkspaces] = await Promise.all([loadUserFacts([row.id]),db.select({projectId: project.id,projectKey: project.key,projectName: project.name,+ workspaceId: team.workspaceId,role: projectMember.role,roleId: projectMember.roleId,roleName: teamRole.name,@@ -246,10 +252,16 @@ export async function getInstanceUser(userId: string): Promise<InstanceUserDetai}).from(projectMember).innerJoin(project, eq(project.id, projectMember.projectId))+ .innerJoin(team, eq(team.id, project.teamId)).leftJoin(teamRole, eq(teamRole.id, projectMember.roleId)).where(eq(projectMember.userId, userId)).orderBy(project.name),+ db+ .select({ id: workspaceManager.workspaceId })+ .from(workspaceManager)+ .where(and(eq(workspaceManager.userId, userId), eq(workspaceManager.role, 'owner'))),]);+ const owned = new Set(ownedWorkspaces.map((w) => w.id));const ownerCounts = await countOwnersByProject(memberships.map((m) => m.projectId));@@ -263,6 +275,7 @@ export async function getInstanceUser(userId: string): Promise<InstanceUserDetairoleId: m.roleId,roleName: m.roleName,ownerCount: ownerCounts.get(m.projectId) ?? 0,+ inOwnWorkspace: owned.has(m.workspaceId),permissions: resolvePermissions(role, m.permissions),joinedAt: iso(m.joinedAt),};diff --git a/apps/api/src/modules/notifications/outbound.ts b/apps/api/src/modules/notifications/outbound.tsindex 94add236..4d37df9a 100644--- a/apps/api/src/modules/notifications/outbound.ts+++ b/apps/api/src/modules/notifications/outbound.ts@@ -11,6 +11,7 @@ import {type DeliveryPayload,} from '@repo/db';import { eq, inArray } from 'drizzle-orm';+import { isAccountDeactivated } from '@repo/auth';import { readRedactedSettings } from '#modules/notification-settings/service';import { getPreferencesForUsers } from '#modules/notification-preferences/service';import { getTelegramChatIds, hasUsableInstanceBot } from '#modules/telegram/service';@@ -181,27 +182,31 @@ export async function enqueueOutbound(const userIds = [...new Set(notifications.map((n) => n.userId))];const [users, prefsByUser, chatIdByUser] = await Promise.all([- db.select({ id: user.id, email: user.email }).from(user).where(inArray(user.id, userIds)),+ db+ .select({ id: user.id, email: user.email, active: user.active })+ .from(user)+ .where(inArray(user.id, userIds)),getPreferencesForUsers(projectId, userIds),telegramEnabled ? getTelegramChatIds(userIds) : Promise.resolve(new Map<string, string>()),]);- const emailById = new Map(users.map((u) => [u.id, u.email]));+ // A deactivated account keeps its projects, but nothing from them reaches it.+ const emailById = new Map(+ users.filter((u) => !isAccountDeactivated(u)).map((u) => [u.id, u.email]),+ );const out: OutboxRow[] = [];for (const n of notifications) {const prefs = prefsByUser.get(n.userId);- if (!prefs) continue; // member has not opted in+ const email = emailById.get(n.userId);+ if (!prefs || !email) continue; // not opted in, or deactivatedif (emailEnabled && prefs.emailEvents[n.type]) {- const email = emailById.get(n.userId);- if (email) {- out.push({- projectId,- channel: 'email',- recipient: email,- payload: emailPayload(n.type, ref, issueRow.title, actor, url, stateChange),- });- }+ out.push({+ projectId,+ channel: 'email',+ recipient: email,+ payload: emailPayload(n.type, ref, issueRow.title, actor, url, stateChange),+ });}if (telegramEnabled && prefs.telegramEvents[n.type]) {// No linked Telegram account means nowhere to send; the member sees the promptdiff --git a/apps/api/src/modules/scim/__tests__/helpers.ts b/apps/api/src/modules/scim/__tests__/helpers.tsindex 65bce9d8..58ed6a05 100644--- a/apps/api/src/modules/scim/__tests__/helpers.ts+++ b/apps/api/src/modules/scim/__tests__/helpers.ts@@ -1,5 +1,6 @@import { eq } from 'drizzle-orm';-import { db, team, workspace, workspaceManager } from '@repo/db';+import { rotateScimToken, setScimSettings } from '@repo/auth';+import { createWorkspace, db, team } from '@repo/db';import { scimApi } from '#tests/helpers/app';import { addUser, type Actor } from '#modules/god/__tests__/helpers';@@ -30,25 +31,24 @@ export async function setupScim(): Promise<ScimSetup> {return { god, workspaceId, settings, token, scim: scimApi(token) };}-// A second workspace owned by `owner`, with provisioning on, holding `teamIds`. The-// api cannot create a workspace, so it is written directly.+// A second workspace owned by `owner`, with provisioning on, holding `teamIds`. Its+// provisioning is set up directly, since through the api only the instance owner may.export async function setupOtherWorkspace(owner: Actor,teamIds: number[] = [],): Promise<Omit<ScimSetup, 'god'>> {- const [created] = await db- .insert(workspace)- .values({ name: 'Other' })- .returning({ id: workspace.id });- const workspaceId = created!.id;- await db.insert(workspaceManager).values({ workspaceId, userId: owner.id, role: 'owner' });+ const workspaceId = await createWorkspace(db, 'Other', owner.id);for (const teamId of teamIds) {await db.update(team).set({ workspaceId }).where(eq(team.id, teamId));}- const settings = workspaceScim(owner, workspaceId);- const token = (await settings.token.post()).data!.token;- await settings.patch({ enabled: true });- return { workspaceId, settings, token, scim: scimApi(token) };+ const token = await rotateScimToken(workspaceId);+ await setScimSettings(workspaceId, { enabled: true });+ return {+ workspaceId,+ settings: workspaceScim(owner, workspaceId),+ token,+ scim: scimApi(token),+ };}// `emails` follows `userName` by default, so overriding just `userName` in a testdiff --git a/apps/api/src/modules/scim/__tests__/integration/scim-groups.test.ts b/apps/api/src/modules/scim/__tests__/integration/scim-groups.test.tsindex 3facc4ed..de39ec84 100644--- a/apps/api/src/modules/scim/__tests__/integration/scim-groups.test.ts+++ b/apps/api/src/modules/scim/__tests__/integration/scim-groups.test.ts@@ -1,4 +1,7 @@-import { describe, expect, it, beforeEach } from 'bun:test';+import { afterEach, describe, expect, it, beforeEach } from 'bun:test';+import { eq } from 'drizzle-orm';+import { setWorkspaceScim } from '@repo/auth';+import { createWorkspace, db, team } from '@repo/db';import { resetDb } from '#tests/helpers/db';import { addUser } from '#modules/god/__tests__/helpers';import { patchOps, scimUserBody, setupOtherWorkspace, setupScim } from '../helpers';@@ -232,7 +235,28 @@ describe('SCIM groups', () => {});});- describe('workspaces', () => {+ describe('the instance', () => {+ it('takes a member in any workspace', async () => {+ const { scim } = await setupScim();+ const outsider = await addUser({ email: '[email protected]' });+ const [outsiderTeam] = (await outsider.api.teams.get()).data!;+ await db+ .update(team)+ .set({ workspaceId: await createWorkspace(db, 'Other', outsider.id) })+ .where(eq(team.id, outsiderTeam!.id));++ const res = await scim.scim.v2.Groups.post(groupBody({ members: [{ value: outsider.id }] }));++ expect(res.status).toBe(201);+ });+ });++ // Set up per workspace, as in a hosted build, each workspace's provider has groups of+ // its own and sees only its own people.+ describe('set up per workspace', () => {+ beforeEach(() => setWorkspaceScim());+ afterEach(() => setWorkspaceScim(false));+it("keeps one workspace's groups away from another's provider", async () => {const { god, scim } = await setupScim();const other = await setupOtherWorkspace(god);diff --git a/apps/api/src/modules/scim/__tests__/integration/scim-reconcile.test.ts b/apps/api/src/modules/scim/__tests__/integration/scim-reconcile.test.tsindex 68691353..89d84724 100644--- a/apps/api/src/modules/scim/__tests__/integration/scim-reconcile.test.ts+++ b/apps/api/src/modules/scim/__tests__/integration/scim-reconcile.test.ts@@ -1,4 +1,7 @@import { describe, expect, it, afterEach, beforeEach } from 'bun:test';+import { eq } from 'drizzle-orm';+import { setWorkspaceScim } from '@repo/auth';+import { createWorkspace, db, team } from '@repo/db';import { resetDb } from '#tests/helpers/db';import { addUser, joinProject, type Actor } from '#modules/god/__tests__/helpers';import { createRole, teamIdOf } from '#tests/helpers/roles';@@ -111,30 +114,6 @@ describe('SCIM group reconciliation', () => {expect(members.map((m) => m.userId)).not.toContain(ada.data!.id);});- it('grants a deactivated member nothing, and grants it again once they are back', async () => {- const setup = await setupScim();- const project = await createProject(setup.god, 'Marketing', 'MKT');- const ada = await setup.scim.scim.v2.Users.post(scimUserBody());- const groupId = await provisionGroup(setup, 'Engineering', [ada.data!.id]);- await setup.settings.groups({ groupId }).mappings.put({- mappings: [{ projectId: project.id, role: 'member', roleId: null }],- });- const setActive = (value: boolean) =>- setup.scim.scim.v2- .Users({ id: ada.data!.id })- .patch(patchOps([{ op: 'replace', path: 'active', value }]));-- await setActive(false);- // A group change reconciles the project again; the deactivated member stays out.- await setup.scim.scim.v2- .Groups({ id: groupId })- .patch(patchOps([{ op: 'replace', path: 'displayName', value: 'Engineers' }]));- expect((await membersOf(setup.god, 'MKT')).map((m) => m.userId)).not.toContain(ada.data!.id);-- await setActive(true);- expect((await membersOf(setup.god, 'MKT')).map((m) => m.userId)).toContain(ada.data!.id);- });-it('grants the team membership the project one stands on, and takes it back', async () => {const setup = await setupScim();const project = await createProject(setup.god, 'Marketing', 'MKT');@@ -421,6 +400,77 @@ describe('SCIM group reconciliation', () => {expect((await scim.groups.get()).status).toBe(403);expect((await scim.groups({ groupId }).mappings.put({ mappings: [] })).status).toBe(403);});+ });++ it('leaves a deactivated member what the groups granted', async () => {+ const setup = await setupScim();+ const project = await createProject(setup.god, 'Marketing', 'MKT');+ const ada = await setup.scim.scim.v2.Users.post(scimUserBody());+ const groupId = await provisionGroup(setup, 'Engineering', [ada.data!.id]);+ await setup.settings.groups({ groupId }).mappings.put({+ mappings: [{ projectId: project.id, role: 'member', roleId: null }],+ });++ await setup.scim.scim.v2+ .Users({ id: ada.data!.id })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));+ await setup.scim.scim.v2+ .Groups({ id: groupId })+ .patch(patchOps([{ op: 'replace', path: 'displayName', value: 'Engineers' }]));++ expect((await membersOf(setup.god, 'MKT')).map((m) => m.userId)).toContain(ada.data!.id);+ });++ it('maps a project of any workspace', async () => {+ const setup = await setupScim();+ const outsider = await addUser({ email: '[email protected]' });+ const project = await createProject(outsider, 'Sales', 'SAL');+ await db+ .update(team)+ .set({ workspaceId: await createWorkspace(db, 'Other', outsider.id) })+ .where(eq(team.id, project.teamId));+ const groupId = await provisionGroup(setup, 'Engineering', []);++ const res = await setup.settings.groups({ groupId }).mappings.put({+ mappings: [{ projectId: project.id, role: 'member', roleId: null }],+ });++ expect(res.status).toBe(200);+ const options = (+ await setup.god.api.workspaces({ workspaceId: setup.workspaceId }).projects.options.get()+ ).data!;+ expect(options.map((o) => o.key)).toContain('SAL');+ });++ // Set up per workspace, as in a hosted build, a group grants projects of its own+ // workspace only, and nothing to a person its provider deactivated.+ describe('set up per workspace', () => {+ beforeEach(() => setWorkspaceScim());+ afterEach(() => setWorkspaceScim(false));++ it('grants a deactivated member nothing, and grants it again once they are back', async () => {+ const setup = await setupScim();+ const project = await createProject(setup.god, 'Marketing', 'MKT');+ const ada = await setup.scim.scim.v2.Users.post(scimUserBody());+ const groupId = await provisionGroup(setup, 'Engineering', [ada.data!.id]);+ await setup.settings.groups({ groupId }).mappings.put({+ mappings: [{ projectId: project.id, role: 'member', roleId: null }],+ });+ const setActive = (value: boolean) =>+ setup.scim.scim.v2+ .Users({ id: ada.data!.id })+ .patch(patchOps([{ op: 'replace', path: 'active', value }]));++ await setActive(false);+ // A group change reconciles the project again; the deactivated member stays out.+ await setup.scim.scim.v2+ .Groups({ id: groupId })+ .patch(patchOps([{ op: 'replace', path: 'displayName', value: 'Engineers' }]));+ expect((await membersOf(setup.god, 'MKT')).map((m) => m.userId)).not.toContain(ada.data!.id);++ await setActive(true);+ expect((await membersOf(setup.god, 'MKT')).map((m) => m.userId)).toContain(ada.data!.id);+ });it('refuses a project of another workspace', async () => {const setup = await setupScim();diff --git a/apps/api/src/modules/scim/__tests__/integration/scim-users.test.ts b/apps/api/src/modules/scim/__tests__/integration/scim-users.test.tsindex fa7c6eaf..753be08d 100644--- a/apps/api/src/modules/scim/__tests__/integration/scim-users.test.ts+++ b/apps/api/src/modules/scim/__tests__/integration/scim-users.test.ts@@ -1,7 +1,8 @@import { afterEach, describe, expect, it, beforeEach } from 'bun:test';-import { db, teamMember } from '@repo/db';+import { setWorkspaceScim } from '@repo/auth';+import { createWorkspace, db, notificationDelivery, team, teamMember } from '@repo/db';import { eq } from 'drizzle-orm';-import { app } from '#tests/helpers/app';+import { app, authedApi } from '#tests/helpers/app';import { resetDb } from '#tests/helpers/db';import { signUpTestUser } from '#tests/helpers/auth';import { addUser, createAgentUser, joinProject, type Actor } from '#modules/god/__tests__/helpers';@@ -306,7 +307,7 @@ describe('SCIM users', () => {});describe('PUT /scim/v2/Users/:id', () => {- it("writes the provider's id and keeps the name and address the account holds", async () => {+ it('replaces the account', async () => {const { scim } = await setupScim();const created = await scim.scim.v2.Users.post(scimUserBody({ externalId: 'idp-1' }));@@ -314,18 +315,29 @@ describe('SCIM users', () => {scimUserBody({userName: '[email protected]',name: { givenName: 'Ada', familyName: 'Byron' },- externalId: 'idp-2',+ externalId: 'idp-1',}),);expect(res.status).toBe(200);expect(res.data).toMatchObject({- userName: '[email protected]',- displayName: 'Ada Lovelace',- externalId: 'idp-2',+ userName: '[email protected]',+ displayName: 'Ada Byron',});});+ it('refuses an address another account already has', async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody());+ await scim.scim.v2.Users.post(scimUserBody({ userName: '[email protected]' }));++ const res = await scim.scim.v2+ .Users({ id: created.data!.id })+ .put(scimUserBody({ userName: '[email protected]' }));++ expect(res.status).toBe(409);+ });+it('refuses the instance owner', async () => {const { god, scim } = await setupScim();@@ -339,107 +351,165 @@ describe('SCIM users', () => {});describe('PATCH /scim/v2/Users/:id', () => {- it('takes a deactivated person out of the workspace and leaves the account', async () => {- const { god, scim } = await setupScim();- const member = await addUser({ email: '[email protected]' });- await god.api.projects.post({ name: 'Marketing', key: 'MKT' });- await joinProject(god, member, 'MKT', 'member');+ it('deactivates an account and cuts off its open session', async () => {+ const { scim } = await setupScim();+ const member = await signUpTestUser({ email: '[email protected]' });+ const session = authedApi(member.cookie);+ expect((await session.projects.get()).status).toBe(200);const res = await scim.scim.v2- .Users({ id: member.id })+ .Users({ id: member.userId }).patch(patchOps([{ op: 'replace', path: 'active', value: false }]));expect(res.status).toBe(200);expect(res.data).toMatchObject({ active: false });- expect(await memberIdsOf(god, 'MKT')).not.toContain(member.id);- expect(await teamsOf(member)).toHaveLength(0);- expect((await member.api.me.get()).data).toMatchObject({ authenticated: true });- const signIn = await app.handle(+ expect((await session.projects.get()).status).toBe(401);+ expect((await session.me.get()).data).toMatchObject({ authenticated: false });+ });++ it('lets a reactivated account back in', async () => {+ const { scim } = await setupScim();+ const member = await signUpTestUser({ email: '[email protected]' });+ const session = authedApi(member.cookie);+ await scim.scim.v2+ .Users({ id: member.userId })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ await scim.scim.v2+ .Users({ id: member.userId })+ .patch(patchOps([{ op: 'replace', path: 'active', value: true }]));++ expect((await session.projects.get()).status).toBe(200);+ expect((await session.me.get()).data).toMatchObject({ authenticated: true });+ });++ it('refuses a deactivated account a new sign-in', async () => {+ const { scim } = await setupScim();+ const member = await signUpTestUser({ email: '[email protected]' });+ await scim.scim.v2+ .Users({ id: member.userId })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ const res = await app.handle(new Request('http://localhost/api/auth/sign-in/email', {method: 'POST',headers: { 'content-type': 'application/json' },body: JSON.stringify({ email: member.email, password: 'test-password-123' }),}),);- expect(signIn.status).toBe(200);++ expect(res.status).toBe(403);});- it('still lists a deactivated person, so the provider can turn them back on', async () => {- const { scim } = await setupScim();+ it('leaves a deactivated account its teams and projects', async () => {+ const { god, scim } = await setupScim();const member = await addUser({ email: '[email protected]' });+ await god.api.projects.post({ name: 'Marketing', key: 'MKT' });+ await joinProject(god, member, 'MKT', 'member');+await scim.scim.v2.Users({ id: member.id }).patch(patchOps([{ op: 'replace', path: 'active', value: false }]));- const res = await scim.scim.v2.Users({ id: member.id }).get();-- expect(res.status).toBe(200);- expect(res.data).toMatchObject({ active: false });+ expect(await memberIdsOf(god, 'MKT')).toContain(member.id);});- it('passes a team and a project the person owned alone to the workspace owner', async () => {+ it('sends a deactivated account no notifications', async () => {const { god, scim } = await setupScim();const member = await addUser({ email: '[email protected]' });- const [ownTeam] = await teamsOf(member);- await member.api.projects.post({ name: 'Solo', key: 'SOL' });+ const project = (await god.api.projects.post({ name: 'Marketing', key: 'MKT' })).data!;+ await joinProject(god, member, 'MKT', 'member');+ await god.api.teams({ teamId: project.teamId })['notification-settings'].put({+ smtp: {+ enabled: true,+ host: 'smtp.example.com',+ port: 587,+ encryption: 'none',+ username: '[email protected]',+ password: 'secret',+ timeout: null,+ },+ });+ const events = { assigned: true, mentioned: true, commented: true, state_changed: true };+ await member.api.projects({ projectKey: 'MKT' })['notification-preferences'].put({+ emailEvents: events,+ telegramEvents: events,+ });+ const columnId = (await god.api.projects({ projectKey: 'MKT' }).get()).data!.columns[0]!.id;+ const assign = () =>+ god.api+ .projects({ projectKey: 'MKT' })+ .issues.post({ columnId, title: 'Task', assigneeUserId: member.id });+ await assign();+ expect(await db.$count(notificationDelivery)).toBe(1);await scim.scim.v2.Users({ id: member.id }).patch(patchOps([{ op: 'replace', path: 'active', value: false }]));+ await assign();- const godTeams = await teamsOf(god);- expect(godTeams).toContainEqual(expect.objectContaining({ id: ownTeam!.id, role: 'owner' }));- const members = (await god.api.projects({ projectKey: 'SOL' }).members.get()).data!.items;- expect(members).toEqual([expect.objectContaining({ userId: god.id, role: 'owner' })]);+ expect(await db.$count(notificationDelivery)).toBe(1);});- it('refuses to deactivate the workspace owner', async () => {- const { god } = await setupScim();- const owner = await addUser({ email: '[email protected]' });- const [ownerTeam] = await teamsOf(owner);- const other = await setupOtherWorkspace(owner, [ownerTeam!.id]);- expect(god.id).not.toBe(owner.id);+ it('accepts the path-less replace some providers send', async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody());- const res = await other.scim.scim.v2- .Users({ id: owner.id })- .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));+ const res = await scim.scim.v2+ .Users({ id: created.data!.id })+ .patch(patchOps([{ op: 'replace', value: { active: false, displayName: 'Ada L.' } }]));- expect(res.status).toBe(409);- expect(res.error!.value).toMatchObject({- detail: 'The workspace owner cannot be deprovisioned through SCIM',- });- expect(await teamsOf(owner)).toHaveLength(1);+ expect(res.data).toMatchObject({ active: false, displayName: 'Ada L.' });});- it('accepts the path-less replace some providers send', async () => {+ it('updates one part of the name and keeps the other', async () => {const { scim } = await setupScim();const created = await scim.scim.v2.Users.post(scimUserBody());const res = await scim.scim.v2.Users({ id: created.data!.id })- .patch(patchOps([{ op: 'replace', value: { active: false, displayName: 'Ada L.' } }]));+ .patch(patchOps([{ op: 'replace', path: 'name.familyName', value: 'Byron' }]));- expect(res.status).toBe(200);- expect(res.data).toMatchObject({ active: false, displayName: 'Ada Lovelace' });+ expect(res.data).toMatchObject({ name: { givenName: 'Ada', familyName: 'Byron' } });});- it('accepts a name and an address and leaves the account its own', async () => {+ it('refuses a userName that is not an address', async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody());++ const res = await scim.scim.v2+ .Users({ id: created.data!.id })+ .patch(patchOps([{ op: 'replace', path: 'userName', value: 'ada' }]));++ expect(res.status).toBe(400);+ expect(res.error!.value).toMatchObject({ scimType: 'invalidValue' });+ });++ it('takes the address from emails when userName comes with it', async () => {const { scim } = await setupScim();const created = await scim.scim.v2.Users.post(scimUserBody());const res = await scim.scim.v2.Users({ id: created.data!.id }).patch(patchOps([- { op: 'replace', path: 'name.familyName', value: 'Byron' },- { op: 'replace', path: 'userName', value: '[email protected]' },- { op: 'replace', path: 'emails[type eq "work"].value', value: '[email protected]' },+ { op: 'replace', path: 'emails[type eq "work"].value', value: '[email protected]' },+ { op: 'replace', path: 'userName', value: '[email protected]' },]),);+ expect(res.data).toMatchObject({ userName: '[email protected]' });+ });++ it('still lists a deactivated person, so the provider can turn them back on', async () => {+ const { scim } = await setupScim();+ const member = await addUser({ email: '[email protected]' });+ await scim.scim.v2+ .Users({ id: member.id })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ const res = await scim.scim.v2.Users({ id: member.id }).get();+expect(res.status).toBe(200);- expect(res.data).toMatchObject({- userName: '[email protected]',- name: { givenName: 'Ada', familyName: 'Lovelace' },- });+ expect(res.data).toMatchObject({ active: false });});it('refuses an attribute it cannot write', async () => {@@ -481,20 +551,14 @@ describe('SCIM users', () => {});describe('DELETE /scim/v2/Users/:id', () => {- it('takes the person out of the workspace and keeps the account', async () => {- const { god, scim } = await setupScim();- const member = await addUser({ email: '[email protected]' });- await god.api.projects.post({ name: 'Marketing', key: 'MKT' });- await joinProject(god, member, 'MKT', 'member');- await member.api.projects.post({ name: 'Solo', key: 'SOL' });+ it('removes the account', async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody());- const res = await scim.scim.v2.Users({ id: member.id }).delete();+ const res = await scim.scim.v2.Users({ id: created.data!.id }).delete();expect(res.status).toBe(204);- expect((await scim.scim.v2.Users({ id: member.id }).get()).status).toBe(404);- expect(await memberIdsOf(god, 'MKT')).not.toContain(member.id);- expect(await memberIdsOf(god, 'SOL')).toEqual([god.id]);- expect((await god.api.god.users({ userId: member.id }).get()).status).toBe(200);+ expect((await scim.scim.v2.Users({ id: created.data!.id }).get()).status).toBe(404);});it('refuses the instance owner', async () => {@@ -518,6 +582,35 @@ describe('SCIM users', () => {expect(res.status).toBe(404);});+ it('deletes the owner of a project in their own workspace, which passes to the instance owner', async () => {+ const { god, scim } = await setupScim();+ const person = await signUpTestUser({ email: '[email protected]', team: false });+ const personApi = authedApi(person.cookie);+ const [own] = (await personApi.workspaces.get()).data!;+ const team = await personApi.teams.post({ name: 'Solo', slug: 'solo', workspaceId: own!.id });+ await personApi.teams({ teamId: team.data!.id }).projects.post({ name: 'Solo', key: 'SOL' });++ const res = await scim.scim.v2.Users({ id: person.userId }).delete();++ expect(res.status).toBe(204);+ const members = (await god.api.projects({ projectKey: 'SOL' }).members.get()).data!.items;+ expect(members).toEqual([expect.objectContaining({ userId: god.id, role: 'owner' })]);+ });++ it('refuses the only owner of a project', async () => {+ const { god, scim } = await setupScim();+ const owner = await addUser({ email: '[email protected]' });+ await owner.api.projects.post({ name: 'Solo', key: 'SOL' });+ expect(god.id).not.toBe(owner.id);++ const res = await scim.scim.v2.Users({ id: owner.id }).delete();++ expect(res.status).toBe(409);+ expect(res.error!.value).toMatchObject({+ detail: expect.stringContaining('only owner of a project'),+ });+ });+it('404s an unknown id', async () => {const { scim } = await setupScim();@@ -525,9 +618,36 @@ describe('SCIM users', () => {});});- // A workspace's provider sees the accounts it wrote and the people in its teams.- // Nothing else on the instance is visible to it, and what it writes stays its own.- describe('workspaces', () => {+ // On a self-hosted instance the provider is the instance's, whatever workspace an+ // account's teams are in.+ describe('the instance', () => {+ it('sees every account, in any workspace', async () => {+ const { scim } = await setupScim();+ const outsider = await addUser({ email: '[email protected]' });+ const [outsiderTeam] = await teamsOf(outsider);+ await db+ .update(team)+ .set({ workspaceId: await createWorkspace(db, 'Other', outsider.id) })+ .where(eq(team.id, outsiderTeam!.id));++ expect((await scim.scim.v2.Users({ id: outsider.id }).get()).status).toBe(200);+ });++ it("refuses another workspace's token", async () => {+ const { god } = await setupScim();+ const other = await setupOtherWorkspace(god);++ expect((await other.scim.scim.v2.Users.get({ query: {} })).status).toBe(401);+ });+ });++ // Set up per workspace, as in a hosted build, a workspace's provider sees the accounts+ // it wrote and the people in its teams. Nothing else on the instance is visible to it,+ // and what it writes stays its own.+ describe('set up per workspace', () => {+ beforeEach(() => setWorkspaceScim());+ afterEach(() => setWorkspaceScim(false));+it('sees nobody outside its own teams', async () => {const { god, scim } = await setupScim();const member = await addUser({ email: '[email protected]' });@@ -582,5 +702,131 @@ describe('SCIM users', () => {const first = await scim.scim.v2.Users({ id: person.id }).get();expect(first.data).toMatchObject({ active: true });});++ it("writes the provider's id and keeps the name and address the account holds", async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody({ externalId: 'idp-1' }));++ const res = await scim.scim.v2.Users({ id: created.data!.id }).put(+ scimUserBody({+ userName: '[email protected]',+ name: { givenName: 'Ada', familyName: 'Byron' },+ externalId: 'idp-2',+ }),+ );++ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({+ userName: '[email protected]',+ displayName: 'Ada Lovelace',+ externalId: 'idp-2',+ });+ });++ it('takes a deactivated person out of the workspace and leaves the account', async () => {+ const { god, scim } = await setupScim();+ const member = await addUser({ email: '[email protected]' });+ await god.api.projects.post({ name: 'Marketing', key: 'MKT' });+ await joinProject(god, member, 'MKT', 'member');++ const res = await scim.scim.v2+ .Users({ id: member.id })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ active: false });+ expect(await memberIdsOf(god, 'MKT')).not.toContain(member.id);+ expect(await teamsOf(member)).toHaveLength(0);+ expect((await member.api.me.get()).data).toMatchObject({ authenticated: true });+ const signIn = await app.handle(+ new Request('http://localhost/api/auth/sign-in/email', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ email: member.email, password: 'test-password-123' }),+ }),+ );+ expect(signIn.status).toBe(200);+ });++ it('passes a team and a project the person owned alone to the workspace owner', async () => {+ const { god, scim } = await setupScim();+ const member = await addUser({ email: '[email protected]' });+ const [ownTeam] = await teamsOf(member);+ await member.api.projects.post({ name: 'Solo', key: 'SOL' });++ await scim.scim.v2+ .Users({ id: member.id })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ const godTeams = await teamsOf(god);+ expect(godTeams).toContainEqual(expect.objectContaining({ id: ownTeam!.id, role: 'owner' }));+ const members = (await god.api.projects({ projectKey: 'SOL' }).members.get()).data!.items;+ expect(members).toEqual([expect.objectContaining({ userId: god.id, role: 'owner' })]);+ });++ it('refuses to deactivate the workspace owner', async () => {+ const { god } = await setupScim();+ const owner = await addUser({ email: '[email protected]' });+ const [ownerTeam] = await teamsOf(owner);+ const other = await setupOtherWorkspace(owner, [ownerTeam!.id]);+ expect(god.id).not.toBe(owner.id);++ const res = await other.scim.scim.v2+ .Users({ id: owner.id })+ .patch(patchOps([{ op: 'replace', path: 'active', value: false }]));++ expect(res.status).toBe(409);+ expect(res.error!.value).toMatchObject({+ detail: 'The workspace owner cannot be deprovisioned through SCIM',+ });+ expect(await teamsOf(owner)).toHaveLength(1);+ });++ it('accepts the path-less replace some providers send', async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody());++ const res = await scim.scim.v2+ .Users({ id: created.data!.id })+ .patch(patchOps([{ op: 'replace', value: { active: false, displayName: 'Ada L.' } }]));++ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ active: false, displayName: 'Ada Lovelace' });+ });++ it('accepts a name and an address and leaves the account its own', async () => {+ const { scim } = await setupScim();+ const created = await scim.scim.v2.Users.post(scimUserBody());++ const res = await scim.scim.v2.Users({ id: created.data!.id }).patch(+ patchOps([+ { op: 'replace', path: 'name.familyName', value: 'Byron' },+ { op: 'replace', path: 'userName', value: '[email protected]' },+ { op: 'replace', path: 'emails[type eq "work"].value', value: '[email protected]' },+ ]),+ );++ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({+ userName: '[email protected]',+ name: { givenName: 'Ada', familyName: 'Lovelace' },+ });+ });++ it('takes the person out of the workspace and keeps the account', async () => {+ const { god, scim } = await setupScim();+ const member = await addUser({ email: '[email protected]' });+ await god.api.projects.post({ name: 'Marketing', key: 'MKT' });+ await joinProject(god, member, 'MKT', 'member');+ await member.api.projects.post({ name: 'Solo', key: 'SOL' });++ const res = await scim.scim.v2.Users({ id: member.id }).delete();++ expect(res.status).toBe(204);+ expect((await scim.scim.v2.Users({ id: member.id }).get()).status).toBe(404);+ expect(await memberIdsOf(god, 'MKT')).not.toContain(member.id);+ expect(await memberIdsOf(god, 'SOL')).toEqual([god.id]);+ expect((await god.api.god.users({ userId: member.id }).get()).status).toBe(200);+ });});});diff --git a/apps/api/src/modules/scim/email-policy.ts b/apps/api/src/modules/scim/email-policy.tsindex 03cfd788..797dfcb6 100644--- a/apps/api/src/modules/scim/email-policy.ts+++ b/apps/api/src/modules/scim/email-policy.ts@@ -3,8 +3,8 @@ export type ScimEmailPolicy = (workspaceId: number, email: string) => Promise<boconst allowAny: ScimEmailPolicy = async () => true;// Whether a workspace's identity provider may provision an address. A self-hosted-// instance has one workspace and takes any address; a hosted build installs a check-// against the domains the workspace has verified.+// instance takes any address, since only its owner sets up provisioning; a hosted build+// installs a check against the domains the workspace has verified.let policy: ScimEmailPolicy = allowAny;export function setScimEmailPolicy(next: ScimEmailPolicy = allowAny): void {diff --git a/apps/api/src/modules/scim/index.ts b/apps/api/src/modules/scim/index.tsindex fb0dde70..e0d30733 100644--- a/apps/api/src/modules/scim/index.ts+++ b/apps/api/src/modules/scim/index.ts@@ -1,5 +1,5 @@import { Elysia, t } from 'elysia';-import { verifyScimToken } from '@repo/auth';+import { verifyScimToken, workspaceScim } from '@repo/auth';import { HttpError } from '#shared/lib';import { noContent } from '#shared/http';import {@@ -15,7 +15,10 @@ import {parseFilter,parsePatch,readAccountEmail,+ readEmail,+ readUserNameEmail,scimErrorBody,+ splitName,toListResponse,toScimGroup,toScimUser,@@ -62,10 +65,25 @@ function extractToken(authorization: string | undefined): string | null {// which raises SCIM errors rather than the planner's validation error.const anyBody = { body: t.Any() };-// The name and address of the account. They are the person's own, not the workspace's,-// so a provider that sends them on every sync gets them accepted and left as they are.+// The name and address of the account. While SCIM is the instance's, the provider keeps+// them in step. Set up per workspace, they are the person's own, not the workspace's, so+// a provider that sends them on every sync gets them accepted and left as they are.const ACCOUNT_ATTRIBUTE = /^(username|displayname|name(\..+)?|emails(\[.*])?(\..+)?)$/;+// What one PATCH operation on an account attribute sets. `name` is the name before it,+// which a partial name change completes.+function accountOp(path: string, value: unknown, name: string): { email?: string; name?: string } {+ if (path === 'username') return { email: readUserNameEmail(value) };+ if (path.startsWith('emails')) return { email: readEmail(value) };+ if (path === 'displayname' || path === 'name.formatted') return { name: asString(value, 'name') };+ if (path === 'name') return { name: joinName(value as never, name) };+ if (path === 'name.givenname' || path === 'name.familyname') {+ const key = path === 'name.givenname' ? 'givenName' : 'familyName';+ return { name: joinName({ ...splitName(name), [key]: asString(value, 'name') }, name) };+ }+ return {};+}+// A create or replace body, cast and checked. Guards the four spots that read// `doc.<attribute>` straight off the request body: without this, a request that// reached the handler with no body (a client-parse mismatch, or a body Elysia@@ -208,7 +226,17 @@ const scimHandlers = new Elysia({'/Users/:id',async ({ workspaceId, params, body }) => {const doc = asDoc(body);+ const account = workspaceScim()+ ? {}+ : {+ email: readAccountEmail(doc),+ name: joinName(+ doc.name as never,+ (doc.displayName as string) || (await requireUser(workspaceId, params.id)).name,+ ),+ };const updated = await updateScimUser(workspaceId, params.id, {+ ...account,active: doc.active === undefined ? true : asBoolean(doc.active),externalId: typeof doc.externalId === 'string' ? doc.externalId : null,});@@ -227,8 +255,12 @@ const scimHandlers = new Elysia({.patch('/Users/:id',async ({ workspaceId, params, body }) => {- const patch: { active?: boolean; externalId?: string | null } = {};- for (const op of parsePatch(body)) {+ const patch: { email?: string; name?: string; active?: boolean; externalId?: string | null } =+ {};+ const ops = parsePatch(body);+ // The address comes from `emails` when the request carries it, as on a create.+ const sendsEmails = ops.some((op) => op.path!.toLowerCase().startsWith('emails'));+ for (const op of ops) {const path = op.path!.toLowerCase();if (op.op === 'remove') {// The only removable attribute is the deprovisioning flag; everything@@ -243,6 +275,9 @@ const scimHandlers = new Elysia({else if (path === 'externalid') patch.externalId = asString(op.value, 'externalId');else if (!ACCOUNT_ATTRIBUTE.test(path)) {throw new ScimError(400, `Attribute '${op.path}' is not writable`, 'invalidPath');+ } else if (!workspaceScim() && !(path === 'username' && sendsEmails)) {+ const name = patch.name ?? (await requireUser(workspaceId, params.id)).name;+ Object.assign(patch, accountOp(path, op.value, name));}}const updated = await updateScimUser(workspaceId, params.id, patch);diff --git a/apps/api/src/modules/scim/reconcile.ts b/apps/api/src/modules/scim/reconcile.tsindex 1d4b5610..7ffd5036 100644--- a/apps/api/src/modules/scim/reconcile.ts+++ b/apps/api/src/modules/scim/reconcile.ts@@ -10,6 +10,7 @@ import {teamWorkspaceId,} from '@repo/db';import { and, eq, isNull, or } from 'drizzle-orm';+import { workspaceScim } from '@repo/auth';import { removeMember, setMembership, type MemberRole } from '#modules/members/service';import { listSeatHolderIds } from '#modules/teams/service';import { getLimits } from '#shared/limits';@@ -35,7 +36,9 @@ export async function reconcileProjects(projectIds: number[]): Promise<void> {// Who the mappings say should be a member of this project. A user reachable// through two mappings resolves to the strongest: 'owner' beats 'member', and among// equals the lowest mapping id wins, so the result does not depend on row order.-// A person the workspace's provider deactivated is granted nothing by its groups.+// Set up per workspace, a person the workspace's provider deactivated is granted+// nothing by its groups. While SCIM is the instance's, a deactivated account keeps+// what it had: it cannot sign in, and is back where it was once reactivated.async function desiredMembers(projectId: number): Promise<Map<string, Desired>> {const rows = await db.select({@@ -56,7 +59,7 @@ async function desiredMembers(projectId: number): Promise<Map<string, Desired>>.where(and(eq(scimGroupMapping.projectId, projectId),- or(isNull(scimUser.active), eq(scimUser.active, true)),+ workspaceScim() ? or(isNull(scimUser.active), eq(scimUser.active, true)) : undefined,),).orderBy(scimGroupMapping.id);diff --git a/apps/api/src/modules/scim/resource.ts b/apps/api/src/modules/scim/resource.tsindex 66ece97a..e3ea78c1 100644--- a/apps/api/src/modules/scim/resource.ts+++ b/apps/api/src/modules/scim/resource.ts@@ -86,16 +86,19 @@ export function joinName(// assume the value is a real address.export function readAccountEmail(doc: Record<string, unknown>): string {if (doc.emails !== undefined) return readEmail(doc.emails);- if (typeof doc.userName === 'string' && doc.userName.trim()) {- const userName = doc.userName.trim();- if (!userName.includes('@')) {- throw new ScimError(400, 'userName is not an email address', 'invalidValue');- }- return userName;- }+ if (typeof doc.userName === 'string' && doc.userName.trim())+ return readUserNameEmail(doc.userName);throw new ScimError(400, 'userName or emails is required', 'invalidValue');}+export function readUserNameEmail(value: unknown): string {+ const userName = asString(value, 'userName');+ if (!userName.includes('@')) {+ throw new ScimError(400, 'userName is not an email address', 'invalidValue');+ }+ return userName;+}+// One address out of a multi-valued `emails` attribute: the one marked primary, or// the first. Entries may be objects or bare strings.export function readEmail(value: unknown): string {diff --git a/apps/api/src/modules/scim/service.ts b/apps/api/src/modules/scim/service.tsindex 46aaf574..7dbad134 100644--- a/apps/api/src/modules/scim/service.ts+++ b/apps/api/src/modules/scim/service.ts@@ -1,6 +1,8 @@import {db,aiAgent,+ project,+ projectMember,scimGroup,scimGroupMapping,scimGroupMember,@@ -11,19 +13,27 @@ import {workspaceManager,} from '@repo/db';import { and, eq, exists, inArray, isNotNull, notExists, or, sql } from 'drizzle-orm';-import { generateUsername } from '@repo/auth';+import { generateUsername, workspaceScim } from '@repo/auth';import { iso } from '#shared/lib';+import { deleteAccount } from '#shared/account-deletion';+import { countOwners } from '#modules/members/service';import { dropWorkspaceMemberships } from '#modules/teams/service';import { ScimError, type ScimFilter, type ScimGroupRecord, type ScimUserRecord } from './resource';import { isScimEmailAllowed } from './email-policy';import { mappedProjectIds, reconcileProjects } from './reconcile';// Data access for the SCIM endpoints. Every call acts for the one workspace the-// bearer token opened. An account is one `user` row across the instance, and the-// identity provider decides who has the workspace, not who has an account: what it-// says about a person — its own id for them and whether they are active — is kept-// per workspace in `scim_user`. Deactivating or deleting someone takes them out of-// the workspace's teams; their name, address and sign-in stay as they are.+// bearer token opened, and what its provider says about a person — its own id for+// them and whether they are active — is kept per workspace in `scim_user`.+//+// How far the provider reaches depends on `workspaceScim()` in @repo/auth. Off, as on+// a self-hosted instance, SCIM is the instance owner's and acts on the whole instance,+// through the instance workspace: the provider sees every account, keeps names and+// addresses in step, a deactivated account cannot sign in, and a delete removes the+// account. On, as in a hosted build, a workspace's provider decides who has the+// workspace, not who has an account: it sees the accounts it linked and the people in+// the workspace's teams, deactivating or deleting someone takes them out of those+// teams, and their name, address and sign-in stay as they are.//// A create for an address that has no account inserts the `user` row directly rather// than going through better-auth's sign-up — the same way an agent's bot user is@@ -56,8 +66,9 @@ function linkOf(workspaceId: number) {}// The accounts a workspace's provider sees: the ones it wrote, and the people in the-// workspace's teams.+// workspace's teams. While SCIM is the instance's, every account.function inWorkspace(workspaceId: number) {+ if (!workspaceScim()) return notAnAgent;return and(notAnAgent,or(@@ -165,8 +176,11 @@ function assertNotGod(role: string | null, action: string): void {}// The workspace owner runs its SCIM provisioning and receives what a deprovisioned-// person owned alone, so the workspace's own provider cannot take it from them.+// person owned alone, so the workspace's own provider cannot take it from them. While+// SCIM is the instance's, that owner is the instance owner, whom assertNotGod covers,+// and nothing is handed over.async function assertNotWorkspaceOwner(workspaceId: number, userId: string): Promise<void> {+ if (!workspaceScim()) return;const [owner] = await db.select({ userId: workspaceManager.userId }).from(workspaceManager)@@ -216,8 +230,14 @@ export async function createScimUser(// An address with an account is that person: the provider links it rather than// creating a second one, and leaves its name and username as the person set them.+ // While SCIM is the instance's, `active` is the account's own: it decides whether+ // the account signs in at all.+ const instanceWide = !workspaceScim();const userId = await db.transaction(async (tx) => {let id = existing?.id;+ if (id && instanceWide) {+ await tx.update(user).set({ active: input.active }).where(eq(user.id, id));+ }if (!id) {const [created] = await tx.insert(user)@@ -230,6 +250,7 @@ export async function createScimUser(// The @mention handle, derived from the address the same way a sign-up// derives it. The identity provider does not supply one.username: await generateUsername(email),+ active: instanceWide ? input.active : true,}).returning({ id: user.id });id = created!.id;@@ -244,17 +265,18 @@ export async function createScimUser(return id;});if (input.active) await reconcileProjects(await groupProjectIds(workspaceId, userId));- else await dropWorkspaceMemberships(workspaceId, userId);+ else if (workspaceScim()) await dropWorkspaceMemberships(workspaceId, userId);return (await getScimUser(workspaceId, userId))!;}-// Writes what the provider says about a person: its id for them and whether they-// have the workspace. Their name and address are their own, so a PUT or PATCH that-// carries them leaves them as they are.+// Writes what the provider says about a person: its id for them and whether they are+// active. While SCIM is the instance's, it writes their name and address too; set up+// per workspace, those are the person's own, and a PUT or PATCH that carries them+// leaves them as they are.export async function updateScimUser(workspaceId: number,id: string,- patch: { active?: boolean; externalId?: string | null },+ patch: { email?: string; name?: string; active?: boolean; externalId?: string | null },): Promise<ScimUserRecord | null> {const [target] = await db.select({ role: user.role, active: scimUser.active })@@ -266,6 +288,7 @@ export async function updateScimUser(const wasActive = target.active !== false;const active = patch.active ?? wasActive;if (wasActive && !active) await assertNotWorkspaceOwner(workspaceId, id);+ if (!workspaceScim()) await updateAccount(id, { ...patch, active });await db.insert(scimUser)@@ -274,12 +297,44 @@ export async function updateScimUser(target: [scimUser.workspaceId, scimUser.userId],set: { active, ...(patch.externalId !== undefined ? { externalId: patch.externalId } : {}) },});- if (wasActive && !active) await dropWorkspaceMemberships(workspaceId, id);+ if (wasActive && !active && workspaceScim()) await dropWorkspaceMemberships(workspaceId, id);// Back in the workspace: the groups they are still in grant their projects again.if (!wasActive && active) await reconcileProjects(await groupProjectIds(workspaceId, id));return getScimUser(workspaceId, id);}+// The account as the instance's provider says it is: its name, its address, and+// whether it signs in. An address another account holds is refused, since a sign-in+// matches on it.+async function updateAccount(+ id: string,+ patch: { email?: string; name?: string; active: boolean },+): Promise<void> {+ const email = patch.email?.trim().toLowerCase();+ if (email) {+ const [clash] = await db+ .select({ id: user.id })+ .from(user)+ .where(and(emailEq(email), notAnAgent));+ if (clash && clash.id !== id) {+ throw new ScimError(+ 409,+ `A user with userName '${patch.email}' already exists`,+ 'uniqueness',+ );+ }+ }+ await db+ .update(user)+ .set({+ ...(email ? { email } : {}),+ ...(patch.name !== undefined ? { name: patch.name } : {}),+ active: patch.active,+ updatedAt: new Date(),+ })+ .where(eq(user.id, id));+}+// The projects the workspace's groups grant this person.async function groupProjectIds(workspaceId: number, userId: string): Promise<number[]> {const rows = await db@@ -335,8 +390,10 @@ export async function syncEmbeddedGroups(await reconcileProjects(projectIds);}-// Unlinks a person from the provider and takes them out of the workspace: its teams,-// its projects and its groups. The account stays.+// Set up per workspace, unlinks a person from the provider and takes them out of the+// workspace: its teams, its projects and its groups. The account stays. While SCIM is+// the instance's, removes the account, the way god mode does; deprovisioning normally+// arrives as `active: false` instead.export async function deleteScimUser(workspaceId: number, id: string): Promise<void> {const [target] = await db.select({ role: user.role })@@ -347,6 +404,17 @@ export async function deleteScimUser(workspaceId: number, id: string): Promise<v// SCIM user surface at all, so they answer the same way an unknown id does.if (!target) throw new ScimError(404, `User '${id}' not found`);assertNotGod(target.role, 'deleted');+ if (!workspaceScim()) {+ if (await ownsProjectAlone(id)) {+ throw new ScimError(+ 409,+ 'This user is the only owner of a project. Deactivate them instead, or hand the ' ++ 'project over to another owner first.',+ );+ }+ await deleteAccount(id);+ return;+ }await assertNotWorkspaceOwner(workspaceId, id);await dropWorkspaceMemberships(workspaceId, id);@@ -371,6 +439,39 @@ export async function deleteScimUser(workspaceId: number, id: string): Promise<v});}+// Whether this user owns a project alone outside the workspaces they own. Deleting the+// account would leave it with nobody who can manage its members; the ones in their own+// workspaces pass to the instance owner with the workspace (releaseOwnedWorkspaces).+async function ownsProjectAlone(userId: string): Promise<boolean> {+ const owned = await db+ .select({ projectId: projectMember.projectId })+ .from(projectMember)+ .innerJoin(project, eq(project.id, projectMember.projectId))+ .innerJoin(team, eq(team.id, project.teamId))+ .where(+ and(+ eq(projectMember.userId, userId),+ eq(projectMember.role, 'owner'),+ notExists(+ db+ .select({ n: sql`1` })+ .from(workspaceManager)+ .where(+ and(+ eq(workspaceManager.workspaceId, team.workspaceId),+ eq(workspaceManager.userId, userId),+ eq(workspaceManager.role, 'owner'),+ ),+ ),+ ),+ ),+ );+ for (const row of owned) {+ if ((await countOwners(row.projectId)) <= 1) return true;+ }+ return false;+}+// ── Groups ────────────────────────────────────────────────────────────────────function groupWhere(workspaceId: number, filter: ScimFilter | null) {diff --git a/apps/api/src/modules/teams/__tests__/integration/workspace.test.ts b/apps/api/src/modules/teams/__tests__/integration/workspace.test.tsindex bc5adc32..022affbc 100644--- a/apps/api/src/modules/teams/__tests__/integration/workspace.test.ts+++ b/apps/api/src/modules/teams/__tests__/integration/workspace.test.ts@@ -1,5 +1,6 @@import { beforeEach, describe, expect, it } from 'bun:test';-import { db, team, workspace, workspaceManager } from '@repo/db';+import { db, instanceWorkspaceId, team, workspace, workspaceManager } from '@repo/db';+import { eq } from 'drizzle-orm';import { signUpTestUser } from '#tests/helpers/auth';import { authedApi } from '#tests/helpers/app';import { resetDb } from '#tests/helpers/db';@@ -11,7 +12,10 @@ describe('instance workspace', () => {const first = await signUpTestUser({ team: false });await signUpTestUser({ team: false });- const managers = await db.select().from(workspaceManager);+ const managers = await db+ .select()+ .from(workspaceManager)+ .where(eq(workspaceManager.workspaceId, await instanceWorkspaceId(db)));expect(managers).toHaveLength(1);expect(managers[0]).toMatchObject({ userId: first.userId, role: 'owner' });});diff --git a/apps/api/src/modules/teams/index.ts b/apps/api/src/modules/teams/index.tsindex 3262cbb5..0001478c 100644--- a/apps/api/src/modules/teams/index.ts+++ b/apps/api/src/modules/teams/index.ts@@ -285,7 +285,8 @@ export const teamRoutes = new Elysia({ name: 'teams', detail: { tags: ['Teams']detail: {summary: 'Create a team',description:- 'Create a team in a workspace and become its owner. Only the workspace owner can.',+ 'Create a team in a workspace and become its owner. The workspace decides who may: ' ++ 'its owner, also its admins, or anyone in its teams.',},},)diff --git a/apps/api/src/modules/teams/service.ts b/apps/api/src/modules/teams/service.tsindex 179fb965..fd08e992 100644--- a/apps/api/src/modules/teams/service.ts+++ b/apps/api/src/modules/teams/service.ts@@ -15,6 +15,7 @@ import {teamMember,teamRole,user,+ workspace,workspaceManager,} from '@repo/db';import { and, desc, eq, ilike, inArray, isNull, or, sql } from 'drizzle-orm';@@ -34,7 +35,7 @@ import {type MemberSource,} from '#modules/members/service';import { getStats, type StatsDto } from '#modules/analytics/service';-import { assertWorkspaceOwner } from '#modules/workspaces/service';+import { assertMayCreateTeam, workspaceHoldsWork } from '#modules/workspaces/service';// The rank a person holds in a team.export type TeamRole = 'owner' | 'manager' | 'member';@@ -777,7 +778,7 @@ export async function createTeam(requestedWorkspaceId?: number,): Promise<TeamRow> {const workspaceId = requestedWorkspaceId ?? (await instanceWorkspaceId(db));- await assertWorkspaceOwner(workspaceId, ownerId);+ await assertMayCreateTeam(workspaceId, ownerId);const { maxTeams } = await getLimits(workspaceId);if (maxTeams > 0 && (await db.$count(team, eq(team.workspaceId, workspaceId))) >= maxTeams) {throw new HttpError(409, `The workspace already has ${maxTeams} teams`);@@ -1014,6 +1015,50 @@ export async function leaveTeam(teamId: number, userId: string): Promise<void> {});}+// The workspaces an account owns, as it is deleted. One holding no project and no AI+// agent goes with the account, teams and all. Any other passes to the instance owner,+// with the teams and projects the account owned alone in it, so its people keep a+// workspace somebody manages.+export async function releaseOwnedWorkspaces(userId: string): Promise<void> {+ const owned = await db+ .select({ workspaceId: workspaceManager.workspaceId })+ .from(workspaceManager)+ .where(and(eq(workspaceManager.userId, userId), eq(workspaceManager.role, 'owner')));+ if (owned.length === 0) return;+ const [instanceOwner] = await db+ .select({ userId: workspaceManager.userId })+ .from(workspaceManager)+ .where(+ and(+ eq(workspaceManager.workspaceId, await instanceWorkspaceId(db)),+ eq(workspaceManager.role, 'owner'),+ ),+ );+ const successor = instanceOwner?.userId;+ for (const { workspaceId } of owned) {+ if (!(await workspaceHoldsWork(workspaceId))) {+ await db.delete(workspace).where(eq(workspace.id, workspaceId));+ continue;+ }+ if (!successor || successor === userId) continue;+ await db.transaction(async (tx) => {+ await tx+ .delete(workspaceManager)+ .where(+ and(eq(workspaceManager.workspaceId, workspaceId), eq(workspaceManager.userId, userId)),+ );+ await tx+ .insert(workspaceManager)+ .values({ workspaceId, userId: successor, role: 'owner' })+ .onConflictDoUpdate({+ target: [workspaceManager.workspaceId, workspaceManager.userId],+ set: { role: 'owner' },+ });+ });+ await dropWorkspaceMemberships(workspaceId, userId);+ }+}+// Takes a person out of every team of the workspace, and with that out of all of its// projects: what the workspace's identity provider does when it deprovisions them. A// team or project they own alone passes to the workspace owner, so none is left withdiff --git a/apps/api/src/modules/workspaces/__tests__/integration/workspaces.test.ts b/apps/api/src/modules/workspaces/__tests__/integration/workspaces.test.tsindex 165232a1..a94f0faf 100644--- a/apps/api/src/modules/workspaces/__tests__/integration/workspaces.test.ts+++ b/apps/api/src/modules/workspaces/__tests__/integration/workspaces.test.ts@@ -1,7 +1,14 @@-import { beforeEach, describe, expect, it } from 'bun:test';-import { authedApi } from '#tests/helpers/app';+import { afterEach, beforeEach, describe, expect, it } from 'bun:test';+import { eq } from 'drizzle-orm';+import { setAuthSettings, setWorkspaceScim } from '@repo/auth';+import { db, workspace } from '@repo/db';+import { deleteAccount } from '#shared/account-deletion';+import { setOwnedWorkspaceLimit } from '#shared/limits';+import { apiKeyApi, app, authedApi } from '#tests/helpers/app';+import { createAgent } from '#tests/helpers/agents';import { signUpTestUser, type TestUser } from '#tests/helpers/auth';import { resetDb } from '#tests/helpers/db';+import { createOwnWorkspace, transferWorkspace } from '../../service';// The first account is the owner of the instance workspace; every account signed up// with a team is a person in it.@@ -27,14 +34,15 @@ describe('workspaces', () => {describe('GET /workspaces', () => {it('lists the workspace with the standing of each reader', async () => {const { ownerApi, workspaceId } = await setup();+ await setAuthSettings({ personalWorkspaces: false });const member = await signUpTestUser();const outsider = await signUpTestUser({ team: false });expect((await ownerApi.workspaces.get()).data).toEqual([- { id: workspaceId, name: 'Workspace', role: 'owner' },+ { id: workspaceId, name: 'Workspace', role: 'owner', color: null, canCreateTeam: true },]);expect((await authedApi(member.cookie).workspaces.get()).data).toEqual([- { id: workspaceId, name: 'Workspace', role: null },+ { id: workspaceId, name: 'Workspace', role: null, color: null, canCreateTeam: false },]);expect((await authedApi(outsider.cookie).workspaces.get()).data).toEqual([]);});@@ -82,6 +90,106 @@ describe('workspaces', () => {});});+ describe('settings', () => {+ it('lets a manager recolour it, and refuses a colour that is not #rrggbb', async () => {+ const { ownerApi, workspaceId } = await setup();+ const admin = await signUpTestUser();+ await makeAdmin(ownerApi, workspaceId, admin);+ const ws = authedApi(admin.cookie).workspaces({ workspaceId });++ expect((await ws.patch({ color: '#3b82f6' })).data).toMatchObject({ color: '#3b82f6' });+ expect((await ws.patch({ color: 'blue' })).status).toBe(400);+ expect((await ws.patch({ color: null })).data).toMatchObject({ color: null });+ });++ it('leaves who creates teams to the owner, and applies it to POST /teams', async () => {+ const { ownerApi, workspaceId } = await setup();+ const admin = await signUpTestUser();+ const member = await signUpTestUser();+ await makeAdmin(ownerApi, workspaceId, admin);+ const adminApi = authedApi(admin.cookie);+ const memberApi = authedApi(member.cookie);+ const team = (api: typeof adminApi, slug: string) =>+ api.teams.post({ name: slug, slug, workspaceId });+ const memberMay = async () =>+ (await memberApi.workspaces.get()).data!.find((w) => w.id === workspaceId)!.canCreateTeam;++ expect((await team(adminApi, 'by-admin')).status).toBe(403);+ expect(+ (await adminApi.workspaces({ workspaceId }).patch({ teamCreation: 'members' })).status,+ ).toBe(403);++ await ownerApi.workspaces({ workspaceId }).patch({ teamCreation: 'managers' });+ expect((await team(adminApi, 'by-admin')).status).toBe(201);+ expect((await team(memberApi, 'by-member')).status).toBe(403);+ expect(await memberMay()).toBe(false);++ await ownerApi.workspaces({ workspaceId }).patch({ teamCreation: 'members' });+ expect(await memberMay()).toBe(true);+ expect((await team(memberApi, 'by-member')).status).toBe(201);+ });+ });++ describe('transferWorkspace', () => {+ async function joinTeam(api: ReturnType<typeof authedApi>, teamId: number, person: TestUser) {+ const invite = await api+ .teams({ teamId })+ .invites.post({ email: person.email, role: 'member' });+ await authedApi(person.cookie).invites({ token: invite.data!.token }).accept.post();+ }++ // A person's own workspace with a team, and an admin of it who owns no workspace.+ async function withAdmin() {+ await setup();+ const person = await signUpTestUser({ team: false });+ const personApi = authedApi(person.cookie);+ const [own] = (await personApi.workspaces.get()).data!;+ const workspaceId = own!.id;+ const teamId = (await personApi.teams.post({ name: 'Solo', slug: 'solo', workspaceId })).data!+ .id;+ // Off from here on: on, every request would make the admin a workspace of their own.+ await setAuthSettings({ personalWorkspaces: false });+ const admin = await signUpTestUser({ team: false });+ await joinTeam(personApi, teamId, admin);+ await personApi.workspaces({ workspaceId }).managers.post({ userId: admin.userId });+ return { person, personApi, admin, workspaceId, teamId };+ }++ it('hands it to an admin, and the owner stays on as an admin', async () => {+ const { person, personApi, admin, workspaceId } = await withAdmin();++ await transferWorkspace(workspaceId, person.userId, admin.userId);++ const managers = (await personApi.workspaces({ workspaceId }).managers.get()).data!;+ expect(managers.map((m) => [m.userId, m.role])).toEqual([+ [admin.userId, 'owner'],+ [person.userId, 'admin'],+ ]);+ });++ it('refuses somebody who is not its admin, or who owns a workspace already', async () => {+ const { person, personApi, workspaceId, teamId } = await withAdmin();+ await setAuthSettings({ personalWorkspaces: true });+ const other = await signUpTestUser({ team: false });+ const transfer = () => transferWorkspace(workspaceId, person.userId, other.userId);++ await expect(transfer()).rejects.toThrow('This person is not an admin of the workspace');+ await joinTeam(personApi, teamId, other);+ await personApi.workspaces({ workspaceId }).managers.post({ userId: other.userId });+ await expect(transfer()).rejects.toThrow('already owns as many workspaces');+ });++ it('keeps the instance workspace with the instance owner', async () => {+ const { owner, ownerApi, workspaceId } = await setup();+ const admin = await signUpTestUser();+ await makeAdmin(ownerApi, workspaceId, admin);++ await expect(transferWorkspace(workspaceId, owner.userId, admin.userId)).rejects.toThrow(+ 'The instance workspace stays with the instance owner',+ );+ });+ });+describe('managers', () => {it('lists the owner first, then the admins', async () => {const { owner, ownerApi, workspaceId } = await setup();@@ -140,4 +248,189 @@ describe('workspaces', () => {expect((await authedApi(admin.cookie).workspaces({ workspaceId }).get()).status).toBe(404);});});++ describe('personal workspaces', () => {+ afterEach(() => setWorkspaceScim(false));++ it('gives every account after the first one a workspace only it sees', async () => {+ const { ownerApi, workspaceId } = await setup();+ const person = await signUpTestUser({ name: 'Jane Doe', team: false });++ const [own] = (await authedApi(person.cookie).workspaces.get()).data!;+ expect(own).toMatchObject({ name: 'Jane Doe', role: 'owner' });+ expect(own!.id).not.toBe(workspaceId);+ expect((await ownerApi.workspaces.get()).data).toEqual([+ { id: workspaceId, name: 'Workspace', role: 'owner', color: null, canCreateTeam: true },+ ]);+ });++ it('leaves SCIM provisioning to the instance owner', async () => {+ await setup();+ const person = authedApi((await signUpTestUser({ team: false })).cookie);+ const [own] = (await person.workspaces.get()).data!;+ const scim = person.workspaces({ workspaceId: own!.id }).scim;++ expect((await scim.get()).status).toBe(403);+ expect((await scim.token.post()).status).toBe(403);++ setWorkspaceScim();+ expect((await scim.get()).status).toBe(200);+ });++ it('turns off on its own, leaving the registration mode as it is', async () => {+ const { ownerApi } = await setup();+ const settings = ownerApi.god['auth-settings'];+ await settings.put({ registration: 'invite' });++ await settings.put({ personalWorkspaces: false });++ expect((await settings.get()).data).toMatchObject({+ registration: 'invite',+ personalWorkspaces: false,+ });+ });++ it('gives none while they are off', async () => {+ await setup();+ await setAuthSettings({ personalWorkspaces: false });+ const person = await signUpTestUser({ team: false });++ expect((await authedApi(person.cookie).workspaces.get()).data).toEqual([]);+ });++ it('makes one on the next request for an account made while they were off', async () => {+ await setup();+ await setAuthSettings({ personalWorkspaces: false });+ const person = authedApi((await signUpTestUser({ name: 'Jane Doe', team: false })).cookie);+ expect((await person.workspaces.get()).data).toEqual([]);++ await setAuthSettings({ personalWorkspaces: true });++ expect((await person.workspaces.get()).data).toEqual([+ expect.objectContaining({ name: 'Jane Doe', role: 'owner' }),+ ]);+ });++ it('makes none for an AI agent, and no route creates one', async () => {+ const { owner, ownerApi } = await setup();+ await ownerApi.projects.post({ key: 'MKT', name: 'Marketing' });+ const created = await createAgent(ownerApi, 'MKT', {+ name: 'Bot',+ username: 'bot',+ kind: 'external',+ });+ const bot = apiKeyApi(created.data!.apiKey!);++ const seen = (await bot.workspaces.get()).data!;+ expect(seen.filter((w) => w.role === 'owner')).toEqual([]);+ const post = await app.handle(+ new Request('http://localhost/workspaces', {+ method: 'POST',+ headers: { cookie: owner.cookie, 'content-type': 'application/json' },+ body: JSON.stringify({ name: 'Second' }),+ }),+ );+ expect(post.status).toBe(404);+ });++ it('goes with a deleted account while it holds no project', async () => {+ await setup();+ const person = await signUpTestUser({ team: false });+ const personApi = authedApi(person.cookie);+ const [own] = (await personApi.workspaces.get()).data!;+ await personApi.teams.post({ name: 'Solo', slug: 'solo', workspaceId: own!.id });++ await deleteAccount(person.userId);++ expect(await db.select().from(workspace).where(eq(workspace.id, own!.id))).toEqual([]);+ });++ it('passes to the instance owner, with what the deleted account owned alone', async () => {+ const { owner, ownerApi } = await setup();+ const person = await signUpTestUser({ team: false });+ const personApi = authedApi(person.cookie);+ const [own] = (await personApi.workspaces.get()).data!;+ const team = await personApi.teams.post({ name: 'Solo', slug: 'solo', workspaceId: own!.id });+ await personApi.teams({ teamId: team.data!.id }).projects.post({ name: 'Solo', key: 'SOL' });++ await deleteAccount(person.userId);++ expect((await ownerApi.workspaces({ workspaceId: own!.id }).get()).data).toMatchObject({+ role: 'owner',+ });+ const members = (await ownerApi.projects({ projectKey: 'SOL' }).members.get()).data!.items;+ expect(members).toEqual([expect.objectContaining({ userId: owner.userId, role: 'owner' })]);+ });+ });++ describe('DELETE /workspaces/:workspaceId', () => {+ async function ownWorkspace() {+ await setup();+ const person = await signUpTestUser({ team: false });+ const personApi = authedApi(person.cookie);+ const [own] = (await personApi.workspaces.get()).data!;+ const team = await personApi.teams.post({ name: 'Solo', slug: 'solo', workspaceId: own!.id });+ return { person, personApi, workspaceId: own!.id, teamId: team.data!.id };+ }++ it('lets the owner delete one without work, with its teams', async () => {+ const { personApi, workspaceId } = await ownWorkspace();+ const ws = personApi.workspaces({ workspaceId });++ expect((await ws.get()).data).toMatchObject({ deletion: 'allowed' });+ expect((await ws.delete()).status).toBe(204);+ expect((await personApi.teams.get()).data).toEqual([]);+ // Personal workspaces are on, so the next request makes the owner a fresh one.+ const [fresh] = (await personApi.workspaces.get()).data!;+ expect(fresh).toMatchObject({ role: 'owner' });+ expect(fresh!.id).not.toBe(workspaceId);+ });++ it('keeps one whose teams hold a project', async () => {+ const { personApi, workspaceId, teamId } = await ownWorkspace();+ await personApi.teams({ teamId }).projects.post({ name: 'Solo', key: 'SOL' });+ const ws = personApi.workspaces({ workspaceId });++ expect((await ws.get()).data).toMatchObject({ deletion: 'work' });+ expect((await ws.delete()).status).toBe(409);+ });++ it('keeps the instance workspace, and leaves deleting to the owner', async () => {+ const { ownerApi, workspaceId } = await setup();+ const admin = await signUpTestUser();+ await makeAdmin(ownerApi, workspaceId, admin);++ expect((await ownerApi.workspaces({ workspaceId }).get()).data).toMatchObject({+ deletion: 'instance',+ });+ expect((await ownerApi.workspaces({ workspaceId }).delete()).status).toBe(409);+ expect((await authedApi(admin.cookie).workspaces({ workspaceId }).delete()).status).toBe(403);+ });+ });++ describe('createOwnWorkspace', () => {+ afterEach(() => setOwnedWorkspaceLimit());++ it('keeps a person to one workspace unless the limit is raised', async () => {+ await setup();+ const person = await signUpTestUser({ team: false });+ const account = { id: person.userId, role: 'user' };++ await expect(createOwnWorkspace(account, 'Second')).rejects.toThrow(+ 'You already own a workspace',+ );+ setOwnedWorkspaceLimit(0);+ expect(await createOwnWorkspace(account, 'Second')).toBeNumber();+ });++ it('leaves creation to the instance owner while personal workspaces are off', async () => {+ await setup();+ await setAuthSettings({ personalWorkspaces: false });+ const person = await signUpTestUser({ team: false });++ await expect(createOwnWorkspace({ id: person.userId, role: 'user' }, 'Acme')).rejects.toThrow(+ 'Only the instance owner can create workspaces',+ );+ });+ });});diff --git a/apps/api/src/modules/workspaces/index.ts b/apps/api/src/modules/workspaces/index.tsindex d3277ccd..112d947e 100644--- a/apps/api/src/modules/workspaces/index.ts+++ b/apps/api/src/modules/workspaces/index.ts@@ -27,12 +27,13 @@ import {} from './model';import {addAdmin,+ deleteWorkspace,getWorkspace,listManagerCandidates,listManagers,listWorkspaces,removeAdmin,- renameWorkspace,+ updateWorkspace,} from './service';import {listWorkspaceProjectOptions,@@ -41,8 +42,10 @@ import {} from './scim';// A workspace owns teams. Only its owner and admins manage it; everyone else sees it-// through the teams they are in. SCIM provisioning is the owner's alone: the identity-// provider decides who has access to the workspace.+// through the teams they are in. No route creates one: sign-up and sign-in make each+// person's own (@repo/auth), and an edition that lets a person own more mounts its route+// on createOwnWorkspace. SCIM provisioning is set up only by the instance owner, in a+// workspace they own: the identity provider decides who has access to the workspace.export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags: ['Workspaces'] } }).use(authContext).use(guards)@@ -69,15 +72,39 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:.patch('/workspaces/:workspaceId',async ({ standing, body }) => {- await renameWorkspace(standing.workspaceId, body.name);+ await updateWorkspace(standing.workspaceId, standing.role, body);return getWorkspace(standing.workspaceId, standing.role);},{workspaceManager: true,params: workspaceParams,body: updateWorkspaceBody,- response: { 200: WorkspaceResponse, ...errors(400, 401, 404) },- detail: { summary: 'Rename a workspace', description: 'Rename a workspace you manage.' },+ response: { 200: WorkspaceResponse, ...errors(400, 401, 403, 404) },+ detail: {+ summary: 'Update a workspace',+ description:+ 'Rename or recolour a workspace you manage. Who creates teams in it is set by its ' ++ 'owner only.',+ },+ },+ )++ .delete(+ '/workspaces/:workspaceId',+ async ({ standing }) => {+ await deleteWorkspace(standing.workspaceId, standing.userId);+ return noContent();+ },+ {+ workspaceOwner: true,+ params: workspaceParams,+ response: { 204: t.Void(), ...errors(401, 403, 404, 409) },+ detail: {+ summary: 'Delete a workspace',+ description:+ 'Delete a workspace you own, with its teams. The instance workspace stays, and one ' ++ 'whose teams hold a project or an AI agent is refused until those are gone.',+ },},)@@ -147,13 +174,14 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:baseUrl: SCIM_BASE_URL,}),{- workspaceOwner: true,+ workspaceScim: true,params: workspaceParams,response: { 200: ScimSettingsResponse, ...errors(401, 403, 404) },detail: {summary: 'Get SCIM provisioning settings',description:- 'Whether SCIM provisioning is on and whether a token has been generated. Owner only.',+ 'Whether SCIM provisioning is on and whether a token has been generated. ' ++ 'Instance owner only.',},},)@@ -170,13 +198,13 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:return { ...(await setScimSettings(standing.workspaceId, body)), baseUrl: SCIM_BASE_URL };},{- workspaceOwner: true,+ workspaceScim: true,params: workspaceParams,body: ScimSettingsBody,response: { 200: ScimSettingsResponse, ...errors(400, 401, 403, 404) },detail: {summary: 'Update SCIM provisioning settings',- description: 'Turn SCIM provisioning on or off. Owner only.',+ description: 'Turn SCIM provisioning on or off. Instance owner only.',},},)@@ -185,14 +213,14 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:'/workspaces/:workspaceId/scim/token',async ({ standing }) => ({ token: await rotateScimToken(standing.workspaceId) }),{- workspaceOwner: true,+ workspaceScim: true,params: workspaceParams,response: { 200: ScimTokenResponse, ...errors(401, 403, 404) },detail: {summary: 'Generate a SCIM token',description:'Generate the bearer token an identity provider sends to /scim/v2, replacing any ' +- 'previous one. The value is returned once and cannot be read back. Owner only.',+ 'previous one. The value is returned once and cannot be read back. Instance owner only.',},},)@@ -201,14 +229,14 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:'/workspaces/:workspaceId/scim/groups',({ standing }) => listWorkspaceScimGroups(standing.workspaceId),{- workspaceOwner: true,+ workspaceScim: true,params: workspaceParams,response: { 200: t.Array(ScimGroupResponse), ...errors(401, 403, 404) },detail: {summary: 'List provisioned groups',description:"The groups the workspace's identity provider has pushed, with their member counts " +- 'and the projects they grant membership in. Owner only.',+ 'and the projects they grant membership in. Instance owner only.',},},)@@ -218,7 +246,7 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:({ standing, params, body }) =>setWorkspaceScimGroupMappings(standing.workspaceId, params.groupId, body.mappings),{- workspaceOwner: true,+ workspaceScim: true,params: scimGroupParams,body: ScimGroupMappingsBody,response: { 200: ScimGroupResponse, ...errors(400, 401, 403, 404) },@@ -226,7 +254,7 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:summary: "Set a group's project mappings",description:'Replace the projects of the workspace a provisioned group grants membership in, ' +- 'then reconcile the membership of every project the change touched. Owner only.',+ 'then reconcile the membership of every project the change touched. Instance owner only.',},},)@@ -235,14 +263,14 @@ export const workspaceRoutes = new Elysia({ name: 'workspaces', detail: { tags:'/workspaces/:workspaceId/projects/options',({ standing }) => listWorkspaceProjectOptions(standing.workspaceId),{- workspaceOwner: true,+ workspaceScim: true,params: workspaceParams,response: { 200: WorkspaceProjectOptionListResponse, ...errors(401, 403, 404) },detail: {summary: 'List workspace projects',description:'Every project of the workspace with the roles its team assigns, for the group ' +- 'mapping picker. Owner only.',+ 'mapping picker. Instance owner only.',},},);diff --git a/apps/api/src/modules/workspaces/model.ts b/apps/api/src/modules/workspaces/model.tsindex df659eaf..58b26e42 100644--- a/apps/api/src/modules/workspaces/model.ts+++ b/apps/api/src/modules/workspaces/model.ts@@ -1,10 +1,24 @@import { t } from 'elysia';+import { TEAM_CREATION } from './service';export const workspaceParams = t.Object({ workspaceId: t.Numeric() });export const workspaceManagerParams = t.Object({ workspaceId: t.Numeric(), userId: t.String() });-export const updateWorkspaceBody = t.Object({ name: t.String({ minLength: 1, maxLength: 60 }) });+export const updateWorkspaceBody = t.Object({+ name: t.Optional(t.String({ minLength: 1, maxLength: 60 })),+ color: t.Optional(t.Nullable(t.String({ pattern: '^#[0-9a-fA-F]{6}$' }))),+ // t.UnionEnum defaults to its first value, which would fill in the setting for a+ // request that leaves it out; the update is partial.+ teamCreation: t.Optional(+ t.UnionEnum([...TEAM_CREATION], {+ default: undefined,+ description:+ 'Who creates teams: the owner alone, the owner and admins, or anyone in its teams. ' ++ 'Only the owner changes it.',+ }),+ ),+});export const addManagerBody = t.Object({ userId: t.String() });@@ -21,6 +35,8 @@ export const WorkspaceListResponse = t.Array(role: t.Nullable(workspaceRole, {description: 'Your standing in the workspace; null when you are only in a team of it.',}),+ color: t.Nullable(t.String()),+ canCreateTeam: t.Boolean(),}),);@@ -29,6 +45,13 @@ export const WorkspaceResponse = t.Object({name: t.String(),role: workspaceRole,managerCount: t.Number(),+ color: t.Nullable(t.String()),+ teamCreation: t.UnionEnum([...TEAM_CREATION]),+ deletion: t.UnionEnum(['allowed', 'instance', 'work'], {+ description:+ 'Whether the owner may delete it: instance for the instance workspace, which stays; ' ++ 'work while a team of it holds a project or an AI agent.',+ }),});const person = {diff --git a/apps/api/src/modules/workspaces/scim.ts b/apps/api/src/modules/workspaces/scim.tsindex e9933843..588bbcb6 100644--- a/apps/api/src/modules/workspaces/scim.ts+++ b/apps/api/src/modules/workspaces/scim.ts@@ -8,13 +8,15 @@ import {teamRole,} from '@repo/db';import { and, asc, eq, inArray, sql } from 'drizzle-orm';+import { workspaceScim } from '@repo/auth';import { HttpError } from '#shared/lib';import { mappedProjectIds, reconcileProjects } from '#modules/scim/reconcile';// The groups a workspace's identity provider has pushed, and what each one grants.// The group and its members belong to the provider and are read-only here; the// mappings are the workspace owner's, and are what turns group membership into-// project access.+// project access. A group grants projects of its own workspace when SCIM is set up per+// workspace, and any project while it is the instance's.export interface WorkspaceScimGroupMapping {projectId: number;projectKey: string;@@ -80,8 +82,7 @@ export async function listWorkspaceScimGroups(workspaceId: number): Promise<Work// Replaces what a group grants, then reconciles every project the change touched —// the ones it granted before as well as the ones it grants now, so a project it was-// unmapped from loses the memberships that came from it. A group grants access only-// to projects of its own workspace.+// unmapped from loses the memberships that came from it.export async function setWorkspaceScimGroupMappings(workspaceId: number,groupId: string,@@ -102,7 +103,7 @@ export async function setWorkspaceScimGroupMappings(.select({ id: project.id, teamId: project.teamId }).from(project).innerJoin(team, eq(team.id, project.teamId))- .where(and(inArray(project.id, projectIds), eq(team.workspaceId, workspaceId)));+ .where(and(inArray(project.id, projectIds), grantable(workspaceId)));if (known.length !== projectIds.length) throw new HttpError(400, 'Unknown project');// A role belongs to one team, so a mapping that names another team's role would// silently grant the wrong permissions.@@ -144,7 +145,7 @@ export async function setWorkspaceScimGroupMappings(return groups.find((g) => g.id === groupId)!;}-// Every project of the workspace with the roles of the team that owns it. What the+// Every project a group may grant, with the roles of the team that owns it. What the// group mapping form fills its project and role selects from.export async function listWorkspaceProjectOptions(workspaceId: number) {const [projects, roles] = await Promise.all([@@ -152,13 +153,13 @@ export async function listWorkspaceProjectOptions(workspaceId: number) {.select({ id: project.id, key: project.key, name: project.name, teamId: project.teamId }).from(project).innerJoin(team, eq(team.id, project.teamId))- .where(eq(team.workspaceId, workspaceId))+ .where(grantable(workspaceId)).orderBy(asc(project.key)),db.select({ id: teamRole.id, name: teamRole.name, teamId: teamRole.teamId }).from(teamRole).innerJoin(team, eq(team.id, teamRole.teamId))- .where(eq(team.workspaceId, workspaceId))+ .where(grantable(workspaceId)).orderBy(asc(teamRole.id)),]);return projects.map(({ teamId, ...entry }) => ({@@ -166,3 +167,8 @@ export async function listWorkspaceProjectOptions(workspaceId: number) {roles: roles.filter((role) => role.teamId === teamId).map(({ id, name }) => ({ id, name })),}));}++// The teams whose projects a workspace's groups may grant, as a condition on `team`.+function grantable(workspaceId: number) {+ return workspaceScim() ? eq(team.workspaceId, workspaceId) : undefined;+}diff --git a/apps/api/src/modules/workspaces/service.ts b/apps/api/src/modules/workspaces/service.tsindex ad3877b3..a4fc1d9b 100644--- a/apps/api/src/modules/workspaces/service.ts+++ b/apps/api/src/modules/workspaces/service.ts@@ -1,7 +1,33 @@-import { db, team, teamMember, user, workspace, workspaceManager } from '@repo/db';-import { and, asc, eq, ilike, inArray, ne, notExists, or, sql, type SQL } from 'drizzle-orm';+import { forgetPersonalWorkspace, getAuthSettings } from '@repo/auth';+import {+ aiAgent,+ createWorkspace,+ db,+ instanceWorkspaceId,+ project,+ team,+ teamMember,+ user,+ workspace,+ workspaceManager,+ type DbExecutor,+} from '@repo/db';+import {+ and,+ asc,+ eq,+ exists,+ ilike,+ inArray,+ ne,+ notExists,+ or,+ sql,+ type SQL,+} from 'drizzle-orm';import { requireUser, type AuthUser } from '#shared/access';import { HttpError } from '#shared/lib';+import { getOwnedWorkspaceLimit } from '#shared/limits';export type WorkspaceRole = 'owner' | 'admin';@@ -33,16 +59,50 @@ export async function requireWorkspaceManager(return { workspaceId, role, userId: current.id };}-export async function assertWorkspaceOwner(workspaceId: number, userId: string): Promise<void> {- if ((await getWorkspaceRole(workspaceId, userId)) !== 'owner') {- throw new HttpError(403, 'Only the workspace owner can do this');- }+export const TEAM_CREATION = ['owner', 'managers', 'members'] as const;+export type TeamCreation = (typeof TEAM_CREATION)[number];++// Who may create a team in the workspace, by its setting: the owner always, its admins+// when it lets managers, and anyone in one of its teams when it lets members. A role of+// null is taken to be somebody in one of its teams.+function mayCreateTeam(role: WorkspaceRole | null, teamCreation: string | undefined): boolean {+ return (+ role === 'owner' ||+ (role === 'admin' && teamCreation === 'managers') ||+ teamCreation === 'members'+ );+}++export async function assertMayCreateTeam(workspaceId: number, userId: string): Promise<void> {+ const [row] = await db+ .select({ teamCreation: workspace.teamCreation })+ .from(workspace)+ .where(eq(workspace.id, workspaceId));+ const role = await getWorkspaceRole(workspaceId, userId);+ const allowed =+ mayCreateTeam(role, row?.teamCreation) &&+ (role !== null || (await inWorkspaceTeam(workspaceId, userId)));+ if (!allowed) throw new HttpError(403, 'You may not create a team in this workspace');+}++async function inWorkspaceTeam(workspaceId: number, userId: string): Promise<boolean> {+ const [row] = await db+ .select({ id: user.id })+ .from(user)+ .where(and(eq(user.id, userId), workspacePeople(workspaceId)));+ return row !== undefined;}// The workspaces a person sees: those they manage and those holding a team of theirs.export async function listWorkspaces(userId: string) {const rows = await db- .select({ id: workspace.id, name: workspace.name, role: workspaceManager.role })+ .select({+ id: workspace.id,+ name: workspace.name,+ color: workspace.color,+ teamCreation: workspace.teamCreation,+ role: workspaceManager.role,+ }).from(workspace).leftJoin(workspaceManager,@@ -62,7 +122,10 @@ export async function listWorkspaces(userId: string) {),).orderBy(asc(workspace.name), asc(workspace.id));- return rows.map((row) => ({ ...row, role: row.role as WorkspaceRole | null }));+ return rows.map(({ teamCreation, ...row }) => {+ const role = row.role as WorkspaceRole | null;+ return { ...row, role, canCreateTeam: mayCreateTeam(role, teamCreation) };+ });}export async function getWorkspace(workspaceId: number, role: WorkspaceRole) {@@ -71,15 +134,169 @@ export async function getWorkspace(workspaceId: number, role: WorkspaceRole) {id: workspace.id,name: workspace.name,managerCount: db.$count(workspaceManager, eq(workspaceManager.workspaceId, workspace.id)),+ color: workspace.color,+ teamCreation: workspace.teamCreation,}).from(workspace).where(eq(workspace.id, workspaceId));if (!row) throw new HttpError(404, 'Workspace not found');- return { ...row, role };+ return {+ ...row,+ teamCreation: row.teamCreation as TeamCreation,+ role,+ deletion: await workspaceDeletion(workspaceId),+ };+}++// Whether a team of the workspace has a project or an AI agent: people's work, which a+// deleted workspace would take with it.+export async function workspaceHoldsWork(workspaceId: number): Promise<boolean> {+ const [row] = await db+ .select({ id: team.id })+ .from(team)+ .where(+ and(+ eq(team.workspaceId, workspaceId),+ or(+ exists(+ db+ .select({ n: sql`1` })+ .from(project)+ .where(eq(project.teamId, team.id)),+ ),+ exists(+ db+ .select({ n: sql`1` })+ .from(aiAgent)+ .where(eq(aiAgent.teamId, team.id)),+ ),+ ),+ ),+ )+ .limit(1);+ return row !== undefined;}-export async function renameWorkspace(workspaceId: number, name: string): Promise<void> {- await db.update(workspace).set({ name }).where(eq(workspace.id, workspaceId));+export type WorkspaceDeletion = 'allowed' | 'instance' | 'work';++// Whether the owner may delete the workspace, and if not, why. The instance workspace+// stays: teams created without a workspace and SCIM on a self-hosted instance land in+// it. One whose teams hold work keeps it until its projects and AI agents are gone.+export async function workspaceDeletion(workspaceId: number): Promise<WorkspaceDeletion> {+ if (workspaceId === (await instanceWorkspaceId(db))) return 'instance';+ return (await workspaceHoldsWork(workspaceId)) ? 'work' : 'allowed';+}++// Its teams go with it; their people keep their accounts and their other teams. An owner+// left with no workspace gets a fresh personal one while personal workspaces are on.+export async function deleteWorkspace(workspaceId: number, ownerId: string): Promise<void> {+ const deletion = await workspaceDeletion(workspaceId);+ if (deletion === 'instance') {+ throw new HttpError(409, 'The instance workspace cannot be deleted');+ }+ if (deletion === 'work') {+ throw new HttpError(409, 'Delete the projects and AI agents of its teams first');+ }+ await db.delete(workspace).where(eq(workspace.id, workspaceId));+ forgetPersonalWorkspace(ownerId);+}++export type WorkspaceCreationBlock = 'restricted' | 'limit';++// Whether a person may create a workspace, and if not, why: the instance keeps+// workspaces to its owner, or they already own as many as one person may. An agent's bot+// user is no person and creates none. No core route calls this or createOwnWorkspace;+// an edition that lets a person own more workspaces mounts its route on them.+export async function workspaceCreation(+ current: AuthUser,+ executor: DbExecutor = db,+): Promise<{ allowed: boolean; reason: WorkspaceCreationBlock | null }> {+ if (await executor.$count(aiAgent, eq(aiAgent.userId, current.id))) {+ return { allowed: false, reason: 'restricted' };+ }+ if (current.role !== 'god' && !(await getAuthSettings()).personalWorkspaces) {+ return { allowed: false, reason: 'restricted' };+ }+ const limit = getOwnedWorkspaceLimit();+ const owned = await executor.$count(+ workspaceManager,+ and(eq(workspaceManager.userId, current.id), eq(workspaceManager.role, 'owner')),+ );+ if (limit > 0 && owned >= limit) return { allowed: false, reason: 'limit' };+ return { allowed: true, reason: null };+}++export async function createOwnWorkspace(current: AuthUser, name: string): Promise<number> {+ return db.transaction(async (tx) => {+ // Two requests at once would otherwise both count the same owned workspaces.+ await tx.select({ id: user.id }).from(user).where(eq(user.id, current.id)).for('update');+ const { reason } = await workspaceCreation(current, tx);+ if (reason === 'restricted') {+ throw new HttpError(403, 'Only the instance owner can create workspaces');+ }+ if (reason === 'limit') throw new HttpError(409, 'You already own a workspace');+ return createWorkspace(tx, name, current.id);+ });+}++// A manager renames and recolours it; who creates teams is the owner's to decide, so an+// admin cannot let themselves create teams.+export async function updateWorkspace(+ workspaceId: number,+ role: WorkspaceRole,+ patch: { name?: string; color?: string | null; teamCreation?: TeamCreation },+): Promise<void> {+ if (patch.teamCreation !== undefined && role !== 'owner') {+ throw new HttpError(403, 'Only the workspace owner decides who creates teams');+ }+ if (Object.keys(patch).length === 0) return;+ await db.update(workspace).set(patch).where(eq(workspace.id, workspaceId));+}++// Hands the workspace to one of its admins; the owner stays on as an admin. No core route+// calls it: an edition that offers handing a workspace over mounts its route here. The instance+// workspace stays with the instance owner. Nobody takes on more workspaces than one person+// may own, so handing over is no way around the limit; the instance owner is the+// exception, as deleted accounts' workspaces pass to them anyway. An owner left with no+// workspace gets a fresh personal one while personal workspaces are on.+export async function transferWorkspace(+ workspaceId: number,+ ownerId: string,+ toUserId: string,+): Promise<void> {+ if (workspaceId === (await instanceWorkspaceId(db))) {+ throw new HttpError(409, 'The instance workspace stays with the instance owner');+ }+ if ((await getWorkspaceRole(workspaceId, toUserId)) !== 'admin') {+ throw new HttpError(404, 'This person is not an admin of the workspace');+ }+ const [target] = await db.select({ role: user.role }).from(user).where(eq(user.id, toUserId));+ const limit = getOwnedWorkspaceLimit();+ if (target?.role !== 'god' && limit > 0) {+ const owned = await db.$count(+ workspaceManager,+ and(eq(workspaceManager.userId, toUserId), eq(workspaceManager.role, 'owner')),+ );+ if (owned >= limit) {+ throw new HttpError(409, 'This person already owns as many workspaces as one person may');+ }+ }+ // One owner per workspace: the current one steps down before the admin steps up.+ await db.transaction(async (tx) => {+ await tx+ .update(workspaceManager)+ .set({ role: 'admin' })+ .where(+ and(eq(workspaceManager.workspaceId, workspaceId), eq(workspaceManager.userId, ownerId)),+ );+ await tx+ .update(workspaceManager)+ .set({ role: 'owner' })+ .where(+ and(eq(workspaceManager.workspaceId, workspaceId), eq(workspaceManager.userId, toUserId)),+ );+ });+ forgetPersonalWorkspace(ownerId);}export async function listManagers(workspaceId: number) {diff --git a/apps/api/src/shared/account-deletion.ts b/apps/api/src/shared/account-deletion.tsindex 41026191..abfbdebd 100644--- a/apps/api/src/shared/account-deletion.ts+++ b/apps/api/src/shared/account-deletion.ts@@ -1,10 +1,13 @@import { db, documentAsset, projectDocument, user } from '@repo/db';import { and, asc, eq, inArray, or, sql } from 'drizzle-orm';import { deleteObjects } from '@repo/storage';+import { releaseOwnedWorkspaces } from '#modules/teams/service';const DOCUMENT_TREE_LOCK_NAMESPACE = 1_145_390_931;export async function deleteAccount(userId: string): Promise<boolean> {+ // Before the account goes, so a workspace it owned is not left without an owner.+ await releaseOwnedWorkspaces(userId);const result = await db.transaction(async (tx) => {const locked = await tx.execute(sql`select id from "user" where id = ${userId} for update`);if (locked.length === 0) return { deleted: false, assetKeys: [] as string[] };diff --git a/apps/api/src/shared/auth-context.ts b/apps/api/src/shared/auth-context.tsindex 5d44bd53..ace9c1fc 100644--- a/apps/api/src/shared/auth-context.ts+++ b/apps/api/src/shared/auth-context.ts@@ -2,7 +2,12 @@ import { Elysia } from 'elysia';import { db } from '@repo/db';import { user as users } from '@repo/db/schema';import { eq } from 'drizzle-orm';-import { auth, getSessionFromHeaders } from '@repo/auth';+import {+ auth,+ ensurePersonalWorkspace,+ getSessionFromHeaders,+ isAccountDeactivated,+} from '@repo/auth';import { HttpError } from './lib';import { getMcpOAuthToken } from './mcp-request';@@ -29,11 +34,15 @@ export type SessionUser = SessionResult['user'];// session-gated. A feature also uses it directly when its handlers or local// macros reference `user`, which is what makes the `user` type flow there. The// plugin is named, so its resolve runs once per request (dedup).+//+// A deactivated account is refused here as well as at sign-in: deactivation arrives+// over SCIM while sessions and API keys are already open, and this is the one place+// every planner route and the MCP surface pass through.export const authContext = new Elysia({ name: 'auth-context' }).resolve({ as: 'scoped' },async ({ request, path }): Promise<{ user: SessionUser | null }> => {const session = await getSessionFromHeaders(request.headers);- if (session) return { user: session.user };+ if (session) return { user: await signedIn(session.user) };const mcpToken = getMcpOAuthToken(request);if (mcpToken) {const oauthSession = await auth.api.getMcpSession({@@ -41,7 +50,7 @@ export const authContext = new Elysia({ name: 'auth-context' }).resolve(});if (oauthSession) {const user = await db.query.user.findFirst({ where: eq(users.id, oauthSession.userId) });- if (user) return { user: user as SessionUser };+ if (user) return { user: await signedIn(user as SessionUser) };}}// The public raw-attachment route has no session and needs none.@@ -49,3 +58,12 @@ export const authContext = new Elysia({ name: 'auth-context' }).resolve(throw new HttpError(401, 'Authentication required');},);++// A deactivated account goes no further. Any other gets its personal workspace here when+// it has none yet, so one made before personal workspaces, by SCIM or while they were off+// has it on its next request instead of its next sign-in.+async function signedIn(user: SessionUser): Promise<SessionUser> {+ if (isAccountDeactivated(user)) throw new HttpError(401, 'This account is deactivated');+ await ensurePersonalWorkspace(user.id);+ return user;+}diff --git a/apps/api/src/shared/guards.ts b/apps/api/src/shared/guards.tsindex 9bd13b3f..74759567 100644--- a/apps/api/src/shared/guards.ts+++ b/apps/api/src/shared/guards.ts@@ -1,4 +1,5 @@import { Elysia, type DocumentDecoration } from 'elysia';+import { workspaceScim as isScimPerWorkspace } from '@repo/auth';import { authContext } from './auth-context';import {requireProjectAccess,@@ -342,6 +343,29 @@ export const guards = new Elysia({ name: 'guards' }).use(authContext).macro({};},+ // SCIM creates accounts and attaches existing ones to the workspace, which reaches past+ // the workspace to the whole instance, so only the instance owner sets it up, in a+ // workspace they own, unless SCIM is set up per workspace (setWorkspaceScim in+ // @repo/auth).+ workspaceScim(_enabled: boolean) {+ return {+ async resolve({ params, user }) {+ const standing = await requireWorkspaceManager(+ Number((params as WorkspaceIdParams).workspaceId),+ user,+ );+ const perWorkspace = isScimPerWorkspace();+ if (standing.role !== 'owner' || (!perWorkspace && user?.role !== 'god')) {+ throw new HttpError(+ 403,+ `Only the ${perWorkspace ? 'workspace' : 'instance'} owner sets up SCIM provisioning`,+ );+ }+ return { standing };+ },+ };+ },+// Owner-only actions (renaming the team, its roles, deleting a project). A// non-member gets the same 404 as for an unknown team, since membership is// resolved before the owner check.diff --git a/apps/api/src/shared/limits.ts b/apps/api/src/shared/limits.tsindex 954184b1..05249084 100644--- a/apps/api/src/shared/limits.ts+++ b/apps/api/src/shared/limits.ts@@ -50,3 +50,15 @@ export function getLimits(workspaceId: number): Promise<Limits> {export async function getTeamLimits(teamId: number, executor: DbExecutor = db): Promise<Limits> {return provider(await teamWorkspaceId(teamId, executor));}++// How many workspaces one person may own. A self-hosted instance gives each person one;+// a hosted build raises it. 0 reads as unlimited, as in Limits.+let ownedWorkspaceLimit = 1;++export function setOwnedWorkspaceLimit(next = 1): void {+ ownedWorkspaceLimit = next;+}++export function getOwnedWorkspaceLimit(): number {+ return ownedWorkspaceLimit;+}diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 17ef4de7..791ab9d3 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -18,11 +18,23 @@ Next.js App Router, SSR (not SPA). Tailwind v4 + shadcn/ui. See root `AGENTS.md`nowhere else. `useWorkspaceSections(workspace)` returns the sections the hosted build addsto a workspace's settings — each a menu entry and a page, shown by`WorkspaceSectionNav` and opened at `/workspaces/:id/:sectionId`; here it returns none.- `WorkspaceRailActions` renders below the workspace tiles of both rails (the project picker- and the teams page), where the hosted build puts creating a workspace; here it is a- button whose popover says where more workspaces are available. `NoTeamStart` is the start- page of an account with no team and no workspace it owns; here it says who adds them, and- the hosted build offers to create a workspace.+ `NoTeamStart` is the start page of an account with no team and no workspace it owns,+ which happens while personal workspaces are off; here it says who adds them.+ `WorkspaceRailActions` sits below the workspace tiles of a rail; here it says where more+ than one workspace per person is available. `godSections(core)` returns the god mode+ sections: here the core's as they are, while the hosted build adds, replaces or drops+ some. One it adds carries in `Component` the page `/god/<slug>` opens. SCIM is set up in+ god mode, for the instance workspace; the hosted build that moves it to every+ workspace drops the god section and adds `WorkspaceScimSection` through+ `useWorkspaceSections`. `GodSectionExtras` renders at the end of every god section page, by+ its slug, for settings the hosted build adds to an existing section; `WorkspaceSectionExtras`+ does the same on a workspace's own settings pages (`general`, `managers`), with the+ workspace, and its controls save themselves. `cloudMessages` is the+ hosted build's English, merged into the catalogue the keys are typed against (a god+ section's name and blurb go under `sections.god.<slug>` like the core ones), and+ `loadCloudMessages(locale)` returns its other languages. The i18n request config imports+ `@/cloud` on the server for the messages, so every component file it exports starts with+ `'use client'`.The hosted build points `CLOUD_UI_ENTRY` at its own module exporting the same names, and`WEB_TRACING_ROOT` at the root its workspace has; unset, both are what this repository needs.@@ -70,7 +82,7 @@ next-intl, language from the `NEXT_LOCALE` cookie — no `[locale]` route segmen- English is the source: `src/i18n/messages.ts` imports it statically, merges the chosenlanguage over it, and types every `t('…')`. A new key goes there first or typecheck fails;an untranslated one renders its English text.-- A new namespace needs its file in every language plus an entry in `defaultMessages`.+- A new namespace needs its file in every language plus an entry in `coreMessages`.- A new language: `messages/<code>/`, `src/i18n/locales.ts`, `src/hooks/useDateFnsLocale.ts`,and `LOCALES`/`Locale` in `apps/api/src/modules/user-preferences/`. No migration — the `locale`column has no CHECK. One written right to left also goes in `RTL_LOCALES`.diff --git a/apps/web/messages/ar/auth.json b/apps/web/messages/ar/auth.jsonindex 3c95bf1c..8b96181c 100644--- a/apps/web/messages/ar/auth.json+++ b/apps/web/messages/ar/auth.json@@ -91,6 +91,7 @@"invalidToken": "رابط التأكيد ده مش صالح. سجّل دخولك من تحت عشان يوصلك رابط جديد.","userNotFound": "رابط التأكيد ده بتاع حساب مبقاش موجود.","ssoDisabled": "الدخول الموحّد غير متاح على هذا الخادم.",- "passwordDisabled": "يتم تسجيل الدخول على هذا الخادم عبر مزوّد الهوية فقط."+ "passwordDisabled": "يتم تسجيل الدخول على هذا الخادم عبر مزوّد الهوية فقط.",+ "accountDeactivated": "هذا الحساب معطّل. اطلب من المسؤول إعادة تفعيله."}}diff --git a/apps/web/messages/ar/god.json b/apps/web/messages/ar/god.jsonindex f5299e85..81f90cb6 100644--- a/apps/web/messages/ar/god.json+++ b/apps/web/messages/ar/god.json@@ -57,6 +57,7 @@"deleteConfirm": "حذف الحساب","deleteConfirmWithProjects": "{count, plural, zero {حذف الحساب} one {حذف الحساب والمشروع} two {حذف الحساب والمشروعين} few {حذف الحساب والمشاريع} many {حذف الحساب والمشاريع} other {حذف الحساب والمشاريع}}","deleteMessage": "<strong>{name}</strong> هيفقد وصوله للنسخة دي. المهام والتعليقات اللي كتبها هتفضل موجودة، بس من غير اسمه عليها. ده مش هينفع ترجع فيه.",+ "deleteWorkspaceNote": "مساحة العمل اللي الحساب ده بيملكها هتتحذف معاه لو مفيهاش مشاريع ولا وكلاء ذكاء اصطناعي. غير كده هتنتقل ليك بكل حاجة كان الحساب بيملكها فيها لوحده.","soleOwnerTitle": "{count, plural, zero {ليس المالك الوحيد لأي مشروع} one {المالك الوحيد لمشروع} two {المالك الوحيد لمشروعين} few {المالك الوحيد لـ # مشاريع} many {المالك الوحيد لـ # مشروعًا} other {المالك الوحيد لـ # مشروع}}","soleOwnerHint": "{count, plural, zero {بعد ما الحساب يتحذف، محدش هيقدر يديرها.} one {بعد ما الحساب يتحذف، محدش هيقدر يديره.} two {بعد ما الحساب يتحذف، محدش هيقدر يديرهم.} few {بعد ما الحساب يتحذف، محدش هيقدر يديرها.} many {بعد ما الحساب يتحذف، محدش هيقدر يديرها.} other {بعد ما الحساب يتحذف، محدش هيقدر يديرها.}}","deleteWithProjects": "{count, plural, zero {حذف المشاريع مع الحساب} one {حذف المشروع مع الحساب} two {حذف المشروعين مع الحساب} few {حذف المشاريع مع الحساب} many {حذف المشاريع مع الحساب} other {حذف المشاريع مع الحساب}}",@@ -159,7 +160,11 @@"saved": "تم حفظ الإعدادات الافتراضية","projectDefaults": "الإعدادات الافتراضية","mcpEnabled": "تفعيل MCP في المشاريع الجديدة",- "mcpEnabledHint": "المشروع الجديد بيدخل نطاق MCP بتاع فريقه أول ما يتعمل."+ "mcpEnabledHint": "المشروع الجديد بيدخل نطاق MCP بتاع فريقه أول ما يتعمل.",+ "workspacesSaved": "اتحفظت إعدادات مساحات العمل",+ "workspaces": "مساحات العمل",+ "personalWorkspaces": "مساحة عمل لكل شخص",+ "personalWorkspacesHint": "كل حساب بياخد مساحة عمل خاصة بيه باسم صاحبه. لو اتقفل، الناس بيشتغلوا بس في مساحات العمل اللي اتضافوا ليها."},"authentication": {"saved": "تم حفظ إعدادات المصادقة",diff --git a/apps/web/messages/ar/sections.json b/apps/web/messages/ar/sections.jsonindex a9fb1be4..e620bcab 100644--- a/apps/web/messages/ar/sections.json+++ b/apps/web/messages/ar/sections.json@@ -25,7 +25,7 @@},"general": {"label": "عام",- "description": "الإعدادات الافتراضية للمشاريع الجديدة."+ "description": "مساحات العمل الشخصية والإعدادات الافتراضية للمشاريع الجديدة."},"authentication": {"label": "المصادقة",@@ -50,6 +50,10 @@"auth-provider": {"label": "مزوّد المصادقة","description": "الحسابات الخارجية اللي الناس تقدر تدخل بيها."+ },+ "scim": {+ "label": "SCIM",+ "description": "اسمح لمزوّد الهوية بإنشاء الحسابات وتحديثها وتعطيلها على هذا الخادم، ومنح الوصول إلى المشاريع عبر مجموعاته."}},"settings": {diff --git a/apps/web/messages/ar/shell.json b/apps/web/messages/ar/shell.jsonindex 06e7e198..57e55490 100644--- a/apps/web/messages/ar/shell.json+++ b/apps/web/messages/ar/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "أنشئ فريقك. ستكون فيه مشاريعه وأعضاؤه ووكلاؤه.","noTeamsMemberHint": "اطلب من مالك مساحة العمل إضافتك إلى فريق.","noProjectAccessHint": "اطلب من مالك الفريق أو مديره إضافتك إلى مشروع.",+ "noProjectAccessOwnerHint": "اطلب من مالك الفريق أو مديره إضافتك إلى مشروع، أو اعمل فريقك الخاص.","createTeam": "إنشاء فريق","noProjectsTitle": "لا توجد مشاريع بعد","noProjectsHint": "اعمل أول مشروع ليك وابدأ تخطّط مهامك على لوحة.",diff --git a/apps/web/messages/ar/teams.json b/apps/web/messages/ar/teams.jsonindex d47b2b86..d453f0fc 100644--- a/apps/web/messages/ar/teams.json+++ b/apps/web/messages/ar/teams.json@@ -546,7 +546,7 @@"rail": "مساحات العمل","create": "مساحة عمل جديدة","createUnavailableTitle": "مساحات عمل أكتر",- "createUnavailableHint": "النسخة دي فيها مساحة عمل واحدة. إنشاء مساحات العمل وإدارتها متاح في Cloud وفي نسخة Pro للاستضافة الذاتية.",+ "createUnavailableHint": "مساحات عمل أكتر لكل شخص متاحة في Cloud وفي نسخة Pro للاستضافة الذاتية.","general": "عام","roles": {"owner": "المالك",@@ -558,7 +558,17 @@"workspace": "مساحة العمل","workspaceHint": "الاسم الذي يراه الجميع.","role": "دورك",- "saved": "تم حفظ مساحة العمل"+ "saved": "تم حفظ مساحة العمل",+ "color": "اللون",+ "colorReset": "الافتراضي"+ },+ "teamCreation": {+ "title": "مين يقدر يعمل فرق",+ "description": "اللي بيعمل الفريق بيبقى مالكه.",+ "ownerOnly": "المالك بس اللي بيحدد مين يعمل فرق.",+ "owner": "المالك بس",+ "managers": "المالك والمسؤولين",+ "members": "كل اللي في فرقها"},"managers": {"title": "المديرون",@@ -583,6 +593,7 @@"saved": "تم حفظ إعدادات SCIM","provisioning": "تزويد الحسابات","provisioningConfigured": "يضيف مزوّد الهوية الأشخاص إلى مساحة العمل هذه ويزيلهم منها.",+ "provisioningInstance": "يقوم مزوّد الهوية بإنشاء الحسابات وتحديثها وتعطيلها على هذا الخادم.","provisioningMissing": "أنشئ رمزاً أولاً.","token": "الرمز","noToken": "لم يُنشأ رمز بعد",@@ -622,6 +633,14 @@"remove": "إزالة المشروع","saved": "تم حفظ وصول المجموعة"}+ },+ "delete": {+ "action": "حذف مساحة العمل",+ "hint": "فرقها هتتحذف معاها. الناس هيحتفظوا بحساباتهم وفرقهم التانية.",+ "blocked": "احذف مشاريع فرقها ووكلاء الذكاء الاصطناعي الأول.",+ "title": "حذف {name}؟",+ "description": "<strong>{name}</strong> وفرقها هيتحذفوا. الناس هيحتفظوا بحساباتهم وفرقهم التانية. ده مش هينفع ترجع فيه.",+ "deleted": "تم حذف مساحة العمل"}}}diff --git a/apps/web/messages/en/auth.json b/apps/web/messages/en/auth.jsonindex 25d5e24d..2ee87df2 100644--- a/apps/web/messages/en/auth.json+++ b/apps/web/messages/en/auth.json@@ -91,6 +91,7 @@"invalidToken": "This confirmation link is not valid. Sign in below to get a new one.","userNotFound": "This confirmation link belongs to an account that no longer exists.","ssoDisabled": "Single sign-on is not available on this instance.",- "passwordDisabled": "This instance signs people in through its identity provider only."+ "passwordDisabled": "This instance signs people in through its identity provider only.",+ "accountDeactivated": "This account is deactivated. Ask your administrator to restore it."}}diff --git a/apps/web/messages/en/god.json b/apps/web/messages/en/god.jsonindex 108664c6..225300f8 100644--- a/apps/web/messages/en/god.json+++ b/apps/web/messages/en/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Delete account","deleteConfirmWithProjects": "{count, plural, one {Delete account and project} other {Delete account and projects}}","deleteMessage": "<strong>{name}</strong> loses access to this instance. Issues and comments they wrote stay, with the author unassigned. This cannot be undone.",+ "deleteWorkspaceNote": "A workspace this account owns is deleted with it while it has no projects or AI agents. Otherwise it passes to you, with everything the account owned alone in it.","soleOwnerTitle": "{count, plural, one {Only owner of a project} other {Only owner of # projects}}","soleOwnerHint": "{count, plural, one {Once the account is gone, nobody can manage it.} other {Once the account is gone, nobody can manage them.}}","deleteWithProjects": "{count, plural, one {Delete the project with the account} other {Delete the projects with the account}}",@@ -159,7 +160,11 @@"saved": "Project defaults saved","projectDefaults": "Project defaults","mcpEnabled": "Enable MCP on new projects",- "mcpEnabledHint": "A new project is in its team's MCP reach from the moment it is created."+ "mcpEnabledHint": "A new project is in its team's MCP reach from the moment it is created.",+ "workspacesSaved": "Workspace settings saved",+ "workspaces": "Workspaces",+ "personalWorkspaces": "A workspace for everyone",+ "personalWorkspacesHint": "Every account gets a workspace of its own, named after the person. Off, people work only in the workspaces they are added to."},"authentication": {"saved": "Authentication settings saved",diff --git a/apps/web/messages/en/sections.json b/apps/web/messages/en/sections.jsonindex e5900a2a..79d2c607 100644--- a/apps/web/messages/en/sections.json+++ b/apps/web/messages/en/sections.json@@ -25,7 +25,7 @@},"general": {"label": "General",- "description": "Defaults for new projects."+ "description": "Personal workspaces and defaults for new projects."},"authentication": {"label": "Authentication",@@ -50,6 +50,10 @@"auth-provider": {"label": "Auth provider","description": "The external accounts people may sign in with."+ },+ "scim": {+ "label": "SCIM",+ "description": "Let an identity provider create, update and deactivate accounts on this instance, and grant project access through its groups."}},"settings": {diff --git a/apps/web/messages/en/shell.json b/apps/web/messages/en/shell.jsonindex 791f7eb7..788705b7 100644--- a/apps/web/messages/en/shell.json+++ b/apps/web/messages/en/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Create your team. Its projects, members and agents are kept in it.","noTeamsMemberHint": "Ask the workspace owner to add you to a team.","noProjectAccessHint": "Ask a team owner or manager to add you to a project.",+ "noProjectAccessOwnerHint": "Ask a team owner or manager to add you to a project, or create a team of your own.","createTeam": "Create team","noProjectsTitle": "No projects yet","noProjectsHint": "Create your first project to start planning issues on a board.",diff --git a/apps/web/messages/en/teams.json b/apps/web/messages/en/teams.jsonindex 9f9ff0ab..5667a54c 100644--- a/apps/web/messages/en/teams.json+++ b/apps/web/messages/en/teams.json@@ -546,7 +546,7 @@"rail": "Workspaces","create": "New workspace","createUnavailableTitle": "More workspaces",- "createUnavailableHint": "This instance has one workspace. Creating and managing workspaces is available in Cloud and self-hosted Pro.",+ "createUnavailableHint": "More workspaces per person are available in Cloud and self-hosted Pro.","general": "General","roles": {"owner": "Owner",@@ -558,7 +558,17 @@"workspace": "Workspace","workspaceHint": "The name everyone sees for this workspace.","role": "Your role",- "saved": "Workspace saved"+ "saved": "Workspace saved",+ "color": "Color",+ "colorReset": "Use default"+ },+ "teamCreation": {+ "title": "Who creates teams",+ "description": "Whoever creates a team owns it.",+ "ownerOnly": "Only the owner changes who creates teams.",+ "owner": "Only the owner",+ "managers": "The owner and admins",+ "members": "Everyone in its teams"},"managers": {"title": "Managers",@@ -583,6 +593,7 @@"saved": "SCIM settings saved","provisioning": "Provisioning","provisioningConfigured": "Your identity provider adds people to this workspace and removes them.",+ "provisioningInstance": "Your identity provider creates, updates and deactivates accounts on this instance.","provisioningMissing": "Generate a token first.","token": "Token","noToken": "No token generated yet",@@ -622,6 +633,14 @@"remove": "Remove project","saved": "Group access saved"}+ },+ "delete": {+ "action": "Delete workspace",+ "hint": "Its teams are deleted with it. People keep their accounts and their other teams.",+ "blocked": "Delete the projects and AI agents of its teams first.",+ "title": "Delete {name}?",+ "description": "<strong>{name}</strong> and its teams are deleted. People keep their accounts and their other teams. This cannot be undone.",+ "deleted": "Workspace deleted"}}}diff --git a/apps/web/messages/es-ES/auth.json b/apps/web/messages/es-ES/auth.jsonindex e17f194f..7f2ac819 100644--- a/apps/web/messages/es-ES/auth.json+++ b/apps/web/messages/es-ES/auth.json@@ -91,6 +91,7 @@"invalidToken": "Este enlace de confirmación no es válido. Inicia sesión abajo para conseguir uno nuevo.","userNotFound": "Este enlace de confirmación pertenece a una cuenta que ya no existe.","ssoDisabled": "El inicio de sesión único no está disponible en esta instancia.",- "passwordDisabled": "Esta instancia inicia sesión de las personas solo a través de su proveedor de identidades."+ "passwordDisabled": "Esta instancia inicia sesión de las personas solo a través de su proveedor de identidades.",+ "accountDeactivated": "Esta cuenta está desactivada. Pide a tu administrador que la restaure."}}diff --git a/apps/web/messages/es-ES/god.json b/apps/web/messages/es-ES/god.jsonindex 67b37467..2b326402 100644--- a/apps/web/messages/es-ES/god.json+++ b/apps/web/messages/es-ES/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Eliminar la cuenta","deleteConfirmWithProjects": "{count, plural, one {Eliminar la cuenta y el proyecto} other {Eliminar la cuenta y los proyectos}}","deleteMessage": "<strong>{name}</strong> pierde el acceso a esta instancia. Los tickets y los comentarios que ha escrito se quedan, sin el autor asignado. No se puede deshacer.",+ "deleteWorkspaceNote": "Un espacio de trabajo de esta cuenta se elimina con ella si no tiene proyectos ni agentes de IA. Si los tiene, pasa a ti, con todo lo que la cuenta tenía en exclusiva en él.","soleOwnerTitle": "{count, plural, one {Único propietario de un proyecto} other {Único propietario de # proyectos}}","soleOwnerHint": "{count, plural, one {Cuando la cuenta se vaya, nadie la podrá gestionar.} other {Cuando la cuenta se vaya, nadie los podrá gestionar.}}","deleteWithProjects": "{count, plural, one {Eliminar el proyecto con la cuenta} other {Eliminar los proyectos con la cuenta}}",@@ -159,7 +160,11 @@"saved": "Los valores por defecto del proyecto se han guardado","projectDefaults": "Valores por defecto del proyecto","mcpEnabled": "Activar MCP en los proyectos nuevos",- "mcpEnabledHint": "Un proyecto nuevo está en el alcance de MCP de su equipo desde el momento en que se crea."+ "mcpEnabledHint": "Un proyecto nuevo está en el alcance de MCP de su equipo desde el momento en que se crea.",+ "workspacesSaved": "Ajustes de espacios de trabajo guardados",+ "workspaces": "Espacios de trabajo",+ "personalWorkspaces": "Un espacio de trabajo para cada persona",+ "personalWorkspacesHint": "Cada cuenta recibe un espacio de trabajo propio con el nombre de la persona. Desactivado, cada persona trabaja solo en los espacios de trabajo a los que se le ha añadido."},"authentication": {"saved": "Los ajustes de autenticación se han guardado",diff --git a/apps/web/messages/es-ES/sections.json b/apps/web/messages/es-ES/sections.jsonindex ed8f38d5..7e920261 100644--- a/apps/web/messages/es-ES/sections.json+++ b/apps/web/messages/es-ES/sections.json@@ -25,7 +25,7 @@},"general": {"label": "General",- "description": "Valores por defecto para los proyectos nuevos."+ "description": "Espacios de trabajo personales y valores por defecto para los proyectos nuevos."},"authentication": {"label": "Autenticación",@@ -50,6 +50,10 @@"auth-provider": {"label": "Proveedor de autenticación","description": "Las cuentas externas con las que las personas pueden iniciar sesión."+ },+ "scim": {+ "label": "SCIM",+ "description": "Permite que un proveedor de identidades cree, actualize y desactive cuentas en esta instancia, y conceda acceso a proyectos a través de sus grupos."}},"settings": {diff --git a/apps/web/messages/es-ES/shell.json b/apps/web/messages/es-ES/shell.jsonindex 659ffb90..5bd8b4b4 100644--- a/apps/web/messages/es-ES/shell.json+++ b/apps/web/messages/es-ES/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Crea tu equipo. En él estarán sus proyectos, miembros y agentes.","noTeamsMemberHint": "Pide al propietario del espacio de trabajo que te añada a un equipo.","noProjectAccessHint": "Pide al propietario o a un administrador del equipo que te añada a un proyecto.",+ "noProjectAccessOwnerHint": "Pide al propietario o a un administrador del equipo que te añada a un proyecto, o crea tu propio equipo.","createTeam": "Crear equipo","noProjectsTitle": "Todavía no hay proyectos","noProjectsHint": "Crea tu primer proyecto para empezar a planificar tickets en un tablero.",diff --git a/apps/web/messages/es-ES/teams.json b/apps/web/messages/es-ES/teams.jsonindex 13350467..8c0432ac 100644--- a/apps/web/messages/es-ES/teams.json+++ b/apps/web/messages/es-ES/teams.json@@ -546,7 +546,7 @@"rail": "Espacios de trabajo","create": "Nuevo espacio de trabajo","createUnavailableTitle": "Más espacios de trabajo",- "createUnavailableHint": "Esta instancia tiene un solo espacio de trabajo. Crear y gestionar espacios de trabajo está disponible en Cloud y en Pro autoalojado.",+ "createUnavailableHint": "Más espacios de trabajo por persona están disponibles en Cloud y en Pro autoalojado.","general": "General","roles": {"owner": "Propietario",@@ -558,7 +558,17 @@"workspace": "Espacio de trabajo","workspaceHint": "El nombre que ve todo el mundo.","role": "Tu rol",- "saved": "Espacio de trabajo guardado"+ "saved": "Espacio de trabajo guardado",+ "color": "Color",+ "colorReset": "Usar el predeterminado"+ },+ "teamCreation": {+ "title": "Quién crea equipos",+ "description": "Quien crea un equipo es su propietario.",+ "ownerOnly": "Solo el propietario decide quién crea equipos.",+ "owner": "Solo el propietario",+ "managers": "El propietario y los administradores",+ "members": "Todos los de sus equipos"},"managers": {"title": "Responsables",@@ -583,6 +593,7 @@"saved": "Los ajustes de SCIM se han guardado","provisioning": "Preparación","provisioningConfigured": "Tu proveedor de identidades añade personas a este espacio de trabajo y las quita.",+ "provisioningInstance": "Tu proveedor de identidades crea, actualiza y desactive cuentas en esta instancia.","provisioningMissing": "Genera primero un token.","token": "Token","noToken": "Todavía no se ha generado un token",@@ -622,6 +633,14 @@"remove": "Quitar el proyecto","saved": "El acceso del grupo se ha guardado"}+ },+ "delete": {+ "action": "Eliminar espacio de trabajo",+ "hint": "Sus equipos se eliminan con él. Las personas conservan sus cuentas y sus otros equipos.",+ "blocked": "Elimina primero los proyectos y los agentes de IA de sus equipos.",+ "title": "¿Eliminar {name}?",+ "description": "<strong>{name}</strong> y sus equipos se eliminan. Las personas conservan sus cuentas y sus otros equipos. No se puede deshacer.",+ "deleted": "Espacio de trabajo eliminado"}}}diff --git a/apps/web/messages/fr/auth.json b/apps/web/messages/fr/auth.jsonindex 973f344e..605b1d4d 100644--- a/apps/web/messages/fr/auth.json+++ b/apps/web/messages/fr/auth.json@@ -91,6 +91,7 @@"invalidToken": "Ce lien de confirmation n'est pas valide. Connectez-vous ci-dessous pour en recevoir un nouveau.","userNotFound": "Ce lien de confirmation appartient à un compte qui n'existe plus.","ssoDisabled": "L'authentification unique n'est pas disponible sur cette instance.",- "passwordDisabled": "Cette instance ne connecte les utilisateurs que via son fournisseur d'identité."+ "passwordDisabled": "Cette instance ne connecte les utilisateurs que via son fournisseur d'identité.",+ "accountDeactivated": "Ce compte est désactivé. Demandez à votre administrateur de le rétablir."}}diff --git a/apps/web/messages/fr/god.json b/apps/web/messages/fr/god.jsonindex d5364c4a..8a7148ad 100644--- a/apps/web/messages/fr/god.json+++ b/apps/web/messages/fr/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Supprimer le compte","deleteConfirmWithProjects": "{count, plural, one {Supprimer le compte et le projet} other {Supprimer le compte et les projets}}","deleteMessage": "<strong>{name}</strong> perd l'accès à cette instance. Les tickets et commentaires rédigés par cette personne sont conservés, sans auteur. Cette action est irréversible.",+ "deleteWorkspaceNote": "Un espace de travail détenu par ce compte est supprimé avec lui s'il ne contient ni projet ni agent IA. Sinon, il vous revient, avec tout ce que le compte y détenait seul.","soleOwnerTitle": "{count, plural, one {Seul propriétaire d'un projet} other {Seul propriétaire de # projets}}","soleOwnerHint": "{count, plural, one {Une fois le compte supprimé, personne ne pourra le gérer.} other {Une fois le compte supprimé, personne ne pourra les gérer.}}","deleteWithProjects": "{count, plural, one {Supprimer le projet avec le compte} other {Supprimer les projets avec le compte}}",@@ -159,7 +160,11 @@"saved": "Valeurs par défaut des projets enregistrées","projectDefaults": "Valeurs par défaut des projets","mcpEnabled": "Activer MCP sur les nouveaux projets",- "mcpEnabledHint": "Un nouveau projet est accessible via MCP dès sa création."+ "mcpEnabledHint": "Un nouveau projet est accessible via MCP dès sa création.",+ "workspacesSaved": "Paramètres des espaces de travail enregistrés",+ "workspaces": "Espaces de travail",+ "personalWorkspaces": "Un espace de travail pour chacun",+ "personalWorkspacesHint": "Chaque compte reçoit son propre espace de travail, à son nom. Désactivé, chacun travaille seulement dans les espaces de travail où il a été ajouté."},"authentication": {"saved": "Paramètres d'authentification enregistrés",diff --git a/apps/web/messages/fr/sections.json b/apps/web/messages/fr/sections.jsonindex 6ea40661..eab62675 100644--- a/apps/web/messages/fr/sections.json+++ b/apps/web/messages/fr/sections.json@@ -25,7 +25,7 @@},"general": {"label": "Général",- "description": "Les valeurs par défaut des nouveaux projets."+ "description": "Les espaces de travail personnels et les valeurs par défaut des nouveaux projets."},"authentication": {"label": "Authentification",@@ -50,6 +50,10 @@"auth-provider": {"label": "Fournisseur d'authentification","description": "Les comptes externes avec lesquels les utilisateurs peuvent se connecter."+ },+ "scim": {+ "label": "SCIM",+ "description": "Permettez à un fournisseur d'identité de créer, mettre à jour et désactiver des comptes sur cette instance, et d'accorder l'accès aux projets via ses groupes."}},"settings": {diff --git a/apps/web/messages/fr/shell.json b/apps/web/messages/fr/shell.jsonindex 882e813f..5411cf48 100644--- a/apps/web/messages/fr/shell.json+++ b/apps/web/messages/fr/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Créez votre équipe. Elle contiendra ses projets, ses membres et ses agents.","noTeamsMemberHint": "Demandez au propriétaire de l'espace de travail de vous ajouter à une équipe.","noProjectAccessHint": "Demandez au propriétaire ou à un gestionnaire de l'équipe de vous ajouter à un projet.",+ "noProjectAccessOwnerHint": "Demandez au propriétaire ou à un gestionnaire de l'équipe de vous ajouter à un projet, ou créez votre propre équipe.","createTeam": "Créer une équipe","noProjectsTitle": "Aucun projet pour l'instant","noProjectsHint": "Créez votre premier projet pour commencer à organiser vos tickets sur un tableau.",diff --git a/apps/web/messages/fr/teams.json b/apps/web/messages/fr/teams.jsonindex 725f9232..0e606347 100644--- a/apps/web/messages/fr/teams.json+++ b/apps/web/messages/fr/teams.json@@ -546,7 +546,7 @@"rail": "Espaces de travail","create": "Nouvel espace de travail","createUnavailableTitle": "Plus d'espaces de travail",- "createUnavailableHint": "Cette instance a un seul espace de travail. La création et la gestion des espaces de travail sont disponibles dans Cloud et dans Pro auto-hébergé.",+ "createUnavailableHint": "Plusieurs espaces de travail par personne sont disponibles dans Cloud et dans Pro auto-hébergé.","general": "Général","roles": {"owner": "Propriétaire",@@ -558,7 +558,17 @@"workspace": "Espace de travail","workspaceHint": "Le nom que tout le monde voit.","role": "Votre rôle",- "saved": "Espace de travail enregistré"+ "saved": "Espace de travail enregistré",+ "color": "Couleur",+ "colorReset": "Par défaut"+ },+ "teamCreation": {+ "title": "Qui crée des équipes",+ "description": "Qui crée une équipe en est le propriétaire.",+ "ownerOnly": "Seul le propriétaire décide qui crée des équipes.",+ "owner": "Seulement le propriétaire",+ "managers": "Le propriétaire et les administrateurs",+ "members": "Tous les membres de ses équipes"},"managers": {"title": "Responsables",@@ -583,6 +593,7 @@"saved": "Paramètres SCIM enregistrés","provisioning": "Provisionnement","provisioningConfigured": "Votre fournisseur d'identité ajoute des personnes à cet espace de travail et les en retire.",+ "provisioningInstance": "Votre fournisseur d'identité crée, met à jour et désactive les comptes de cette instance.","provisioningMissing": "Générez d'abord un token.","token": "Token","noToken": "Aucun token généré pour l'instant",@@ -622,6 +633,14 @@"remove": "Retirer le projet","saved": "Accès du groupe enregistré"}+ },+ "delete": {+ "action": "Supprimer l'espace de travail",+ "hint": "Ses équipes sont supprimées avec lui. Les personnes gardent leur compte et leurs autres équipes.",+ "blocked": "Supprimez d'abord les projets et les agents IA de ses équipes.",+ "title": "Supprimer {name} ?",+ "description": "<strong>{name}</strong> et ses équipes sont supprimés. Les personnes gardent leur compte et leurs autres équipes. Cette action est irréversible.",+ "deleted": "Espace de travail supprimé"}}}diff --git a/apps/web/messages/id/auth.json b/apps/web/messages/id/auth.jsonindex 2137cbd3..fe3ed45d 100644--- a/apps/web/messages/id/auth.json+++ b/apps/web/messages/id/auth.json@@ -91,6 +91,7 @@"invalidToken": "Tautan konfirmasi ini tidak valid. Masuk di bawah ini untuk mendapatkan yang baru.","userNotFound": "Tautan konfirmasi ini milik akun yang sudah tidak ada.","ssoDisabled": "Single sign-on tidak tersedia di instance ini.",- "passwordDisabled": "Instance ini hanya mengizinkan pengguna masuk melalui penyedia identitasnya."+ "passwordDisabled": "Instance ini hanya mengizinkan pengguna masuk melalui penyedia identitasnya.",+ "accountDeactivated": "Akun ini telah dinonaktifkan. Minta administrator Anda untuk memulihkannya."}}diff --git a/apps/web/messages/id/god.json b/apps/web/messages/id/god.jsonindex 0b9445fa..0cf52690 100644--- a/apps/web/messages/id/god.json+++ b/apps/web/messages/id/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Hapus akun","deleteConfirmWithProjects": "{count, plural, one {Hapus akun dan proyek} other {Hapus akun dan proyek}}","deleteMessage": "<strong>{name}</strong> akan kehilangan akses ke instance ini. Issue dan komentar yang mereka tulis tetap ada, dengan pembuat tidak ditetapkan. Tindakan ini tidak dapat dibatalkan.",+ "deleteWorkspaceNote": "Workspace milik akun ini ikut dihapus jika tidak memiliki proyek atau agen AI. Jika ada, workspace itu berpindah ke Anda, beserta semua yang dimiliki akun ini sendiri di dalamnya.","soleOwnerTitle": "{count, plural, one {Satu-satunya pemilik proyek} other {Satu-satunya pemilik dari # proyek}}","soleOwnerHint": "{count, plural, one {Setelah akun dihapus, tidak ada yang dapat mengelolanya.} other {Setelah akun dihapus, tidak ada yang dapat mengelolanya.}}","deleteWithProjects": "{count, plural, one {Hapus proyek bersama akun} other {Hapus proyek-proyek bersama akun}}",@@ -159,7 +160,11 @@"saved": "Pengaturan bawaan proyek disimpan","projectDefaults": "Pengaturan bawaan proyek","mcpEnabled": "Aktifkan MCP pada proyek baru",- "mcpEnabledHint": "Proyek baru berada dalam jangkauan MCP timnya sejak saat dibuat."+ "mcpEnabledHint": "Proyek baru berada dalam jangkauan MCP timnya sejak saat dibuat.",+ "workspacesSaved": "Pengaturan workspace disimpan",+ "workspaces": "Workspace",+ "personalWorkspaces": "Workspace untuk setiap orang",+ "personalWorkspacesHint": "Setiap akun mendapat workspace sendiri dengan nama pemiliknya. Jika nonaktif, orang hanya bekerja di workspace tempat mereka ditambahkan."},"authentication": {"saved": "Pengaturan autentikasi disimpan",diff --git a/apps/web/messages/id/sections.json b/apps/web/messages/id/sections.jsonindex 97270507..32fece82 100644--- a/apps/web/messages/id/sections.json+++ b/apps/web/messages/id/sections.json@@ -25,7 +25,7 @@},"general": {"label": "Umum",- "description": "Pengaturan bawaan untuk proyek baru."+ "description": "Workspace pribadi dan pengaturan bawaan untuk proyek baru."},"authentication": {"label": "Autentikasi",@@ -50,6 +50,10 @@"auth-provider": {"label": "Penyedia autentikasi","description": "Akun eksternal yang dapat digunakan pengguna untuk masuk."+ },+ "scim": {+ "label": "SCIM",+ "description": "Izinkan penyedia identitas membuat, memperbarui, dan menonaktifkan akun di instance ini, serta memberikan akses proyek melalui grupnya."}},"settings": {diff --git a/apps/web/messages/id/shell.json b/apps/web/messages/id/shell.jsonindex c2e4dd39..6ecc9071 100644--- a/apps/web/messages/id/shell.json+++ b/apps/web/messages/id/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Buat tim Anda. Proyek, anggota, dan agennya disimpan di dalamnya.","noTeamsMemberHint": "Minta pemilik workspace untuk menambahkan Anda ke sebuah tim.","noProjectAccessHint": "Minta pemilik atau manajer tim untuk menambahkan Anda ke proyek.",+ "noProjectAccessOwnerHint": "Minta pemilik atau manajer tim untuk menambahkan Anda ke proyek, atau buat tim Anda sendiri.","createTeam": "Buat tim","noProjectsTitle": "Belum ada proyek","noProjectsHint": "Buat proyek pertama Anda untuk mulai merencanakan issue di papan.",diff --git a/apps/web/messages/id/teams.json b/apps/web/messages/id/teams.jsonindex d27328fc..10e4fb0d 100644--- a/apps/web/messages/id/teams.json+++ b/apps/web/messages/id/teams.json@@ -546,7 +546,7 @@"rail": "Workspace","create": "Workspace baru","createUnavailableTitle": "Lebih banyak workspace",- "createUnavailableHint": "Instance ini memiliki satu workspace. Membuat dan mengelola workspace tersedia di Cloud dan Pro self-hosted.",+ "createUnavailableHint": "Lebih banyak workspace per orang tersedia di Cloud dan Pro self-hosted.","general": "Umum","roles": {"owner": "Pemilik",@@ -558,7 +558,17 @@"workspace": "Workspace","workspaceHint": "Nama yang dilihat semua orang.","role": "Peran Anda",- "saved": "Workspace disimpan"+ "saved": "Workspace disimpan",+ "color": "Warna",+ "colorReset": "Gunakan bawaan"+ },+ "teamCreation": {+ "title": "Siapa yang membuat tim",+ "description": "Pembuat tim menjadi pemiliknya.",+ "ownerOnly": "Hanya pemilik yang menentukan siapa yang membuat tim.",+ "owner": "Hanya pemilik",+ "managers": "Pemilik dan admin",+ "members": "Semua orang di timnya"},"managers": {"title": "Pengelola",@@ -583,6 +593,7 @@"saved": "Pengaturan SCIM disimpan","provisioning": "Provisioning","provisioningConfigured": "Penyedia identitas Anda menambahkan orang ke workspace ini dan mengeluarkan mereka.",+ "provisioningInstance": "Penyedia identitas Anda membuat, memperbarui, dan menonaktifkan akun pada instance ini.","provisioningMissing": "Buat token terlebih dahulu.","token": "Token","noToken": "Belum ada token yang dibuat",@@ -622,6 +633,14 @@"remove": "Hapus proyek","saved": "Akses grup disimpan"}+ },+ "delete": {+ "action": "Hapus workspace",+ "hint": "Timnya ikut dihapus. Orang-orang tetap memiliki akun dan tim lain mereka.",+ "blocked": "Hapus dulu proyek dan agen AI di timnya.",+ "title": "Hapus {name}?",+ "description": "<strong>{name}</strong> dan timnya akan dihapus. Orang-orang tetap memiliki akun dan tim lain mereka. Tindakan ini tidak dapat dibatalkan.",+ "deleted": "Workspace dihapus"}}}diff --git a/apps/web/messages/pt-BR/auth.json b/apps/web/messages/pt-BR/auth.jsonindex 0e2186a0..ccc9f7fe 100644--- a/apps/web/messages/pt-BR/auth.json+++ b/apps/web/messages/pt-BR/auth.json@@ -91,6 +91,7 @@"invalidToken": "Este link de confirmação não é válido. Entre abaixo para obter um novo.","userNotFound": "Este link de confirmação pertence a uma conta que não existe mais.","ssoDisabled": "O single sign-on não está disponível nesta instância.",- "passwordDisabled": "Esta instância conecta pessoas apenas pelo seu provedor de identidade."+ "passwordDisabled": "Esta instância conecta pessoas apenas pelo seu provedor de identidade.",+ "accountDeactivated": "Esta conta está desativada. Peça ao seu administrador para restaurá-la."}}diff --git a/apps/web/messages/pt-BR/god.json b/apps/web/messages/pt-BR/god.jsonindex 5e275bdb..4a8d9a2e 100644--- a/apps/web/messages/pt-BR/god.json+++ b/apps/web/messages/pt-BR/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Excluir conta","deleteConfirmWithProjects": "{count, plural, one {Excluir conta e projeto} other {Excluir conta e projetos}}","deleteMessage": "<strong>{name}</strong> perde acesso a esta instância. Issues e comentários que escreveram permanecem, com o autor desatribuído. Isso não pode ser desfeito.",+ "deleteWorkspaceNote": "Um workspace desta conta é excluído com ela se não tiver projetos nem agentes de IA. Caso contrário, ele passa para você, com tudo o que a conta possuía sozinha nele.","soleOwnerTitle": "{count, plural, one {Único dono de um projeto} other {Único dono de # projetos}}","soleOwnerHint": "{count, plural, one {Quando a conta se for, ninguém poderá gerenciá-lo.} other {Quando a conta se for, ninguém poderá gerenciá-los.}}","deleteWithProjects": "{count, plural, one {Excluir o projeto com a conta} other {Excluir os projetos com a conta}}",@@ -159,7 +160,11 @@"saved": "Padrões de projeto salvos","projectDefaults": "Padrões de projeto","mcpEnabled": "Ativar MCP em novos projetos",- "mcpEnabledHint": "Um novo projeto está no alcance de MCP do seu time desde o momento em que é criado."+ "mcpEnabledHint": "Um novo projeto está no alcance de MCP do seu time desde o momento em que é criado.",+ "workspacesSaved": "Configurações de workspace salvas",+ "workspaces": "Workspaces",+ "personalWorkspaces": "Um workspace para cada pessoa",+ "personalWorkspacesHint": "Cada conta recebe um workspace próprio com o nome da pessoa. Desativado, as pessoas trabalham apenas nos workspaces aos quais foram adicionadas."},"authentication": {"saved": "Configurações de autenticação salvas",diff --git a/apps/web/messages/pt-BR/sections.json b/apps/web/messages/pt-BR/sections.jsonindex fd30155e..19d00d49 100644--- a/apps/web/messages/pt-BR/sections.json+++ b/apps/web/messages/pt-BR/sections.json@@ -25,7 +25,7 @@},"general": {"label": "Geral",- "description": "Padrões para novos projetos."+ "description": "Workspaces pessoais e padrões para novos projetos."},"authentication": {"label": "Autenticação",@@ -50,6 +50,10 @@"auth-provider": {"label": "Provedor de autenticação","description": "As contas externas com que as pessoas podem entrar."+ },+ "scim": {+ "label": "SCIM",+ "description": "Permita que um provedor de identidade crie, atualize e desative contas nesta instância e conceda acesso a projetos por seus grupos."}},"settings": {diff --git a/apps/web/messages/pt-BR/shell.json b/apps/web/messages/pt-BR/shell.jsonindex e613609c..6f22dab4 100644--- a/apps/web/messages/pt-BR/shell.json+++ b/apps/web/messages/pt-BR/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Crie sua equipe. Nela ficarão os projetos, os membros e os agentes.","noTeamsMemberHint": "Peça ao proprietário do workspace para adicionar você a uma equipe.","noProjectAccessHint": "Peça ao proprietário ou a um gerente da equipe para adicionar você a um projeto.",+ "noProjectAccessOwnerHint": "Peça ao proprietário ou a um gerente da equipe para adicionar você a um projeto, ou crie seu próprio time.","createTeam": "Criar equipe","noProjectsTitle": "Nenhum projeto ainda","noProjectsHint": "Crie seu primeiro projeto para começar a planejar issues em um quadro.",diff --git a/apps/web/messages/pt-BR/teams.json b/apps/web/messages/pt-BR/teams.jsonindex 4286d4fd..ed89e994 100644--- a/apps/web/messages/pt-BR/teams.json+++ b/apps/web/messages/pt-BR/teams.json@@ -546,7 +546,7 @@"rail": "Workspaces","create": "Novo workspace","createUnavailableTitle": "Mais workspaces",- "createUnavailableHint": "Esta instância tem um workspace. Criar e gerenciar workspaces está disponível no Cloud e no Pro auto-hospedado.",+ "createUnavailableHint": "Mais workspaces por pessoa estão disponíveis no Cloud e no Pro auto-hospedado.","general": "Geral","roles": {"owner": "Proprietário",@@ -558,7 +558,17 @@"workspace": "Workspace","workspaceHint": "O nome que todos veem.","role": "Sua função",- "saved": "Workspace salvo"+ "saved": "Workspace salvo",+ "color": "Cor",+ "colorReset": "Usar padrão"+ },+ "teamCreation": {+ "title": "Quem cria times",+ "description": "Quem cria um time é o dono dele.",+ "ownerOnly": "Só o dono decide quem cria times.",+ "owner": "Só o dono",+ "managers": "O dono e os admins",+ "members": "Todos dos times dele"},"managers": {"title": "Gestores",@@ -583,6 +593,7 @@"saved": "Configurações SCIM salvas","provisioning": "Provisionamento","provisioningConfigured": "Seu provedor de identidade adiciona pessoas a este workspace e as remove.",+ "provisioningInstance": "Seu provedor de identidade cria, atualiza e desativa contas nesta instância.","provisioningMissing": "Gere um token primeiro.","token": "Token","noToken": "Nenhum token gerado ainda",@@ -622,6 +633,14 @@"remove": "Remover projeto","saved": "Acesso do grupo salvo"}+ },+ "delete": {+ "action": "Excluir workspace",+ "hint": "Os times dele são excluídos junto. As pessoas mantêm suas contas e seus outros times.",+ "blocked": "Exclua primeiro os projetos e os agentes de IA dos times dele.",+ "title": "Excluir {name}?",+ "description": "<strong>{name}</strong> e os times dele são excluídos. As pessoas mantêm suas contas e seus outros times. Isso não pode ser desfeito.",+ "deleted": "Workspace excluído"}}}diff --git a/apps/web/messages/ru/auth.json b/apps/web/messages/ru/auth.jsonindex 89b17430..a3f534cc 100644--- a/apps/web/messages/ru/auth.json+++ b/apps/web/messages/ru/auth.json@@ -91,6 +91,7 @@"invalidToken": "Ссылка для подтверждения недействительна. Войдите ниже, чтобы получить новую.","userNotFound": "Ссылка для подтверждения принадлежит аккаунту, которого больше не существует.","ssoDisabled": "Единый вход недоступен на этом сервере.",- "passwordDisabled": "На этом сервере вход выполняется только через поставщика удостоверений."+ "passwordDisabled": "На этом сервере вход выполняется только через поставщика удостоверений.",+ "accountDeactivated": "Учётная запись отключена. Обратитесь к администратору."}}diff --git a/apps/web/messages/ru/god.json b/apps/web/messages/ru/god.jsonindex 81751dff..84dfb50f 100644--- a/apps/web/messages/ru/god.json+++ b/apps/web/messages/ru/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Удалить аккаунт","deleteConfirmWithProjects": "{count, plural, one {Удалить аккаунт и проект} other {Удалить аккаунт и проекты}}","deleteMessage": "<strong>{name}</strong> потеряет доступ к этому инстансу. Задачи и комментарии, которые он написал, останутся, но без автора. Это нельзя отменить.",+ "deleteWorkspaceNote": "Воркспейс этого аккаунта удаляется вместе с ним, если в нём нет проектов и AI-агентов. Иначе он переходит к вам вместе со всем, чем аккаунт владел там один.","soleOwnerTitle": "{count, plural, one {Единственный владелец проекта} other {Единственный владелец # проектов}}","soleOwnerHint": "{count, plural, one {Как только аккаунт исчезнет, управлять им не сможет никто.} other {Как только аккаунт исчезнет, управлять ими не сможет никто.}}","deleteWithProjects": "{count, plural, one {Удалить проект вместе с аккаунтом} other {Удалить проекты вместе с аккаунтом}}",@@ -159,7 +160,11 @@"saved": "Настройки по умолчанию сохранены","projectDefaults": "Настройки по умолчанию","mcpEnabled": "Включать MCP в новых проектах",- "mcpEnabledHint": "Новый проект попадает в охват MCP своей команды сразу при создании."+ "mcpEnabledHint": "Новый проект попадает в охват MCP своей команды сразу при создании.",+ "workspacesSaved": "Настройки воркспейсов сохранены",+ "workspaces": "Воркспейсы",+ "personalWorkspaces": "Воркспейс для каждого",+ "personalWorkspacesHint": "Каждый аккаунт получает свой воркспейс с именем человека. Если выключено, люди работают только в воркспейсах, куда их добавили."},"authentication": {"saved": "Настройки аутентификации сохранены",diff --git a/apps/web/messages/ru/sections.json b/apps/web/messages/ru/sections.jsonindex b40507cd..7b7dbfdc 100644--- a/apps/web/messages/ru/sections.json+++ b/apps/web/messages/ru/sections.json@@ -25,7 +25,7 @@},"general": {"label": "Общее",- "description": "Настройки по умолчанию для новых проектов."+ "description": "Свои воркспейсы и настройки по умолчанию для новых проектов."},"authentication": {"label": "Аутентификация",@@ -50,6 +50,10 @@"auth-provider": {"label": "Провайдер входа","description": "Внешние аккаунты, через которые можно входить."+ },+ "scim": {+ "label": "SCIM",+ "description": "Позвольте поставщику удостоверений создавать, обновлять и отключать учётные записи на этом сервере и давать доступ к проектам через свои группы."}},"settings": {diff --git a/apps/web/messages/ru/shell.json b/apps/web/messages/ru/shell.jsonindex 33c2710e..23950f03 100644--- a/apps/web/messages/ru/shell.json+++ b/apps/web/messages/ru/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Создайте свою команду. В ней будут её проекты, участники и агенты.","noTeamsMemberHint": "Попросите владельца воркспейса добавить вас в команду.","noProjectAccessHint": "Попросите владельца или менеджера команды добавить вас в проект.",+ "noProjectAccessOwnerHint": "Попросите владельца или менеджера команды добавить вас в проект или создайте свою команду.","createTeam": "Создать команду","noProjectsTitle": "Проектов пока нет","noProjectsHint": "Создайте первый проект, чтобы планировать задачи на доске.",diff --git a/apps/web/messages/ru/teams.json b/apps/web/messages/ru/teams.jsonindex e40a5931..65d6bb03 100644--- a/apps/web/messages/ru/teams.json+++ b/apps/web/messages/ru/teams.json@@ -546,7 +546,7 @@"rail": "Воркспейсы","create": "Новый воркспейс","createUnavailableTitle": "Больше воркспейсов",- "createUnavailableHint": "В этом инстансе один воркспейс. Создание воркспейсов и управление ими доступны в Cloud и в Pro-версии для своего сервера.",+ "createUnavailableHint": "Больше воркспейсов на человека доступно в Cloud и в Pro-версии для своего сервера.","general": "Общие","roles": {"owner": "Владелец",@@ -558,7 +558,17 @@"workspace": "Воркспейс","workspaceHint": "Название, которое видят все.","role": "Ваша роль",- "saved": "Воркспейс сохранён"+ "saved": "Воркспейс сохранён",+ "color": "Цвет",+ "colorReset": "По умолчанию"+ },+ "teamCreation": {+ "title": "Кто создаёт команды",+ "description": "Кто создал команду, тот и её владелец.",+ "ownerOnly": "Кто создаёт команды, решает только владелец.",+ "owner": "Только владелец",+ "managers": "Владелец и администраторы",+ "members": "Все, кто в его командах"},"managers": {"title": "Управляющие",@@ -583,6 +593,7 @@"saved": "Настройки SCIM сохранены","provisioning": "Подготовка учётных записей","provisioningConfigured": "Ваш поставщик удостоверений добавляет людей в этот воркспейс и убирает их.",+ "provisioningInstance": "Ваш поставщик удостоверений создаёт, обновляет и отключает учётные записи на этом сервере.","provisioningMissing": "Сначала создайте токен.","token": "Токен","noToken": "Токен ещё не создан",@@ -622,6 +633,14 @@"remove": "Убрать проект","saved": "Доступ группы сохранён"}+ },+ "delete": {+ "action": "Удалить воркспейс",+ "hint": "Его команды удалятся вместе с ним. Люди сохранят свои аккаунты и другие команды.",+ "blocked": "Сначала удалите проекты и AI-агентов его команд.",+ "title": "Удалить {name}?",+ "description": "<strong>{name}</strong> и его команды будут удалены. Люди сохранят свои аккаунты и другие команды. Это нельзя отменить.",+ "deleted": "Воркспейс удалён"}}}diff --git a/apps/web/messages/uk/auth.json b/apps/web/messages/uk/auth.jsonindex db8b87ad..226ef769 100644--- a/apps/web/messages/uk/auth.json+++ b/apps/web/messages/uk/auth.json@@ -91,6 +91,7 @@"invalidToken": "Посилання для підтвердження недійсне. Увійдіть нижче, щоб отримати нове.","userNotFound": "Посилання для підтвердження належить акаунту, якого більше не існує.","ssoDisabled": "Єдиний вхід недоступний на цьому сервері.",- "passwordDisabled": "На цьому сервері вхід виконується лише через постачальника ідентифікації."+ "passwordDisabled": "На цьому сервері вхід виконується лише через постачальника ідентифікації.",+ "accountDeactivated": "Обліковий запис вимкнено. Зверніться до адміністратора."}}diff --git a/apps/web/messages/uk/god.json b/apps/web/messages/uk/god.jsonindex c66be942..36265262 100644--- a/apps/web/messages/uk/god.json+++ b/apps/web/messages/uk/god.json@@ -57,6 +57,7 @@"deleteConfirm": "Видалити акаунт","deleteConfirmWithProjects": "{count, plural, one {Видалити акаунт і проєкт} other {Видалити акаунт і проєкти}}","deleteMessage": "<strong>{name}</strong> втратить доступ до цього інстансу. Задачі та коментарі, які він написав, залишаться, але без автора. Це не можна скасувати.",+ "deleteWorkspaceNote": "Воркспейс цього акаунта видаляється разом із ним, якщо в ньому немає проєктів і AI-агентів. Інакше він переходить до вас разом з усім, чим акаунт володів там один.","soleOwnerTitle": "{count, plural, one {Єдиний власник проєкту} other {Єдиний власник # проєктів}}","soleOwnerHint": "{count, plural, one {Щойно акаунт зникне, ним не зможе керувати ніхто.} other {Щойно акаунт зникне, ними не зможе керувати ніхто.}}","deleteWithProjects": "{count, plural, one {Видалити проєкт разом з акаунтом} other {Видалити проєкти разом з акаунтом}}",@@ -159,7 +160,11 @@"saved": "Налаштування за замовчуванням збережено","projectDefaults": "Налаштування за замовчуванням","mcpEnabled": "Вмикати MCP у нових проєктах",- "mcpEnabledHint": "Новий проєкт потрапляє в охоплення MCP своєї команди одразу при створенні."+ "mcpEnabledHint": "Новий проєкт потрапляє в охоплення MCP своєї команди одразу при створенні.",+ "workspacesSaved": "Налаштування воркспейсів збережено",+ "workspaces": "Воркспейси",+ "personalWorkspaces": "Воркспейс для кожного",+ "personalWorkspacesHint": "Кожен акаунт отримує свій воркспейс з ім'ям людини. Якщо вимкнено, люди працюють лише у воркспейсах, до яких їх додали."},"authentication": {"saved": "Налаштування автентифікації збережено",diff --git a/apps/web/messages/uk/sections.json b/apps/web/messages/uk/sections.jsonindex dbfabe72..3b05ab5d 100644--- a/apps/web/messages/uk/sections.json+++ b/apps/web/messages/uk/sections.json@@ -25,7 +25,7 @@},"general": {"label": "Загальне",- "description": "Налаштування за замовчуванням для нових проєктів."+ "description": "Власні воркспейси та налаштування за замовчуванням для нових проєктів."},"authentication": {"label": "Автентифікація",@@ -50,6 +50,10 @@"auth-provider": {"label": "Провайдер входу","description": "Зовнішні акаунти, через які можна входити."+ },+ "scim": {+ "label": "SCIM",+ "description": "Дозвольте постачальнику ідентифікації створювати, оновлювати та вимикати облікові записи на цьому сервері й надавати доступ до проєктів через свої групи."}},"settings": {diff --git a/apps/web/messages/uk/shell.json b/apps/web/messages/uk/shell.jsonindex 0df57ca3..4d7ed3df 100644--- a/apps/web/messages/uk/shell.json+++ b/apps/web/messages/uk/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "Створіть свою команду. У ній будуть її проєкти, учасники та агенти.","noTeamsMemberHint": "Попросіть власника воркспейсу додати вас до команди.","noProjectAccessHint": "Попросіть власника або менеджера команди додати вас до проєкту.",+ "noProjectAccessOwnerHint": "Попросіть власника або менеджера команди додати вас до проєкту або створіть власну команду.","createTeam": "Створити команду","noProjectsTitle": "Проєктів ще немає","noProjectsHint": "Створіть перший проєкт, щоб планувати задачі на дошці.",diff --git a/apps/web/messages/uk/teams.json b/apps/web/messages/uk/teams.jsonindex 9ddab267..85513ce8 100644--- a/apps/web/messages/uk/teams.json+++ b/apps/web/messages/uk/teams.json@@ -546,7 +546,7 @@"rail": "Воркспейси","create": "Новий воркспейс","createUnavailableTitle": "Більше воркспейсів",- "createUnavailableHint": "У цьому інстансі один воркспейс. Створення воркспейсів і керування ними доступні в Cloud і в Pro-версії для власного сервера.",+ "createUnavailableHint": "Більше воркспейсів на людину доступно в Cloud і в Pro-версії для власного сервера.","general": "Загальні","roles": {"owner": "Власник",@@ -558,7 +558,17 @@"workspace": "Воркспейс","workspaceHint": "Назва, яку бачать усі.","role": "Ваша роль",- "saved": "Воркспейс збережено"+ "saved": "Воркспейс збережено",+ "color": "Колір",+ "colorReset": "За замовчуванням"+ },+ "teamCreation": {+ "title": "Хто створює команди",+ "description": "Хто створив команду, той і її власник.",+ "ownerOnly": "Хто створює команди, вирішує лише власник.",+ "owner": "Лише власник",+ "managers": "Власник і адміністратори",+ "members": "Усі, хто в його командах"},"managers": {"title": "Керівники",@@ -583,6 +593,7 @@"saved": "Налаштування SCIM збережено","provisioning": "Підготовка облікових записів","provisioningConfigured": "Ваш постачальник ідентифікації додає людей до цього воркспейсу та прибирає їх.",+ "provisioningInstance": "Ваш постачальник ідентифікації створює, оновлює та вимикає облікові записи на цьому сервері.","provisioningMissing": "Спочатку створіть токен.","token": "Токен","noToken": "Токен ще не створено",@@ -622,6 +633,14 @@"remove": "Прибрати проєкт","saved": "Доступ групи збережено"}+ },+ "delete": {+ "action": "Видалити воркспейс",+ "hint": "Його команди видаляться разом із ним. Люди збережуть свої акаунти та інші команди.",+ "blocked": "Спершу видаліть проєкти та AI-агентів його команд.",+ "title": "Видалити {name}?",+ "description": "<strong>{name}</strong> і його команди буде видалено. Люди збережуть свої акаунти та інші команди. Це не можна скасувати.",+ "deleted": "Воркспейс видалено"}}}diff --git a/apps/web/messages/zh-CN/auth.json b/apps/web/messages/zh-CN/auth.jsonindex b1326bde..c3522c9a 100644--- a/apps/web/messages/zh-CN/auth.json+++ b/apps/web/messages/zh-CN/auth.json@@ -91,6 +91,7 @@"invalidToken": "此验证链接无效。请在下方登录以获取新链接。","userNotFound": "此验证链接对应的账户已不存在。","ssoDisabled": "此实例未启用单点登录。",- "passwordDisabled": "此实例仅通过身份提供方登录。"+ "passwordDisabled": "此实例仅通过身份提供方登录。",+ "accountDeactivated": "该账号已停用,请联系管理员恢复。"}}diff --git a/apps/web/messages/zh-CN/god.json b/apps/web/messages/zh-CN/god.jsonindex ad27c207..936fe03f 100644--- a/apps/web/messages/zh-CN/god.json+++ b/apps/web/messages/zh-CN/god.json@@ -57,6 +57,7 @@"deleteConfirm": "删除账户","deleteConfirmWithProjects": "{count, plural, other {删除账户和项目}}","deleteMessage": "<strong>{name}</strong> 将无法访问此实例。该用户创建的工作项和评论会保留,但作者将被取消关联。此操作无法撤销。",+ "deleteWorkspaceNote": "该账户拥有的工作区若没有项目和 AI 代理,会随账户一起删除;否则将转给你,连同该账户在其中单独拥有的一切。","soleOwnerTitle": "{count, plural, other {# 个项目的唯一所有者}}","soleOwnerHint": "{count, plural, other {账户删除后,将无人能够管理这些项目。}}","deleteWithProjects": "{count, plural, other {同时删除这些项目}}",@@ -159,7 +160,11 @@"saved": "项目默认设置已保存","projectDefaults": "项目默认设置","mcpEnabled": "新项目默认启用 MCP",- "mcpEnabledHint": "新项目创建时即纳入所属团队的 MCP 覆盖范围。"+ "mcpEnabledHint": "新项目创建时即纳入所属团队的 MCP 覆盖范围。",+ "workspacesSaved": "工作区设置已保存",+ "workspaces": "工作区",+ "personalWorkspaces": "每人一个工作区",+ "personalWorkspacesHint": "每个账户都会获得一个以其姓名命名的专属工作区。关闭后,成员只能在被添加到的工作区中工作。"},"authentication": {"saved": "身份验证设置已保存",diff --git a/apps/web/messages/zh-CN/sections.json b/apps/web/messages/zh-CN/sections.jsonindex d923a4db..e3a02ce3 100644--- a/apps/web/messages/zh-CN/sections.json+++ b/apps/web/messages/zh-CN/sections.json@@ -25,7 +25,7 @@},"general": {"label": "通用",- "description": "新建项目的默认设置。"+ "description": "个人工作区和新建项目的默认设置。"},"authentication": {"label": "身份验证",@@ -50,6 +50,10 @@"auth-provider": {"label": "身份验证提供商","description": "设置用户可以用于登录的外部账户。"+ },+ "scim": {+ "label": "SCIM",+ "description": "让身份提供方在此实例上创建、更新和停用账号,并通过其群组授予项目访问权限。"}},"settings": {diff --git a/apps/web/messages/zh-CN/shell.json b/apps/web/messages/zh-CN/shell.jsonindex 4e7d3e24..963235fa 100644--- a/apps/web/messages/zh-CN/shell.json+++ b/apps/web/messages/zh-CN/shell.json@@ -6,6 +6,7 @@"noTeamsHint": "创建你的团队。团队的项目、成员和智能体都在其中。","noTeamsMemberHint": "请工作区所有者将你添加到团队中。","noProjectAccessHint": "请团队所有者或管理员将你添加到项目中。",+ "noProjectAccessOwnerHint": "请团队所有者或管理员将你添加到项目中,或创建你自己的团队。","createTeam": "创建团队","noProjectsTitle": "暂无项目","noProjectsHint": "新建第一个项目,然后开始在看板中规划工作项。",diff --git a/apps/web/messages/zh-CN/teams.json b/apps/web/messages/zh-CN/teams.jsonindex b958f641..dbd15333 100644--- a/apps/web/messages/zh-CN/teams.json+++ b/apps/web/messages/zh-CN/teams.json@@ -546,7 +546,7 @@"rail": "工作区","create": "新建工作区","createUnavailableTitle": "更多工作区",- "createUnavailableHint": "此实例只有一个工作区。创建和管理工作区可在 Cloud 和自托管 Pro 版中使用。",+ "createUnavailableHint": "每人拥有多个工作区的功能可在 Cloud 和自托管 Pro 版中使用。","general": "常规","roles": {"owner": "所有者",@@ -558,7 +558,17 @@"workspace": "工作区","workspaceHint": "所有人都能看到的名称。","role": "你的角色",- "saved": "工作区已保存"+ "saved": "工作区已保存",+ "color": "颜色",+ "colorReset": "恢复默认"+ },+ "teamCreation": {+ "title": "谁可以创建团队",+ "description": "创建团队的人即为其所有者。",+ "ownerOnly": "只有所有者可以决定谁能创建团队。",+ "owner": "仅所有者",+ "managers": "所有者和管理员",+ "members": "其团队中的所有人"},"managers": {"title": "管理者",@@ -583,6 +593,7 @@"saved": "SCIM 设置已保存","provisioning": "账号预配","provisioningConfigured": "身份提供方会将成员加入此工作区或将其移出。",+ "provisioningInstance": "身份提供方会在此实例上创建、更新和停用账号。","provisioningMissing": "请先生成令牌。","token": "令牌","noToken": "尚未生成令牌",@@ -622,6 +633,14 @@"remove": "移除项目","saved": "群组权限已保存"}+ },+ "delete": {+ "action": "删除工作区",+ "hint": "其中的团队会一并删除。成员会保留自己的账户和其他团队。",+ "blocked": "请先删除其团队中的项目和 AI 代理。",+ "title": "删除 {name}?",+ "description": "<strong>{name}</strong> 及其团队将被删除。成员会保留自己的账户和其他团队。此操作无法撤销。",+ "deleted": "工作区已删除"}}}diff --git a/apps/web/src/app/god/[section]/page.tsx b/apps/web/src/app/god/[section]/page.tsxnew file mode 100644index 00000000..151b18ac--- /dev/null+++ b/apps/web/src/app/god/[section]/page.tsx@@ -0,0 +1,9 @@+'use client';++import { useParams } from 'next/navigation';+import GodExtraSectionPage from '@/features/god/GodExtraSectionPage';++export default function Page() {+ const { section } = useParams<{ section: string }>();+ return <GodExtraSectionPage slug={section} />;+}diff --git a/apps/web/src/app/god/scim/page.tsx b/apps/web/src/app/god/scim/page.tsxnew file mode 100644index 00000000..a474845d--- /dev/null+++ b/apps/web/src/app/god/scim/page.tsx@@ -0,0 +1,5 @@+import GodScimPage from '@/features/god/GodScimPage';++export default function Page() {+ return <GodScimPage />;+}diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsxindex 323344f7..f4262bf4 100644--- a/apps/web/src/app/page.tsx+++ b/apps/web/src/app/page.tsx@@ -19,9 +19,9 @@ import StartEmpty from '@/components/layout/StartEmpty';// first visible favorite or project, on the user's preferred start page. Waits for both// the project list and the preferences before deciding so it does not flash the// wrong destination. With no projects at all, an account that owns or manages a team-// is offered to create the first one there. The owner of a workspace is offered to create-// a team in it, an account with no team and no workspace it owns gets `NoTeamStart`, and a-// team member is told who adds them to a project.+// is offered to create the first one there. An account that may create a team in a+// workspace, its own first, is offered to; one with no team and nowhere to create one gets+// `NoTeamStart`, and a team member is told who adds them to a project.export default function Home() {const t = useTranslations('shell');const tCommon = useTranslations('common');@@ -46,20 +46,25 @@ export default function Home() {}const managedTeam = teams?.find((one) => one.role !== 'member');- const ownedWorkspace = workspaces?.find((one) => one.role === 'owner');+ const teamWorkspace =+ workspaces?.find((one) => one.role === 'owner') ?? workspaces?.find((one) => one.canCreateTeam);if (teams && workspaces && !managedTeam && projects?.length === 0) {- if (teams.length === 0 && !ownedWorkspace) return <NoTeamStart />;+ if (teams.length === 0 && !teamWorkspace) return <NoTeamStart />;return (<StartEmptyicon={<Users />}title={teams.length === 0 ? t('noTeamsTitle') : t('noProjectsTitle')}- hint={teams.length === 0 ? t('noTeamsHint') : t('noProjectAccessHint')}- action={ownedWorkspace && t('createTeam')}+ hint={+ teams.length === 0+ ? t('noTeamsHint')+ : t(teamWorkspace ? 'noProjectAccessOwnerHint' : 'noProjectAccessHint')+ }+ action={teamWorkspace && t('createTeam')}onAction={() => setCreating(true)}>- {creating && ownedWorkspace && (- <NewTeamModal workspaceId={ownedWorkspace.id} onClose={() => setCreating(false)} />+ {creating && teamWorkspace && (+ <NewTeamModal workspaceId={teamWorkspace.id} onClose={() => setCreating(false)} />)}</StartEmpty>);diff --git a/apps/web/src/app/workspaces/[workspaceId]/scim/page.tsx b/apps/web/src/app/workspaces/[workspaceId]/scim/page.tsxdeleted file mode 100644index cae87832..00000000--- a/apps/web/src/app/workspaces/[workspaceId]/scim/page.tsx+++ /dev/null@@ -1,9 +0,0 @@-'use client';--import WorkspaceScimSection from '@/features/teams/components/workspace/scim/WorkspaceScimSection';-import { useRouteWorkspaceId } from '@/features/teams/hooks/useRouteWorkspaceId';--export default function Page() {- const workspaceId = useRouteWorkspaceId();- return workspaceId !== null && <WorkspaceScimSection workspaceId={workspaceId} />;-}diff --git a/apps/web/src/ce/GodSectionExtras.tsx b/apps/web/src/ce/GodSectionExtras.tsxnew file mode 100644index 00000000..85ec0334--- /dev/null+++ b/apps/web/src/ce/GodSectionExtras.tsx@@ -0,0 +1,7 @@+'use client';++// Below the content of a god mode section. A self-hosted instance adds nothing; the+// hosted build renders its own settings into an existing section by its slug.+export default function GodSectionExtras(_props: { slug: string }) {+ return null;+}diff --git a/apps/web/src/ce/NoTeamStart.tsx b/apps/web/src/ce/NoTeamStart.tsxindex 09d23ef4..049bff15 100644--- a/apps/web/src/ce/NoTeamStart.tsx+++ b/apps/web/src/ce/NoTeamStart.tsx@@ -1,9 +1,11 @@+'use client';+import { Users } from 'lucide-react';import { useTranslations } from 'next-intl';import StartEmpty from '@/components/layout/StartEmpty';-// The start page of an account with no team and no workspace it owns. Here a workspace-// owner adds people to teams; the hosted build offers to create a workspace instead.+// The start page of an account with no team and no workspace it owns, which happens while+// personal workspaces are off: a workspace owner adds people to teams.export default function NoTeamStart() {const t = useTranslations('shell');return <StartEmpty icon={<Users />} title={t('noTeamsTitle')} hint={t('noTeamsMemberHint')} />;diff --git a/apps/web/src/ce/WorkspaceRailActions.tsx b/apps/web/src/ce/WorkspaceRailActions.tsxindex 2f0c8627..cee37e3d 100644--- a/apps/web/src/ce/WorkspaceRailActions.tsx+++ b/apps/web/src/ce/WorkspaceRailActions.tsx@@ -4,8 +4,9 @@ import { workspaceTileClass } from '@/components/layout/utils/workspaceTile';import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';-// Below the workspace tiles of a rail. A self-hosted instance has one workspace, so the-// button says where more are available; the hosted build creates a workspace instead.+// Below the workspace tiles of a rail. On a self-hosted instance a person owns one+// workspace, made at sign-up, so the button says where more are available; the hosted+// build creates a workspace instead.export default function WorkspaceRailActions() {const t = useTranslations('teams.workspace');diff --git a/apps/web/src/ce/WorkspaceSectionExtras.tsx b/apps/web/src/ce/WorkspaceSectionExtras.tsxnew file mode 100644index 00000000..7dbee80c--- /dev/null+++ b/apps/web/src/ce/WorkspaceSectionExtras.tsx@@ -0,0 +1,11 @@+'use client';++import type { Workspace } from '@/lib/api/endpoints/workspaces';++// Below the content of a workspace settings page, by its slug ('general', 'managers'). A+// self-hosted instance adds nothing; the hosted build renders its own settings into an+// existing page, with controls that save themselves, since the page's Save covers only+// its own fields.+export default function WorkspaceSectionExtras(_props: { slug: string; workspace: Workspace }) {+ return null;+}diff --git a/apps/web/src/ce/godSections.ts b/apps/web/src/ce/godSections.tsnew file mode 100644index 00000000..65acd565--- /dev/null+++ b/apps/web/src/ce/godSections.ts@@ -0,0 +1,8 @@+import type { GodSection } from '@/utils/godSections';++// A self-hosted instance lists the core's god mode sections as they are. The hosted+// build returns them with its own added, such as billing, or with one replaced or left+// out.+export default function godSections(core: GodSection[]): GodSection[] {+ return core;+}diff --git a/apps/web/src/ce/index.ts b/apps/web/src/ce/index.tsindex fbad4b63..25f853e1 100644--- a/apps/web/src/ce/index.ts+++ b/apps/web/src/ce/index.ts@@ -1,6 +1,10 @@// What the `@/cloud` alias resolves to in this repository: the stubs a self-hosted// instance runs. The hosted build points the alias at its own module exporting the// same names, so a cloud-only part is imported from here and nowhere else.+export { default as GodSectionExtras } from './GodSectionExtras';+export { default as godSections } from './godSections';+export { cloudMessages, loadCloudMessages } from './messages';export { default as NoTeamStart } from './NoTeamStart';export { default as useWorkspaceSections } from './useWorkspaceSections';export { default as WorkspaceRailActions } from './WorkspaceRailActions';+export { default as WorkspaceSectionExtras } from './WorkspaceSectionExtras';diff --git a/apps/web/src/ce/messages.ts b/apps/web/src/ce/messages.tsnew file mode 100644index 00000000..64da6029--- /dev/null+++ b/apps/web/src/ce/messages.ts@@ -0,0 +1,11 @@+import type { Locale } from '@/i18n/locales';+import type { MessageTree } from '@/i18n/messages';++// The messages the hosted build adds: `cloudMessages` is its English, merged into the+// catalogue the keys are typed against, and `loadCloudMessages` returns the same keys in+// another language. A self-hosted instance adds none.+export const cloudMessages = {};++export async function loadCloudMessages(_locale: Locale): Promise<MessageTree> {+ return {};+}diff --git a/apps/web/src/components/layout/ProjectSwitcherWorkspaceRail.tsx b/apps/web/src/components/layout/ProjectSwitcherWorkspaceRail.tsxindex 7c66eea7..da6a2eb7 100644--- a/apps/web/src/components/layout/ProjectSwitcherWorkspaceRail.tsx+++ b/apps/web/src/components/layout/ProjectSwitcherWorkspaceRail.tsx@@ -2,7 +2,7 @@ import { useTranslations } from 'next-intl';import { WorkspaceRailActions } from '@/cloud';import type { WorkspaceSummary } from '@/lib/api/endpoints/workspaces';import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';-import { workspaceInitial, workspaceTileClass } from './utils/workspaceTile';+import { workspaceInitial, workspaceTileClass, workspaceTileStyle } from './utils/workspaceTile';export default function ProjectSwitcherWorkspaceRail({workspaces,@@ -32,6 +32,7 @@ export default function ProjectSwitcherWorkspaceRail({aria-pressed={active}onClick={() => onPick(workspace.id)}className={workspaceTileClass(active)}+ style={workspaceTileStyle(workspace.color)}>{workspaceInitial(workspace.name)}</button>diff --git a/apps/web/src/components/layout/StartEmpty.tsx b/apps/web/src/components/layout/StartEmpty.tsxindex b616f348..2160714b 100644--- a/apps/web/src/components/layout/StartEmpty.tsx+++ b/apps/web/src/components/layout/StartEmpty.tsx@@ -1,6 +1,9 @@import type { ReactNode } from 'react';import { Plus } from 'lucide-react';import { Button } from '@/components/ui/button';+import { LocaleToggle } from '@/components/locale-toggle';+import { ThemeToggle } from '@/components/theme-toggle';+import UserMenu from '@/components/layout/UserMenu';import {Empty,EmptyContent,@@ -11,6 +14,8 @@ import {} from '@/components/ui/empty';// A full-screen empty state for the start page before the account has a team or a project.+// The start page has no shell, so it carries the header controls: signing out and the+// language stay within reach of somebody waiting to be added to a team.export default function StartEmpty({icon,title,@@ -27,7 +32,12 @@ export default function StartEmpty({children?: ReactNode;}) {return (- <div className="flex h-svh items-center justify-center p-6">+ <div className="relative flex h-svh items-center justify-center p-6">+ <div className="absolute top-3 right-4 flex items-center gap-1">+ <LocaleToggle />+ <ThemeToggle />+ <UserMenu />+ </div><Empty className="max-w-md"><EmptyHeader><EmptyMedia variant="icon">{icon}</EmptyMedia>diff --git a/apps/web/src/components/layout/utils/workspaceTile.ts b/apps/web/src/components/layout/utils/workspaceTile.tsindex a2f4498d..37187629 100644--- a/apps/web/src/components/layout/utils/workspaceTile.ts+++ b/apps/web/src/components/layout/utils/workspaceTile.ts@@ -9,3 +9,6 @@ export const workspaceTileClass = (active: boolean) =>);export const workspaceInitial = (name: string) => [...name.trim()][0]?.toUpperCase();++export const workspaceTileStyle = (color: string | null) =>+ color ? { backgroundColor: color, color: '#fff' } : undefined;diff --git a/apps/web/src/features/auth/hooks/useRedirectError.ts b/apps/web/src/features/auth/hooks/useRedirectError.tsindex 01f19531..46a11e93 100644--- a/apps/web/src/features/auth/hooks/useRedirectError.ts+++ b/apps/web/src/features/auth/hooks/useRedirectError.ts@@ -18,6 +18,7 @@ const MESSAGE_KEYS = {signup_disabled: 'signupDisabled',OIDC_DISABLED: 'ssoDisabled',PASSWORD_AUTH_DISABLED: 'passwordDisabled',+ ACCOUNT_DEACTIVATED: 'accountDeactivated',email_not_found: 'emailNotFound',// The confirmation link failed. better-auth redirects with these uppercase codes.TOKEN_EXPIRED: 'tokenExpired',diff --git a/apps/web/src/features/god/GodExtraSectionPage.tsx b/apps/web/src/features/god/GodExtraSectionPage.tsxnew file mode 100644index 00000000..ae928117--- /dev/null+++ b/apps/web/src/features/god/GodExtraSectionPage.tsx@@ -0,0 +1,11 @@+'use client';++import { notFound } from 'next/navigation';+import { GOD_SECTIONS } from '@/utils/godSections';++// A god mode section without a route of its own: one the hosted build adds.+export default function GodExtraSectionPage({ slug }: { slug: string }) {+ const section = GOD_SECTIONS.find((entry) => entry.slug === slug);+ if (!section?.Component) notFound();+ return <section.Component />;+}diff --git a/apps/web/src/features/god/GodGeneralPage.tsx b/apps/web/src/features/god/GodGeneralPage.tsxindex 2af0699e..75399acb 100644--- a/apps/web/src/features/god/GodGeneralPage.tsx+++ b/apps/web/src/features/god/GodGeneralPage.tsx@@ -9,26 +9,39 @@ import { Switch } from '@/components/ui/switch';import GodSectionPage from './components/GodSectionPage';import GodSettingsGate from './components/GodSettingsGate';import {+ useInstanceAuthSettingsQuery,useInstanceProjectDefaultsQuery,+ useUpdateInstanceAuthSettings,useUpdateInstanceProjectDefaults,} from './services/god.service';+import type { InstanceAuthSettings } from '@/lib/api/endpoints/god';import type { ProjectDefaults } from '@/lib/api/endpoints/projects';export default function GodGeneralPage() {- const query = useInstanceProjectDefaultsQuery();+ const defaults = useInstanceProjectDefaultsQuery().data;+ const auth = useInstanceAuthSettingsQuery().data;return (- <GodSettingsGate slug="general" data={query.data}>- {(defaults) => <GeneralForm defaults={defaults} />}+ <GodSettingsGate slug="general" data={defaults && auth ? { defaults, auth } : undefined}>+ {(data) => <GeneralForm {...data} />}</GodSettingsGate>);}-function GeneralForm({ defaults }: { defaults: ProjectDefaults }) {+// Personal workspaces are stored with the auth settings, because sign-up reads them;+// the switch sits here, since it is about how people work, not how they sign in.+function GeneralForm({+ defaults,+ auth,+}: {+ defaults: ProjectDefaults;+ auth: InstanceAuthSettings;+}) {const t = useTranslations('god.general');const update = useUpdateInstanceProjectDefaults();+ const updateAuth = useUpdateInstanceAuthSettings();- // A single toggle, so it saves on change rather than behind a Save button.+ // Single toggles, so each saves on change rather than behind a Save button.async function setMcpEnabled(mcpEnabled: boolean) {try {await update.mutateAsync({ ...defaults, mcpEnabled });@@ -38,23 +51,50 @@ function GeneralForm({ defaults }: { defaults: ProjectDefaults }) {}}+ async function setPersonalWorkspaces(personalWorkspaces: boolean) {+ try {+ await updateAuth.mutateAsync({ personalWorkspaces });+ toast.success(t('workspacesSaved'));+ } catch {+ // The failure already surfaced through the global mutation error toast.+ }+ }+return (<GodSectionPage slug="general">- <SettingsSection title={t('projectDefaults')}>- <SettingsCard>- <SettingsRow- title={t('mcpEnabled')}- description={t('mcpEnabledHint')}- control={- <Switch- checked={defaults.mcpEnabled}- disabled={update.isPending}- onCheckedChange={(checked) => void setMcpEnabled(checked)}- />- }- />- </SettingsCard>- </SettingsSection>+ <div className="space-y-10">+ <SettingsSection title={t('workspaces')}>+ <SettingsCard>+ <SettingsRow+ title={t('personalWorkspaces')}+ description={t('personalWorkspacesHint')}+ control={+ <Switch+ checked={auth.personalWorkspaces}+ disabled={updateAuth.isPending}+ onCheckedChange={(checked) => void setPersonalWorkspaces(checked)}+ />+ }+ />+ </SettingsCard>+ </SettingsSection>++ <SettingsSection title={t('projectDefaults')}>+ <SettingsCard>+ <SettingsRow+ title={t('mcpEnabled')}+ description={t('mcpEnabledHint')}+ control={+ <Switch+ checked={defaults.mcpEnabled}+ disabled={update.isPending}+ onCheckedChange={(checked) => void setMcpEnabled(checked)}+ />+ }+ />+ </SettingsCard>+ </SettingsSection>+ </div></GodSectionPage>);}diff --git a/apps/web/src/features/god/GodScimPage.tsx b/apps/web/src/features/god/GodScimPage.tsxnew file mode 100644index 00000000..86a4383b--- /dev/null+++ b/apps/web/src/features/god/GodScimPage.tsx@@ -0,0 +1,33 @@+'use client';++import { useWorkspaceScimQuery, useWorkspacesQuery } from '@/services/workspaces.service';+import ListSkeleton from '@/components/common/skeleton/ListSkeleton';+import WorkspaceScimSettings from '@/features/teams/components/workspace/scim/WorkspaceScimSettings';+import GodSectionPage from './components/GodSectionPage';++// SCIM provisioning reaches past a workspace to the whole instance, so only the instance+// owner sets it up, for the instance workspace (the API holds the same rule). That is the+// first workspace, as `instanceWorkspaceId` in @repo/db has it, and the owner sees it+// among theirs. The switch and the token act on their own, so there is no page-level Save.+export default function GodScimPage() {+ const workspaces = useWorkspacesQuery().data;++ return (+ <GodSectionPage slug="scim">+ {workspaces?.length ? (+ <InstanceScim workspaceId={Math.min(...workspaces.map((entry) => entry.id))} />+ ) : (+ <ListSkeleton rows={5} rowClassName="h-12" />+ )}+ </GodSectionPage>+ );+}++function InstanceScim({ workspaceId }: { workspaceId: number }) {+ const settings = useWorkspaceScimQuery(workspaceId).data;+ return settings ? (+ <WorkspaceScimSettings workspaceId={workspaceId} settings={settings} instance />+ ) : (+ <ListSkeleton rows={5} rowClassName="h-12" />+ );+}diff --git a/apps/web/src/features/god/components/GodSectionPage.tsx b/apps/web/src/features/god/components/GodSectionPage.tsxindex fafe9dfb..86a5e579 100644--- a/apps/web/src/features/god/components/GodSectionPage.tsx+++ b/apps/web/src/features/god/components/GodSectionPage.tsx@@ -1,10 +1,12 @@import type { ReactNode } from 'react';+import { GodSectionExtras } from '@/cloud';import { useGodSectionText } from '@/hooks/useSectionLabels';import SectionPageView from '@/components/common/page/SectionPageView';// The chrome shared by every god section page: title and description taken from the-// section entry. The directory pages pass a `widthClassName` that spans the whole-// shell, because their tables are wide.+// section entry, and below the content what the hosted build adds to the section. The+// directory pages pass a `widthClassName` that spans the whole shell, because their+// tables are wide.export default function GodSectionPage({slug,actions,@@ -25,6 +27,7 @@ export default function GodSectionPage({actions={actions}>{children}+ <GodSectionExtras slug={slug} /></SectionPageView>);}diff --git a/apps/web/src/features/god/components/users/GodUserDetailPanel.tsx b/apps/web/src/features/god/components/users/GodUserDetailPanel.tsxindex 90d7de0b..5d46afb3 100644--- a/apps/web/src/features/god/components/users/GodUserDetailPanel.tsx+++ b/apps/web/src/features/god/components/users/GodUserDetailPanel.tsx@@ -49,9 +49,12 @@ export default function GodUserDetailPanel({const [withProjects, setWithProjects] = useState(false);const user = userQuery.data;- // Projects this user owns alone. Deleting the account leaves them without anyone- // who can manage them, so the API refuses unless they are deleted along with it.- const soleOwned = (user?.projects ?? []).filter((p) => p.role === 'owner' && p.ownerCount === 1);+ // Projects this user owns alone outside their own workspaces. Deleting the account+ // leaves them without anyone who can manage them, so the API refuses unless they are+ // deleted along with it. The ones in their own workspaces pass to the instance owner.+ const soleOwned = (user?.projects ?? []).filter(+ (p) => p.role === 'owner' && p.ownerCount === 1 && !p.inOwnWorkspace,+ );// Escape closes the confirm dialog first; the panel stays until it is gone.useExitOnEscape(() => {@@ -238,6 +241,7 @@ export default function GodUserDetailPanel({strong: (chunks) => <span className="font-medium text-foreground">{chunks}</span>,})}</p>+ <p className="text-sm text-muted-foreground">{t('deleteWorkspaceNote')}</p>{soleOwned.length > 0 && (<div className="space-y-4 rounded-lg bg-muted/60 p-4">diff --git a/apps/web/src/features/teams/ManageTeamsLayout.tsx b/apps/web/src/features/teams/ManageTeamsLayout.tsxindex 5709039a..c910e986 100644--- a/apps/web/src/features/teams/ManageTeamsLayout.tsx+++ b/apps/web/src/features/teams/ManageTeamsLayout.tsx@@ -56,7 +56,7 @@ export default function ManageTeamsLayout({ children }: { children: ReactNode })teams={workspace ? teams.filter((team) => team.workspaceId === workspace.id) : teams}isPending={isPending}activeId={routeTeam?.id ?? null}- onCreate={workspace?.role === 'owner' ? () => setCreating(true) : undefined}+ onCreate={workspace?.canCreateTeam ? () => setCreating(true) : undefined}/></div>}diff --git a/apps/web/src/features/teams/components/workspace/WorkspaceDeleteSection.tsx b/apps/web/src/features/teams/components/workspace/WorkspaceDeleteSection.tsxnew file mode 100644index 00000000..cb4d96a0--- /dev/null+++ b/apps/web/src/features/teams/components/workspace/WorkspaceDeleteSection.tsx@@ -0,0 +1,60 @@+'use client';++import { useState } from 'react';+import { useRouter } from 'next/navigation';+import { toast } from 'sonner';+import { useTranslations } from 'next-intl';+import { manageTeamsPath } from '@/utils/paths';+import type { Workspace } from '@/lib/api/endpoints/workspaces';+import { useDeleteWorkspace } from '@/services/workspaces.service';+import ConfirmDialog from '@/components/common/overlay/ConfirmDialog';+import SettingsSection from '@/components/common/page/SettingsSection';+import { Button } from '@/components/ui/button';++export default function WorkspaceDeleteSection({ workspace }: { workspace: Workspace }) {+ const t = useTranslations('teams.workspace');+ const router = useRouter();+ const remove = useDeleteWorkspace(workspace.id);+ const [deleting, setDeleting] = useState(false);+ const blocked = workspace.deletion === 'work';++ return (+ <>+ <SettingsSection+ title={t('delete.action')}+ description={t(blocked ? 'delete.blocked' : 'delete.hint')}+ action={+ <Button+ variant="outline"+ size="sm"+ className="h-8 text-destructive hover:text-destructive"+ disabled={blocked}+ onClick={() => setDeleting(true)}+ >+ {t('delete.action')}+ </Button>+ }+ />++ {deleting && (+ <ConfirmDialog+ title={t('delete.title', { name: workspace.name })}+ confirmLabel={t('delete.action')}+ onClose={() => setDeleting(false)}+ onConfirm={async () => {+ await remove.mutateAsync();+ toast.success(t('delete.deleted'));+ router.replace(manageTeamsPath());+ }}+ >+ <p className="text-sm text-muted-foreground">+ {t.rich('delete.description', {+ name: workspace.name,+ strong: (chunks) => <span className="font-medium text-foreground">{chunks}</span>,+ })}+ </p>+ </ConfirmDialog>+ )}+ </>+ );+}diff --git a/apps/web/src/features/teams/components/workspace/WorkspaceInfoSection.tsx b/apps/web/src/features/teams/components/workspace/WorkspaceInfoSection.tsxindex 19eaaec7..f8d7792d 100644--- a/apps/web/src/features/teams/components/workspace/WorkspaceInfoSection.tsx+++ b/apps/web/src/features/teams/components/workspace/WorkspaceInfoSection.tsx@@ -3,31 +3,65 @@import { useState } from 'react';import { toast } from 'sonner';import { useTranslations } from 'next-intl';+import { WorkspaceSectionExtras } from '@/cloud';+import type { TeamCreation, WorkspacePatch } from '@/lib/api/endpoints/workspaces';import { useUpdateWorkspace, useWorkspaceQuery } from '@/services/workspaces.service';+import {+ workspaceInitial,+ workspaceTileClass,+ workspaceTileStyle,+} from '@/components/layout/utils/workspaceTile';import SectionPageView from '@/components/common/page/SectionPageView';import SettingsCard from '@/components/common/page/SettingsCard';import SettingsSection from '@/components/common/page/SettingsSection';import SectionPageSkeleton from '@/components/common/skeleton/SectionPageSkeleton';+import SettingsColorField from '@/features/settings/components/crud/SettingsColorField';import { Badge } from '@/components/ui/badge';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@/components/ui/select';+import WorkspaceDeleteSection from './WorkspaceDeleteSection';++const TEAM_CREATION: TeamCreation[] = ['owner', 'managers', 'members'];+const HEX = /^#[0-9a-f]{6}$/i;export default function WorkspaceInfoSection({ workspaceId }: { workspaceId: number }) {const t = useTranslations('teams.workspace');const tCommon = useTranslations('common');const workspace = useWorkspaceQuery(workspaceId).data;const update = useUpdateWorkspace(workspaceId);- const [draft, setDraft] = useState<string | null>(null);+ const [name, setName] = useState<string | null>(null);+ // An empty field clears the colour back to the neutral tile.+ const [color, setColor] = useState<string | null>(null);+ const [teamCreation, setTeamCreation] = useState<TeamCreation | null>(null);if (!workspace) return <SectionPageSkeleton rows={2} />;- const trimmed = (draft ?? workspace.name).trim();- const canSave = trimmed !== '' && trimmed !== workspace.name && !update.isPending;+ const isOwner = workspace.role === 'owner';+ const deletable = isOwner && workspace.deletion !== 'instance';+ const nextName = (name ?? workspace.name).trim();+ const nextColor = color === null ? workspace.color : color.trim() || null;+ const nextTeamCreation = teamCreation ?? workspace.teamCreation;+ const patch: WorkspacePatch = {+ ...(nextName !== workspace.name && { name: nextName }),+ ...(nextColor !== workspace.color && { color: nextColor }),+ ...(nextTeamCreation !== workspace.teamCreation && { teamCreation: nextTeamCreation }),+ };+ const valid = nextName !== '' && (nextColor === null || HEX.test(nextColor));+ const canSave = valid && Object.keys(patch).length > 0 && !update.isPending;async function save() {- await update.mutateAsync(trimmed);- setDraft(null);+ await update.mutateAsync(patch);+ setName(null);+ setColor(null);+ setTeamCreation(null);toast.success(t('info.saved'));}@@ -41,25 +75,77 @@ export default function WorkspaceInfoSection({ workspaceId }: { workspaceId: num</Button>}>- <SettingsSection title={t('info.workspace')} description={t('info.workspaceHint')}>- <SettingsCard className="space-y-4 p-4">- <div className="space-y-1.5">- <Label htmlFor="workspace-name">{tCommon('name')}</Label>- <Input- id="workspace-name"- value={draft ?? workspace.name}- maxLength={60}- onChange={(e) => setDraft(e.target.value)}- />- </div>- <div className="flex items-center justify-between gap-4">- <Label>{t('info.role')}</Label>- <Badge variant="secondary" className="font-normal">- {t(`roles.${workspace.role}`)}- </Badge>- </div>- </SettingsCard>- </SettingsSection>+ <div className="space-y-10">+ <SettingsSection title={t('info.workspace')} description={t('info.workspaceHint')}>+ <SettingsCard className="space-y-4 p-4">+ <div className="space-y-1.5">+ <Label htmlFor="workspace-name">{tCommon('name')}</Label>+ <Input+ id="workspace-name"+ value={name ?? workspace.name}+ maxLength={60}+ onChange={(e) => setName(e.target.value)}+ />+ </div>+ <div className="flex items-center justify-between gap-4">+ <Label>{t('info.color')}</Label>+ <div className="flex items-center gap-3">+ {nextColor && (+ <Button+ variant="ghost"+ size="sm"+ className="h-7 text-xs text-muted-foreground"+ onClick={() => setColor('')}+ >+ {t('info.colorReset')}+ </Button>+ )}+ <SettingsColorField value={color ?? workspace.color ?? ''} onChange={setColor} />+ <span+ aria-hidden+ className={workspaceTileClass(false)}+ style={workspaceTileStyle(nextColor && HEX.test(nextColor) ? nextColor : null)}+ >+ {workspaceInitial(nextName || workspace.name)}+ </span>+ </div>+ </div>+ <div className="flex items-center justify-between gap-4">+ <Label>{t('info.role')}</Label>+ <Badge variant="secondary" className="font-normal">+ {t(`roles.${workspace.role}`)}+ </Badge>+ </div>+ </SettingsCard>+ </SettingsSection>++ <SettingsSection+ title={t('teamCreation.title')}+ description={isOwner ? t('teamCreation.description') : t('teamCreation.ownerOnly')}+ action={+ <Select+ value={nextTeamCreation}+ disabled={!isOwner}+ onValueChange={(value) => setTeamCreation(value as TeamCreation)}+ >+ <SelectTrigger className="h-8 w-56">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {TEAM_CREATION.map((value) => (+ <SelectItem key={value} value={value}>+ {t(`teamCreation.${value}`)}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ }+ />++ <WorkspaceSectionExtras slug="general" workspace={workspace} />++ {deletable && <WorkspaceDeleteSection workspace={workspace} />}+ </div></SectionPageView>);}diff --git a/apps/web/src/features/teams/components/workspace/WorkspaceManagersSection.tsx b/apps/web/src/features/teams/components/workspace/WorkspaceManagersSection.tsxindex 1a1e463e..d2cbd74f 100644--- a/apps/web/src/features/teams/components/workspace/WorkspaceManagersSection.tsx+++ b/apps/web/src/features/teams/components/workspace/WorkspaceManagersSection.tsx@@ -4,6 +4,7 @@ import { useState } from 'react';import { Plus } from 'lucide-react';import { toast } from 'sonner';import { useTranslations } from 'next-intl';+import { WorkspaceSectionExtras } from '@/cloud';import type { WorkspaceManager } from '@/lib/api/endpoints/workspaces';import {useRemoveWorkspaceAdmin,@@ -22,7 +23,8 @@ import WorkspaceManagerRow from './WorkspaceManagerRow';export default function WorkspaceManagersSection({ workspaceId }: { workspaceId: number }) {const t = useTranslations('teams.workspace');const tCommon = useTranslations('common');- const isOwner = useWorkspaceQuery(workspaceId).data?.role === 'owner';+ const workspace = useWorkspaceQuery(workspaceId).data;+ const isOwner = workspace?.role === 'owner';const managersQuery = useWorkspaceManagersQuery(workspaceId);const remove = useRemoveWorkspaceAdmin(workspaceId);const [adding, setAdding] = useState(false);@@ -78,6 +80,8 @@ export default function WorkspaceManagersSection({ workspaceId }: { workspaceId:</div>)}+ {workspace && <WorkspaceSectionExtras slug="managers" workspace={workspace} />}+{adding && (<WorkspaceAdminAddDialog workspaceId={workspaceId} onClose={() => setAdding(false)} />)}diff --git a/apps/web/src/features/teams/components/workspace/WorkspaceSectionNav.tsx b/apps/web/src/features/teams/components/workspace/WorkspaceSectionNav.tsxindex 1a057821..05907ef2 100644--- a/apps/web/src/features/teams/components/workspace/WorkspaceSectionNav.tsx+++ b/apps/web/src/features/teams/components/workspace/WorkspaceSectionNav.tsx@@ -1,7 +1,7 @@'use client';import { usePathname } from 'next/navigation';-import { Info, ShieldCheck, UsersRound } from 'lucide-react';+import { Info, ShieldCheck } from 'lucide-react';import { useTranslations } from 'next-intl';import { useWorkspaceSections } from '@/cloud';import type { WorkspaceSummary } from '@/lib/api/endpoints/workspaces';@@ -24,16 +24,6 @@ export default function WorkspaceSectionNav({ workspace }: { workspace: Workspacbadge: detail && String(detail.managerCount),href: workspacePath(workspace.id, 'managers'),},- ...(workspace.role === 'owner'- ? [- {- id: 'scim',- label: t('scim.title'),- icon: UsersRound,- href: workspacePath(workspace.id, 'scim'),- },- ]- : []),...extra.map(({ id, label, icon }) => ({id,label,diff --git a/apps/web/src/features/teams/components/workspace/WorkspacesRail.tsx b/apps/web/src/features/teams/components/workspace/WorkspacesRail.tsxindex f9a469e8..e5f68598 100644--- a/apps/web/src/features/teams/components/workspace/WorkspacesRail.tsx+++ b/apps/web/src/features/teams/components/workspace/WorkspacesRail.tsx@@ -6,7 +6,11 @@ import { WorkspaceRailActions } from '@/cloud';import type { Team } from '@/lib/api/endpoints/teams';import type { WorkspaceSummary } from '@/lib/api/endpoints/workspaces';import { teamPath, workspacePath } from '@/utils/paths';-import { workspaceInitial, workspaceTileClass } from '@/components/layout/utils/workspaceTile';+import {+ workspaceInitial,+ workspaceTileClass,+ workspaceTileStyle,+} from '@/components/layout/utils/workspaceTile';import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';// The workspaces the account sees, as the page's leftmost rail. One the caller manages@@ -41,6 +45,7 @@ export default function WorkspacesRail({aria-label={workspace.name}aria-current={active || undefined}className={workspaceTileClass(active)}+ style={workspaceTileStyle(workspace.color)}>{workspaceInitial(workspace.name)}</Link>diff --git a/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSection.tsx b/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSection.tsxindex 5dd981b2..56787409 100644--- a/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSection.tsx+++ b/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSection.tsx@@ -8,7 +8,9 @@ import WorkspaceScimSettings from './WorkspaceScimSettings';// SCIM provisioning: the token an identity provider authenticates with, and what the// groups it pushes grant. Nothing here is a form the owner fills in and saves — the-// switch and the token act on their own — so there is no page-level Save.+// switch and the token act on their own — so there is no page-level Save. The core sets+// up SCIM in god mode, for the instance workspace (GodScimPage); this is the page a+// hosted build adds to every workspace's settings through `useWorkspaceSections`.export default function WorkspaceScimSection({ workspaceId }: { workspaceId: number }) {const t = useTranslations('teams.workspace.scim');const settings = useWorkspaceScimQuery(workspaceId).data;diff --git a/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSettings.tsx b/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSettings.tsxindex 381ede04..8675c63f 100644--- a/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSettings.tsx+++ b/apps/web/src/features/teams/components/workspace/scim/WorkspaceScimSettings.tsx@@ -14,13 +14,16 @@ import WorkspaceScimTokenDialog from './WorkspaceScimTokenDialog';import WorkspaceScimGroupList from './WorkspaceScimGroupList';// The endpoint and the token go into the identity provider; the groups it then-// pushes appear below, where the owner says what each one grants.+// pushes appear below, where the owner says what each one grants. `instance` is set in+// god mode, where the provider acts on the whole instance.export default function WorkspaceScimSettings({workspaceId,settings,+ instance = false,}: {workspaceId: number;settings: Settings;+ instance?: boolean;}) {const t = useTranslations('teams.workspace.scim');const update = useUpdateWorkspaceScim(workspaceId);@@ -39,7 +42,7 @@ export default function WorkspaceScimSettings({<div className="space-y-10"><SettingsSectiontitle={t('provisioning')}- description={t(settings.hasToken ? 'provisioningConfigured' : 'provisioningMissing')}+ description={t(provisioningHint(settings.hasToken, instance))}action={<EnabledSwitchchecked={settings.enabled}@@ -85,3 +88,9 @@ export default function WorkspaceScimSettings({</div>);}++function provisioningHint(hasToken: boolean, instance: boolean) {+ if (!hasToken) return 'provisioningMissing';+ if (instance) return 'provisioningInstance';+ return 'provisioningConfigured';+}diff --git a/apps/web/src/i18n/messages.ts b/apps/web/src/i18n/messages.tsindex dd616516..5405b769 100644--- a/apps/web/src/i18n/messages.ts+++ b/apps/web/src/i18n/messages.ts@@ -31,11 +31,13 @@ import updates from '../../messages/en/updates.json';import views from '../../messages/en/views.json';import whatsNew from '../../messages/en/whatsNew.json';import workItems from '../../messages/en/workItems.json';+import { cloudMessages, loadCloudMessages } from '@/cloud';import { DEFAULT_LOCALE, type Locale } from './locales';// English is static: it is the fallback for every other language and the shape the-// `t('…')` keys are typed against.-const defaultMessages = {+// `t('…')` keys are typed against. The hosted build's English is merged in, so its keys+// are typed too.+const coreMessages = {meta,auth,common,@@ -71,25 +73,34 @@ const defaultMessages = {whatsNew,};-export type Messages = typeof defaultMessages;+const NAMESPACES = Object.keys(coreMessages) as (keyof typeof coreMessages)[];++const defaultMessages = mergeMessages(coreMessages, cloudMessages) as typeof coreMessages &+ typeof cloudMessages;-const NAMESPACES = Object.keys(defaultMessages) as (keyof Messages)[];+export type Messages = typeof defaultMessages;export async function loadMessages(locale: Locale): Promise<Messages> {if (locale === DEFAULT_LOCALE) return defaultMessages;- const translated = await Promise.all(- NAMESPACES.map(async (ns) => [- ns,- (await import(`../../messages/${locale}/${ns}.json`)).default,- ]),- );+ const [translated, cloud] = await Promise.all([+ Promise.all(+ NAMESPACES.map(async (ns) => [+ ns,+ (await import(`../../messages/${locale}/${ns}.json`)).default,+ ]),+ ),+ loadCloudMessages(locale),+ ]);// A key still untranslated renders its English text instead of the raw key path.- return mergeMessages(defaultMessages, Object.fromEntries(translated)) as Messages;+ return mergeMessages(+ defaultMessages,+ mergeMessages(Object.fromEntries(translated), cloud),+ ) as Messages;}-type MessageTree = { [key: string]: string | MessageTree };+export type MessageTree = { [key: string]: string | MessageTree };function mergeMessages(base: MessageTree, override: MessageTree): MessageTree {const result: MessageTree = { ...base };diff --git a/apps/web/src/lib/api/endpoints/god.ts b/apps/web/src/lib/api/endpoints/god.tsindex 3e803714..65f08aa0 100644--- a/apps/web/src/lib/api/endpoints/god.ts+++ b/apps/web/src/lib/api/endpoints/god.ts@@ -22,6 +22,7 @@ export interface InstanceAuthSettings {magicLink: boolean;emailPassword: boolean;trustProviderEmails: boolean;+ personalWorkspaces: boolean;hasEmailProvider: boolean;// Whether Google or the OIDC provider can run. Password sign-in may only be turned// off while one of them can.@@ -34,6 +35,7 @@ export interface InstanceAuthSettingsPatch {magicLink?: boolean;emailPassword?: boolean;trustProviderEmails?: boolean;+ personalWorkspaces?: boolean;}// The instance mail provider used for authentication email (password reset, address@@ -155,8 +157,11 @@ export interface InstanceUserProject {roleName: string | null;permissions: Permissions;// How many owners the project has. 1 on a project this user owns means deleting- // the account would leave the project with nobody who can manage it.+ // the account would leave the project with nobody who can manage it, unless it is in a+ // workspace of theirs.ownerCount: number;+ // In a workspace this user owns: it passes to the instance owner with the account.+ inOwnWorkspace: boolean;joinedAt: string;}diff --git a/apps/web/src/lib/api/endpoints/workspaces.ts b/apps/web/src/lib/api/endpoints/workspaces.tsindex 86337576..37d529e5 100644--- a/apps/web/src/lib/api/endpoints/workspaces.ts+++ b/apps/web/src/lib/api/endpoints/workspaces.ts@@ -7,13 +7,30 @@ export interface WorkspaceSummary {id: number;name: string;role: WorkspaceRole | null;+ color: string | null;+ canCreateTeam: boolean;}+// Who creates teams in a workspace: the owner alone, the owner and admins, or anyone in+// one of its teams.+export type TeamCreation = 'owner' | 'managers' | 'members';++// `deletion` says whether the owner may delete it: `instance` for the instance workspace,+// which stays; `work` while a team of it holds a project or an AI agent.export interface Workspace {id: number;name: string;role: WorkspaceRole;managerCount: number;+ color: string | null;+ teamCreation: TeamCreation;+ deletion: 'allowed' | 'instance' | 'work';+}++export interface WorkspacePatch {+ name?: string;+ color?: string | null;+ teamCreation?: TeamCreation;}export interface WorkspacePerson {@@ -32,12 +49,15 @@ export const listWorkspaces = () => request<WorkspaceSummary[]>('/workspaces');export const getWorkspace = (workspaceId: number) =>request<Workspace>(`/workspaces/${workspaceId}`);-export const updateWorkspace = (workspaceId: number, input: { name: string }) =>+export const updateWorkspace = (workspaceId: number, input: WorkspacePatch) =>request<Workspace>(`/workspaces/${workspaceId}`, {method: 'PATCH',body: JSON.stringify(input),});+export const deleteWorkspace = (workspaceId: number) =>+ request<void>(`/workspaces/${workspaceId}`, { method: 'DELETE' });+export const listWorkspaceManagers = (workspaceId: number) =>request<WorkspaceManager[]>(`/workspaces/${workspaceId}/managers`);diff --git a/apps/web/src/services/workspaces.service.ts b/apps/web/src/services/workspaces.service.tsindex e4f04034..39aaca90 100644--- a/apps/web/src/services/workspaces.service.ts+++ b/apps/web/src/services/workspaces.service.ts@@ -2,6 +2,7 @@ import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstaimport {addWorkspaceAdmin,createWorkspaceScimToken,+ deleteWorkspace,getWorkspace,getWorkspaceScim,listWorkspaceManagerCandidates,@@ -12,6 +13,7 @@ import {removeWorkspaceAdmin,setWorkspaceScimGroupMappings,updateWorkspace,+ type WorkspacePatch,updateWorkspaceScim,} from '@/lib/api/endpoints/workspaces';import { qk } from '@/services/queryKeys';@@ -30,7 +32,7 @@ export function useWorkspaceQuery(workspaceId: number) {export function useUpdateWorkspace(workspaceId: number) {const qc = useQueryClient();return useMutation({- mutationFn: (name: string) => updateWorkspace(workspaceId, { name }),+ mutationFn: (patch: WorkspacePatch) => updateWorkspace(workspaceId, patch),onSuccess: (workspace) => {qc.setQueryData(qk.workspace(workspaceId), workspace);void qc.invalidateQueries({ queryKey: qk.workspaces });@@ -38,6 +40,19 @@ export function useUpdateWorkspace(workspaceId: number) {});}+// Its teams go with it, so the team list changes as well as the workspace list.+export function useDeleteWorkspace(workspaceId: number) {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: () => deleteWorkspace(workspaceId),+ onSuccess: () => {+ qc.removeQueries({ queryKey: qk.workspace(workspaceId) });+ void qc.invalidateQueries({ queryKey: qk.workspaces });+ void qc.invalidateQueries({ queryKey: qk.teams });+ },+ });+}+export function useWorkspaceManagersQuery(workspaceId: number) {return useQuery({queryKey: qk.workspaceManagers(workspaceId),diff --git a/apps/web/src/utils/godSections.ts b/apps/web/src/utils/godSections.tsindex d4f18483..ebde619c 100644--- a/apps/web/src/utils/godSections.ts+++ b/apps/web/src/utils/godSections.ts@@ -1,3 +1,4 @@+import type { ComponentType } from 'react';import {Building2,FolderKanban,@@ -8,8 +9,10 @@ import {Send,SlidersHorizontal,Users,+ UsersRound,type LucideIcon,} from 'lucide-react';+import { godSections } from '@/cloud';// The god mode sections, in sidebar order. God mode is instance administration,// open only to the owner account; the sections mirror the project settings pattern@@ -17,7 +20,10 @@ import {// `group` is the sidebar heading a section sits under; GOD_GROUPS gives the order.// A section with `integration: true` is not listed under its group directly: it sits// inside the "Integrations" item at the end of the group. The name and the blurb of-// a section, and the name of a group, are messages under `sections.god`.+// a section, and the name of a group, are messages under `sections.god`. The hosted+// build gets the list through `godSections` in `@/cloud` and may add, replace or drop+// sections; one it adds carries its page in `Component`, opened at /god/<slug>, and its+// messages come with the hosted build's.export const GOD_GROUPS = ['management', 'instance'] as const;export type GodGroup = (typeof GOD_GROUPS)[number];@@ -27,9 +33,10 @@ export interface GodSection {group: GodGroup;icon: LucideIcon;integration?: true;+ Component?: ComponentType;}-export const GOD_SECTIONS: GodSection[] = [+export const GOD_SECTIONS: GodSection[] = godSections([{slug: 'users',group: 'management',@@ -83,7 +90,13 @@ export const GOD_SECTIONS: GodSection[] = [icon: KeyRound,integration: true,},-];+ {+ slug: 'scim',+ group: 'instance',+ icon: UsersRound,+ integration: true,+ },+]);export function godSection(slug: string): GodSection {const section = GOD_SECTIONS.find((s) => s.slug === slug);diff --git a/apps/web/src/utils/paths.ts b/apps/web/src/utils/paths.tsindex 45680626..0d48d263 100644--- a/apps/web/src/utils/paths.ts+++ b/apps/web/src/utils/paths.ts@@ -166,7 +166,7 @@ export const teamSectionPath = (teamRef: string, section: TeamSection) =>section === 'info' ? teamPath(teamRef) : `${teamPath(teamRef)}/${section}`;// A workspace's settings, which only its owner and admins open. `section` is one of the-// settings pages ('managers', 'scim') or an id a hosted build adds.+// settings pages ('managers') or an id a hosted build adds.export const workspacePath = (workspaceId: number, section = 'info') =>section === 'info' ? `/workspaces/${workspaceId}` : `/workspaces/${workspaceId}/${section}`;diff --git a/docs/dev/i18n.md b/docs/dev/i18n.mdindex de8998c5..3c4a070e 100644--- a/docs/dev/i18n.md+++ b/docs/dev/i18n.md@@ -44,7 +44,7 @@ typecheck error. A key that is absent from a translated file causes no error.## How to add a namespace-Make the file in each language directory. Then add the namespace to `defaultMessages` in+Make the file in each language directory. Then add the namespace to `coreMessages` in`src/i18n/messages.ts`. No code finds the file automatically.## How to add a languagediff --git a/packages/auth/AGENTS.md b/packages/auth/AGENTS.mdindex 5f1bc42c..eb865ec5 100644--- a/packages/auth/AGENTS.md+++ b/packages/auth/AGENTS.md@@ -17,6 +17,13 @@ The **server-side** better-auth instance. Consumed by `apps/api`. See root `AGENThe user table has a `role` column (`"god"` | `"user"`), declared as a better-auth`additionalField` with `input: false` (not client-settable). A `databaseHooks.user.create.before`hook sets it: the first user to register gets `"god"`, everyone after gets `"user"`.+`databaseHooks.user.create.after` makes the `"god"` account the owner of the instance+workspace and gives every other account a workspace of its own, named after the person,+while `personalWorkspaces` is on in the auth settings (`ensurePersonalWorkspace`). apps/api+calls the same function on every request, so an account made before, by SCIM (a direct+insert, which passes no hook) or while the setting was off gets its own on its next+request. It remembers per process who needs nothing, so a request costs a lookup; an+agent's bot user never gets one.## Instance settings (`src/instance.ts`)@@ -133,10 +140,16 @@ which is what stops an instance being left with no way in.## SCIM-A workspace's identity provider decides who is in the workspace, not who has an account, so-nothing here refuses a session for it: there is no deactivation flag on the user table, and-what a provider says about a person is kept per workspace in `scim_user`, written by-`apps/api`.+What a provider says about a person is kept per workspace in `scim_user`, written by+`apps/api`. How far it reaches is `workspaceScim()`, which a hosted build turns on with+`setWorkspaceScim()`. Off, as on a self-hosted instance, SCIM is the instance's: only the+instance workspace's token opens it, and it also writes `active`, one more+`additionalField` on the user table (nullable, so every check is `active !== false`). An+account with `active` false (`isAccountDeactivated`) is refused at sign-in by the+`session.create.before` hook with `ACCOUNT_DEACTIVATED`, which covers every sign-in method+at once; `apps/api` refuses the sessions and keys it already holds. On, a workspace's+provider decides who is in the workspace, not who has an account, `active` is not read,+and nothing here refuses a session.`getScimSettings` / `rotateScimToken` / `verifyScimToken` hold the bearer token of eachworkspace that the SCIM endpoints in `apps/api` authenticate with. A token readsdiff --git a/packages/auth/src/index.ts b/packages/auth/src/index.tsindex 8717852c..d0e3ad48 100644--- a/packages/auth/src/index.ts+++ b/packages/auth/src/index.ts@@ -1,6 +1,6 @@import { randomInt } from 'node:crypto';-import { db, instanceWorkspaceId } from '@repo/db';-import { eq, sql, type SQL } from 'drizzle-orm';+import { createWorkspace, db, instanceWorkspaceId } from '@repo/db';+import { and, eq, sql, type SQL } from 'drizzle-orm';import { betterAuth } from 'better-auth';import { createAuthMiddleware, APIError } from 'better-auth/api';import { drizzleAdapter } from 'better-auth/adapters/drizzle';@@ -16,6 +16,7 @@ import {isGoogleUsable,getOidcConfig,isOidcUsable,+ isAccountDeactivated,} from './instance';import { sendAuthEmail } from './mail';@@ -221,6 +222,55 @@ function randomSuffix(): string {return String(100 + randomInt(900));}+// Accounts that need no personal workspace made: they own a workspace, or are the+// instance owner or an agent's bot user. Kept per process, so once an account is known a+// request costs a lookup here and nothing in the database.+const settled = new Set<string>();++// The personal workspace of an account that owns none, while personal workspaces are on,+// named after the person. Sign-up calls it, and apps/api on every request, so an account+// made before personal workspaces, by SCIM, or while they were off gets its own without+// signing in again. Nothing in the API creates a workspace; an edition that lets a+// person own more mounts a route of its own. The instance owner owns the instance+// workspace instead, and an agent's bot user is no person.+// ponytail: an account with no workspace while they are off reads the setting on each+// request; cache it with the setting if that ever shows.+export async function ensurePersonalWorkspace(userId: string): Promise<void> {+ if (settled.has(userId)) return;+ if (!(await getAuthSettings()).personalWorkspaces) return;+ await db.transaction(async (tx) => {+ // Two sign-ins at once would otherwise both find none.+ const [account] = await tx+ .select({ name: schema.user.name, email: schema.user.email, role: schema.user.role })+ .from(schema.user)+ .where(eq(schema.user.id, userId))+ .for('update');+ if (!account || account.role === 'god') return;+ const [owned] = await tx+ .select({ n: sql`1` })+ .from(schema.workspaceManager)+ .where(+ and(eq(schema.workspaceManager.userId, userId), eq(schema.workspaceManager.role, 'owner')),+ )+ .limit(1);+ const [agent] = await tx+ .select({ n: sql`1` })+ .from(schema.aiAgent)+ .where(eq(schema.aiAgent.userId, userId))+ .limit(1);+ if (owned || agent) return;+ const name = (account.name.trim() || account.email.split('@')[0]!).slice(0, 60);+ await createWorkspace(tx, name, userId);+ });+ settled.add(userId);+}++// After an account stops owning a workspace (it deleted or handed over its own), so the+// next request makes it a fresh one while personal workspaces are on.+export function forgetPersonalWorkspace(userId: string): void {+ settled.delete(userId);+}+// True when an agent of some project already answers to this handle. A mention is// resolved against members and agents at once, so the two share one namespace: a// member cannot take a name an agent uses, and the check for the other direction@@ -360,6 +410,14 @@ export const auth = betterAuth({defaultValue: 'user',input: false,},+ // Deprovisioning flag, written only over SCIM while it acts on the whole instance.+ // Nullable: read it through isAccountDeactivated, which takes only `false`.+ active: {+ type: 'boolean',+ required: false,+ defaultValue: true,+ input: false,+ },},},@@ -508,11 +566,37 @@ export const auth = betterAuth({};},after: async (user) => {- if (user.role !== 'god') return;- await db- .insert(schema.workspaceManager)- .values({ workspaceId: await instanceWorkspaceId(db), userId: user.id, role: 'owner' })- .onConflictDoNothing();+ if (user.role === 'god') {+ await db+ .insert(schema.workspaceManager)+ .values({+ workspaceId: await instanceWorkspaceId(db),+ userId: user.id,+ role: 'owner',+ })+ .onConflictDoNothing();+ } else {+ await ensurePersonalWorkspace(user.id);+ }+ },+ },+ },+ session: {+ create: {+ // Every sign-in method ends here, so one check covers password, magic link,+ // passkey, Google and OIDC. Deactivation arrives over SCIM; apps/api refuses+ // the sessions that are already open.+ before: async (session) => {+ const [account] = await db+ .select({ active: schema.user.active })+ .from(schema.user)+ .where(eq(schema.user.id, session.userId));+ if (account && isAccountDeactivated(account)) {+ throw new APIError('FORBIDDEN', {+ code: 'ACCOUNT_DEACTIVATED',+ message: 'This account is deactivated',+ });+ }},},},@@ -687,6 +771,9 @@ export {setScimSettings,rotateScimToken,verifyScimToken,+ setWorkspaceScim,+ workspaceScim,+ isAccountDeactivated,} from './instance';export type {RegistrationMode,diff --git a/packages/auth/src/instance.ts b/packages/auth/src/instance.tsindex ac8fee52..35de6a22 100644--- a/packages/auth/src/instance.ts+++ b/packages/auth/src/instance.ts@@ -59,6 +59,9 @@ export interface AuthSettings {// been registered with a password by someone other than the owner of the address,// and trusting the provider hands it to whoever the provider says owns it.trustProviderEmails: boolean;+ // Give every person a workspace of their own: created with the account, and offered+ // to an account that has none. Off, only the instance owner has a workspace.+ personalWorkspaces: boolean;}function defaultAuthSettings(): AuthSettings {@@ -68,6 +71,7 @@ function defaultAuthSettings(): AuthSettings {magicLink: false,emailPassword: true,trustProviderEmails: false,+ personalWorkspaces: true,};}@@ -385,6 +389,28 @@ export interface WorkspaceScimDto {tokenPrefix: string;}+// Whether SCIM is set up per workspace. Off, as on a self-hosted instance, it is the+// instance owner's alone and acts on the whole instance: only the instance workspace's+// token opens /scim/v2, its provider sees and deactivates every account, and a+// deactivated account cannot sign in. On, as in a hosted build, every workspace owner+// sets it up and their provider decides who is in their workspace, nothing more.+let scimPerWorkspace = false;++export function setWorkspaceScim(on = true): void {+ scimPerWorkspace = on;+}++export function workspaceScim(): boolean {+ return scimPerWorkspace;+}++// True for an account the instance's identity provider deactivated (`user.active`),+// while SCIM acts on the whole instance. Such an account cannot sign in, and the api+// refuses the sessions and keys it already holds.+export function isAccountDeactivated(account: { active?: boolean | null }): boolean {+ return !scimPerWorkspace && account.active === false;+}+// A token reads scim_<workspaceId>_<secret>, so the workspace it opens is found// without trying the token of every workspace. A token issued before workspaces// existed reads scim_<secret> and belongs to the instance workspace.@@ -436,12 +462,15 @@ export async function rotateScimToken(workspaceId: number): Promise<string> {}// The workspace a token opens, or null when it opens none: provisioning is off, no-// token was generated, or the token is wrong. The comparison is constant-time, so a+// token was generated, the token is wrong, or it is another workspace's while SCIM is+// the instance's. The comparison is constant-time, so a// wrong token cannot be recovered by timing the answer. Lengths are compared first// because timingSafeEqual rejects buffers of different sizes.export async function verifyScimToken(candidate: string): Promise<number | null> {const named = candidate.match(SCIM_TOKEN_WORKSPACE)?.[1];- const workspaceId = named ? Number(named) : await instanceWorkspaceId(db);+ const instanceId = await instanceWorkspaceId(db);+ const workspaceId = named ? Number(named) : instanceId;+ if (!scimPerWorkspace && workspaceId !== instanceId) return null;const config = await getScimConfig(workspaceId);if (!config.enabled || config.token.length === 0) return null;const expected = Buffer.from(config.token);diff --git a/packages/db/drizzle/0140_account_active.sql b/packages/db/drizzle/0140_account_active.sqlnew file mode 100644index 00000000..783a300e--- /dev/null+++ b/packages/db/drizzle/0140_account_active.sql@@ -0,0 +1,5 @@+ALTER TABLE "user" ADD COLUMN "active" boolean DEFAULT true;--> statement-breakpoint+-- On a self-hosted instance SCIM acts on the whole instance again: an account the instance workspace's provider deactivated cannot sign in.+UPDATE "user" u SET "active" = false+FROM "scim_user" su+WHERE su."user_id" = u."id" AND NOT su."active" AND su."workspace_id" = (SELECT min("id") FROM "workspace");diff --git a/packages/db/drizzle/0141_workspace_settings.sql b/packages/db/drizzle/0141_workspace_settings.sqlnew file mode 100644index 00000000..a6c87716--- /dev/null+++ b/packages/db/drizzle/0141_workspace_settings.sql@@ -0,0 +1,3 @@+ALTER TABLE "workspace" ADD COLUMN "color" text;--> statement-breakpoint+ALTER TABLE "workspace" ADD COLUMN "team_creation" text DEFAULT 'owner' NOT NULL;--> statement-breakpoint+ALTER TABLE "workspace" ADD CONSTRAINT "workspace_team_creation_check" CHECK ("workspace"."team_creation" IN ('owner', 'managers', 'members'));\ No newline at end of filediff --git a/packages/db/drizzle/meta/0140_snapshot.json b/packages/db/drizzle/meta/0140_snapshot.jsonnew file mode 100644index 00000000..2fedd900--- /dev/null+++ b/packages/db/drizzle/meta/0140_snapshot.json@@ -0,0 +1,11277 @@+{+ "id": "9f734828-62f2-427b-b1c4-12797e44fcf9",+ "prevId": "fa279a88-c63b-4093-b0d0-65ab329d4787",+ "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()"+ },+ "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.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+ },+ "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": 1000+ },+ "rate_limit_max": {+ "name": "rate_limit_max",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 100+ },+ "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_referenceId_idx": {+ "name": "apikey_referenceId_idx",+ "columns": [+ {+ "expression": "reference_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": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_access_token": {+ "name": "oauth_access_token",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "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": true+ }+ },+ "indexes": {+ "oauthAccessToken_clientId_idx": {+ "name": "oauthAccessToken_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessToken_userId_idx": {+ "name": "oauthAccessToken_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_access_token_client_id_oauth_application_client_id_fk": {+ "name": "oauth_access_token_client_id_oauth_application_client_id_fk",+ "tableFrom": "oauth_access_token",+ "tableTo": "oauth_application",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_access_token_user_id_user_id_fk": {+ "name": "oauth_access_token_user_id_user_id_fk",+ "tableFrom": "oauth_access_token",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_access_token_access_token_unique": {+ "name": "oauth_access_token_access_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "access_token"+ ]+ },+ "oauth_access_token_refresh_token_unique": {+ "name": "oauth_access_token_refresh_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "refresh_token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_application": {+ "name": "oauth_application",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_secret": {+ "name": "client_secret",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "redirect_urls": {+ "name": "redirect_urls",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "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+ }+ },+ "indexes": {+ "oauthApplication_userId_idx": {+ "name": "oauthApplication_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_application_user_id_user_id_fk": {+ "name": "oauth_application_user_id_user_id_fk",+ "tableFrom": "oauth_application",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_application_client_id_unique": {+ "name": "oauth_application_client_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "client_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_consent": {+ "name": "oauth_consent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scopes": {+ "name": "scopes",+ "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": true+ },+ "consent_given": {+ "name": "consent_given",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthConsent_clientId_idx": {+ "name": "oauthConsent_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthConsent_userId_idx": {+ "name": "oauthConsent_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_consent_client_id_oauth_application_client_id_fk": {+ "name": "oauth_consent_client_id_oauth_application_client_id_fk",+ "tableFrom": "oauth_consent",+ "tableTo": "oauth_application",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_consent_user_id_user_id_fk": {+ "name": "oauth_consent_user_id_user_id_fk",+ "tableFrom": "oauth_consent",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.passkey": {+ "name": "passkey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "public_key": {+ "name": "public_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "device_type": {+ "name": "device_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "backed_up": {+ "name": "backed_up",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "aaguid": {+ "name": "aaguid",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "passkey_userId_idx": {+ "name": "passkey_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "passkey_credentialID_idx": {+ "name": "passkey_credentialID_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "passkey_user_id_user_id_fk": {+ "name": "passkey_user_id_user_id_fk",+ "tableFrom": "passkey",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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()"+ },+ "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+ }+ },+ "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.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,+ "default": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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()"+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_username": {+ "name": "display_username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'user'"+ },+ "active": {+ "name": "active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ },+ "user_username_unique": {+ "name": "user_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "username"+ ]+ }+ },+ "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()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "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.agent_chat_event": {+ "name": "agent_chat_event",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "bigserial",+ "primaryKey": true,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_event_message_idx": {+ "name": "agent_chat_event_message_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_event_message_id_agent_chat_message_id_fk": {+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",+ "tableFrom": "agent_chat_event",+ "tableTo": "agent_chat_message",+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_favorite": {+ "name": "agent_chat_favorite",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "agent_chat_favorite_user_id_user_id_fk": {+ "name": "agent_chat_favorite_user_id_user_id_fk",+ "tableFrom": "agent_chat_favorite",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_favorite",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_chat_favorite_user_id_thread_id_pk": {+ "name": "agent_chat_favorite_user_id_thread_id_pk",+ "columns": [+ "user_id",+ "thread_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_message": {+ "name": "agent_chat_message",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_message_thread_idx": {+ "name": "agent_chat_message_thread_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_chat_message_due_idx": {+ "name": "agent_chat_message_due_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "agent_chat_thread",+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_message_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_chat_message_role_check": {+ "name": "agent_chat_message_role_check",+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"+ },+ "agent_chat_message_status_check": {+ "name": "agent_chat_message_status_check",+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_chat_thread": {+ "name": "agent_chat_thread",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cli_session_id": {+ "name": "cli_session_id",+ "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": {+ "agent_chat_thread_agent_user_idx": {+ "name": "agent_chat_thread_agent_user_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_thread_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_thread_user_id_user_id_fk": {+ "name": "agent_chat_thread_user_id_user_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_usage": {+ "name": "agent_chat_usage",+ "schema": "",+ "columns": {+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_usage_agent_idx": {+ "name": "agent_chat_usage_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_usage_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_usage",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_field_trigger": {+ "name": "agent_field_trigger",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "delay_sec": {+ "name": "delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ }+ },+ "indexes": {+ "agent_field_trigger_field_idx": {+ "name": "agent_field_trigger_field_idx",+ "columns": [+ {+ "expression": "field_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_field_trigger_agent_id_ai_agent_id_fk": {+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_field_trigger_field_id_custom_field_id_fk": {+ "name": "agent_field_trigger_field_id_custom_field_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_field_trigger_agent_id_field_id_pk": {+ "name": "agent_field_trigger_agent_id_field_id_pk",+ "columns": [+ "agent_id",+ "field_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_field_trigger_delay_check": {+ "name": "agent_field_trigger_delay_check",+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_run": {+ "name": "agent_run",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "schedule_id": {+ "name": "schedule_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'delegation'"+ },+ "scheduled_for": {+ "name": "scheduled_for",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "output": {+ "name": "output",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_run_schedule_fire_uq": {+ "name": "agent_run_schedule_fire_uq",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scheduled_for",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_due_idx": {+ "name": "agent_run_due_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_schedule_idx": {+ "name": "agent_run_schedule_idx",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_project_idx": {+ "name": "agent_run_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_run_agent_id_ai_agent_id_fk": {+ "name": "agent_run_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_project_id_project_id_fk": {+ "name": "agent_run_project_id_project_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_issue_id_issue_id_fk": {+ "name": "agent_run_issue_id_issue_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_schedule_id_agent_schedule_id_fk": {+ "name": "agent_run_schedule_id_agent_schedule_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "agent_schedule",+ "columnsFrom": [+ "schedule_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_source_activity_id_issue_activity_id_fk": {+ "name": "agent_run_source_activity_id_issue_activity_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_run_status_check": {+ "name": "agent_run_status_check",+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed', 'canceled')"+ },+ "agent_run_trigger_check": {+ "name": "agent_run_trigger_check",+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', 'schedule', 'manual')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_schedule": {+ "name": "agent_schedule",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "next_run_at": {+ "name": "next_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_schedule_due_idx": {+ "name": "agent_schedule_due_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_agent_idx": {+ "name": "agent_schedule_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_project_idx": {+ "name": "agent_schedule_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_schedule_agent_id_ai_agent_id_fk": {+ "name": "agent_schedule_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_schedule_project_id_project_id_fk": {+ "name": "agent_schedule_project_id_project_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_project_id_agent_id_name_unique": {+ "name": "agent_schedule_project_id_agent_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "agent_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_schedule_status_check": {+ "name": "agent_schedule_status_check",+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill": {+ "name": "agent_skill",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_url": {+ "name": "source_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_prefix": {+ "name": "s3_prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "files": {+ "name": "files",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_skill_team_idx": {+ "name": "agent_skill_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_team_id_team_id_fk": {+ "name": "agent_skill_team_id_team_id_fk",+ "tableFrom": "agent_skill",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_team_id_name_unique": {+ "name": "agent_skill_team_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_skill_source_check": {+ "name": "agent_skill_source_check",+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill_link": {+ "name": "agent_skill_link",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "skill_id": {+ "name": "skill_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_skill_link_skill_idx": {+ "name": "agent_skill_link_skill_idx",+ "columns": [+ {+ "expression": "skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_link_agent_id_ai_agent_id_fk": {+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_skill_link",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_skill_link_skill_id_agent_skill_id_fk": {+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",+ "tableFrom": "agent_skill_link",+ "tableTo": "agent_skill",+ "columnsFrom": [+ "skill_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_skill_link_agent_id_skill_id_pk": {+ "name": "agent_skill_link_agent_id_skill_id_pk",+ "columns": [+ "agent_id",+ "skill_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_tool": {+ "name": "agent_tool",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "tool_key": {+ "name": "tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_tool_team_idx": {+ "name": "agent_tool_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_tool_credential_idx": {+ "name": "agent_tool_credential_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_tool_team_id_team_id_fk": {+ "name": "agent_tool_team_id_team_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_tool_credential_id_integration_credential_id_fk": {+ "name": "agent_tool_credential_id_integration_credential_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "integration_credential",+ "columnsFrom": [+ "credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_tool_team_id_tool_key_credential_id_unique": {+ "name": "agent_tool_team_id_tool_key_credential_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "tool_key",+ "credential_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_tool_link": {+ "name": "agent_tool_link",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "agent_tool_id": {+ "name": "agent_tool_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_tool_link_tool_idx": {+ "name": "agent_tool_link_tool_idx",+ "columns": [+ {+ "expression": "agent_tool_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_tool_link_agent_id_ai_agent_id_fk": {+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_tool_link",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",+ "tableFrom": "agent_tool_link",+ "tableTo": "agent_tool",+ "columnsFrom": [+ "agent_tool_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_tool_link_agent_id_agent_tool_id_pk": {+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",+ "columns": [+ "agent_id",+ "agent_tool_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.ai_agent": {+ "name": "ai_agent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model_credential_id": {+ "name": "model_credential_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tools": {+ "name": "tools",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "temperature": {+ "name": "temperature",+ "type": "double precision",+ "primaryKey": false,+ "notNull": false+ },+ "max_steps": {+ "name": "max_steps",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_on_mention": {+ "name": "trigger_on_mention",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "trigger_on_assign": {+ "name": "trigger_on_assign",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "delegation_delay_sec": {+ "name": "delegation_delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ },+ "api_key_ciphertext": {+ "name": "api_key_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "api_key_iv": {+ "name": "api_key_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "api_key_auth_tag": {+ "name": "api_key_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_enabled": {+ "name": "memory_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "memory_last_messages": {+ "name": "memory_last_messages",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runner_scope": {+ "name": "runner_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'team'"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "ai_agent_team_username_uq": {+ "name": "ai_agent_team_username_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"username\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_agent_team_idx": {+ "name": "ai_agent_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_agent_team_id_team_id_fk": {+ "name": "ai_agent_team_id_team_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_agent_user_id_user_id_fk": {+ "name": "ai_agent_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_agent_model_credential_id_integration_credential_id_fk": {+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "integration_credential",+ "columnsFrom": [+ "model_credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "ai_agent_owner_user_id_user_id_fk": {+ "name": "ai_agent_owner_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "ai_agent_user_id_unique": {+ "name": "ai_agent_user_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "ai_agent_kind_check": {+ "name": "ai_agent_kind_check",+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"+ },+ "ai_agent_runner_scope_check": {+ "name": "ai_agent_runner_scope_check",+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'team')"+ },+ "ai_agent_delegation_delay_check": {+ "name": "ai_agent_delegation_delay_check",+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.app_secret": {+ "name": "app_secret",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.app_setting": {+ "name": "app_setting",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.chat_attachment": {+ "name": "chat_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by_user_id": {+ "name": "uploaded_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "chat_attachment_project_idx": {+ "name": "chat_attachment_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chat_attachment_project_id_project_id_fk": {+ "name": "chat_attachment_project_id_project_id_fk",+ "tableFrom": "chat_attachment",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_attachment_uploaded_by_user_id_user_id_fk": {+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",+ "tableFrom": "chat_attachment",+ "tableTo": "user",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "chat_attachment_public_id_unique": {+ "name": "chat_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.custom_field": {+ "name": "custom_field",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_type_id": {+ "name": "issue_type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "field_type": {+ "name": "field_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "member_scope": {+ "name": "member_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "show_in_body": {+ "name": "show_in_body",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_project_id_project_id_fk": {+ "name": "custom_field_project_id_project_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "custom_field_issue_type_id_issue_type_id_fk": {+ "name": "custom_field_issue_type_id_issue_type_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "issue_type",+ "columnsFrom": [+ "issue_type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "custom_field_field_type_check": {+ "name": "custom_field_field_type_check",+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"+ },+ "custom_field_member_scope_check": {+ "name": "custom_field_member_scope_check",+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"+ }+ },+ "isRLSEnabled": false+ },+ "public.custom_field_option": {+ "name": "custom_field_option",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_option_field_id_custom_field_id_fk": {+ "name": "custom_field_option_field_id_custom_field_id_fk",+ "tableFrom": "custom_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "custom_field_option_field_id_value_unique": {+ "name": "custom_field_option_field_id_value_unique",+ "nullsNotDistinct": false,+ "columns": [+ "field_id",+ "value"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cycle": {+ "name": "cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "goal": {+ "name": "goal",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "end_date": {+ "name": "end_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "cycle_project_idx": {+ "name": "cycle_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "start_date",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "cycle_project_id_project_id_fk": {+ "name": "cycle_project_id_project_id_fk",+ "tableFrom": "cycle",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "cycle_dates_check": {+ "name": "cycle_dates_check",+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""+ }+ },+ "isRLSEnabled": false+ },+ "public.document_asset": {+ "name": "document_asset",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by_user_id": {+ "name": "uploaded_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_asset_document_idx": {+ "name": "document_asset_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_asset_document_id_project_document_id_fk": {+ "name": "document_asset_document_id_project_document_id_fk",+ "tableFrom": "document_asset",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_asset_uploaded_by_user_id_user_id_fk": {+ "name": "document_asset_uploaded_by_user_id_user_id_fk",+ "tableFrom": "document_asset",+ "tableTo": "user",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "document_asset_public_id_unique": {+ "name": "document_asset_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_collaboration": {+ "name": "document_collaboration",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "epoch": {+ "name": "epoch",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_collaboration_document_id_project_document_id_fk": {+ "name": "document_collaboration_document_id_project_document_id_fk",+ "tableFrom": "document_collaboration",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_comment": {+ "name": "document_comment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_id": {+ "name": "author_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "quote": {+ "name": "quote",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "selection_from": {+ "name": "selection_from",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "selection_to": {+ "name": "selection_to",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "orphaned": {+ "name": "orphaned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_comment_document_idx": {+ "name": "document_comment_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_comment_document_id_project_document_id_fk": {+ "name": "document_comment_document_id_project_document_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_parent_id_document_comment_id_fk": {+ "name": "document_comment_parent_id_document_comment_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "document_comment",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_author_id_user_id_fk": {+ "name": "document_comment_author_id_user_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "user",+ "columnsFrom": [+ "author_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_step": {+ "name": "document_step",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "step": {+ "name": "step",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_step_document_id_project_document_id_fk": {+ "name": "document_step_document_id_project_document_id_fk",+ "tableFrom": "document_step",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "document_step_document_id_version_pk": {+ "name": "document_step_document_id_version_pk",+ "columns": [+ "document_id",+ "version"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.git_managed_repository": {+ "name": "git_managed_repository",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "connection_id": {+ "name": "connection_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "full_name": {+ "name": "full_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "web_url": {+ "name": "web_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "webhook_external_id": {+ "name": "webhook_external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'connected'"+ },+ "last_error": {+ "name": "last_error",+ "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": {+ "git_managed_repository_project_connection_idx": {+ "name": "git_managed_repository_project_connection_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "git_managed_repository_project_id_project_id_fk": {+ "name": "git_managed_repository_project_id_project_id_fk",+ "tableFrom": "git_managed_repository",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "git_managed_repository_connection_id_git_provider_connection_id_fk": {+ "name": "git_managed_repository_connection_id_git_provider_connection_id_fk",+ "tableFrom": "git_managed_repository",+ "tableTo": "git_provider_connection",+ "columnsFrom": [+ "connection_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "git_managed_repository_project_connection_external_unique": {+ "name": "git_managed_repository_project_connection_external_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "connection_id",+ "external_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.git_provider_connection": {+ "name": "git_provider_connection",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "base_url": {+ "name": "base_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "account_login": {+ "name": "account_login",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "git_provider_connection_team_idx": {+ "name": "git_provider_connection_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "git_provider_connection_team_id_team_id_fk": {+ "name": "git_provider_connection_team_id_team_id_fk",+ "tableFrom": "git_provider_connection",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.import_job": {+ "name": "import_job",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "phase": {+ "name": "phase",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'discover'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "cursor": {+ "name": "cursor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "credential_ciphertext": {+ "name": "credential_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_iv": {+ "name": "credential_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_auth_tag": {+ "name": "credential_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "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": {+ "import_job_project_idx": {+ "name": "import_job_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_job_due_idx": {+ "name": "import_job_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"import_job\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "import_job_project_id_project_id_fk": {+ "name": "import_job_project_id_project_id_fk",+ "tableFrom": "import_job",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "import_job_created_by_user_id_user_id_fk": {+ "name": "import_job_created_by_user_id_user_id_fk",+ "tableFrom": "import_job",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "import_job_source_check": {+ "name": "import_job_source_check",+ "value": "\"import_job\".\"source\" IN ('plane')"+ },+ "import_job_phase_check": {+ "name": "import_job_phase_check",+ "value": "\"import_job\".\"phase\" IN ('discover', 'create', 'link', 'rewrite', 'attachments', 'done')"+ },+ "import_job_status_check": {+ "name": "import_job_status_check",+ "value": "\"import_job\".\"status\" IN ('pending', 'running', 'paused', 'completed', 'failed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.import_record": {+ "name": "import_record",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "import_job_id": {+ "name": "import_job_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "source_entity_type": {+ "name": "source_entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_display_id": {+ "name": "source_display_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "local_entity_type": {+ "name": "local_entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "local_id": {+ "name": "local_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "import_record_job_source_uq": {+ "name": "import_record_job_source_uq",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_record_job_local_idx": {+ "name": "import_record_job_local_idx",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "local_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "local_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_record_job_display_idx": {+ "name": "import_record_job_display_idx",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_display_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "import_record_import_job_id_import_job_id_fk": {+ "name": "import_record_import_job_id_import_job_id_fk",+ "tableFrom": "import_record",+ "tableTo": "import_job",+ "columnsFrom": [+ "import_job_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "import_record_source_entity_type_check": {+ "name": "import_record_source_entity_type_check",+ "value": "\"import_record\".\"source_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"+ },+ "import_record_local_entity_type_check": {+ "name": "import_record_local_entity_type_check",+ "value": "\"import_record\".\"local_entity_type\" IS NULL OR \"import_record\".\"local_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative": {+ "name": "initiative",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planned'"+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "target_date": {+ "name": "target_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "initiative_project_idx": {+ "name": "initiative_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_project_id_project_id_fk": {+ "name": "initiative_project_id_project_id_fk",+ "tableFrom": "initiative",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_owner_user_id_user_id_fk": {+ "name": "initiative_owner_user_id_user_id_fk",+ "tableFrom": "initiative",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "initiative_status_check": {+ "name": "initiative_status_check",+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative_attachment": {+ "name": "initiative_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "initiative_attachment_initiative_idx": {+ "name": "initiative_attachment_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_attachment_initiative_id_initiative_id_fk": {+ "name": "initiative_attachment_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_attachment",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "initiative_attachment_public_id_unique": {+ "name": "initiative_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.initiative_label": {+ "name": "initiative_label",+ "schema": "",+ "columns": {+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "initiative_label_initiative_id_initiative_id_fk": {+ "name": "initiative_label_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_label_label_id_label_id_fk": {+ "name": "initiative_label_label_id_label_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "initiative_label_initiative_id_label_id_pk": {+ "name": "initiative_label_initiative_id_label_id_pk",+ "columns": [+ "initiative_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.integration_credential": {+ "name": "integration_credential",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "integration_key": {+ "name": "integration_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "integration_credential_team_idx": {+ "name": "integration_credential_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_team_id_team_id_fk": {+ "name": "integration_credential_team_id_team_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue": {+ "name": "issue",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sequence_number": {+ "name": "sequence_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "delegate_user_id": {+ "name": "delegate_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_points": {+ "name": "estimate_points",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_minutes": {+ "name": "estimate_minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "due_date": {+ "name": "due_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": 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": {+ "issue_project_active_idx": {+ "name": "issue_project_active_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"archived_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_project_title_idx": {+ "name": "issue_project_title_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(btrim(\"title\"))",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_parent_idx": {+ "name": "issue_parent_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"parent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_idx": {+ "name": "issue_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_project_id_project_id_fk": {+ "name": "issue_project_id_project_id_fk",+ "tableFrom": "issue",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_type_id_issue_type_id_fk": {+ "name": "issue_type_id_issue_type_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_initiative_id_initiative_id_fk": {+ "name": "issue_initiative_id_initiative_id_fk",+ "tableFrom": "issue",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_id_cycle_id_fk",+ "tableFrom": "issue",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_column_id_project_column_id_fk": {+ "name": "issue_column_id_project_column_id_fk",+ "tableFrom": "issue",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_parent_id_issue_id_fk": {+ "name": "issue_parent_id_issue_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_assignee_user_id_user_id_fk": {+ "name": "issue_assignee_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_delegate_user_id_user_id_fk": {+ "name": "issue_delegate_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "delegate_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_share_token_unique": {+ "name": "issue_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ },+ "issue_project_id_sequence_number_unique": {+ "name": "issue_project_id_sequence_number_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "sequence_number"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "issue_estimate_points_check": {+ "name": "issue_estimate_points_check",+ "value": "\"issue\".\"estimate_points\" >= 0"+ },+ "issue_estimate_minutes_check": {+ "name": "issue_estimate_minutes_check",+ "value": "\"issue\".\"estimate_minutes\" >= 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_activity": {+ "name": "issue_activity",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reply_to_id": {+ "name": "reply_to_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "edited_at": {+ "name": "edited_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_activity_issue_idx": {+ "name": "issue_activity_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_reply_idx": {+ "name": "issue_activity_reply_idx",+ "columns": [+ {+ "expression": "reply_to_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_initiative_idx": {+ "name": "issue_activity_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_activity_issue_id_issue_id_fk": {+ "name": "issue_activity_issue_id_issue_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_initiative_id_initiative_id_fk": {+ "name": "issue_activity_initiative_id_initiative_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_reply_to_id_issue_activity_id_fk": {+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "reply_to_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_actor_user_id_user_id_fk": {+ "name": "issue_activity_actor_user_id_user_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_activity_kind_check": {+ "name": "issue_activity_kind_check",+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"+ },+ "issue_activity_owner_check": {+ "name": "issue_activity_owner_check",+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_attachment": {+ "name": "issue_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_attachment_issue_idx": {+ "name": "issue_attachment_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_attachment_issue_id_issue_id_fk": {+ "name": "issue_attachment_issue_id_issue_id_fk",+ "tableFrom": "issue_attachment",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_attachment_public_id_unique": {+ "name": "issue_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist": {+ "name": "issue_checklist",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_issue_idx": {+ "name": "issue_checklist_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_issue_id_issue_id_fk": {+ "name": "issue_checklist_issue_id_issue_id_fk",+ "tableFrom": "issue_checklist",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist_item": {+ "name": "issue_checklist_item",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "checklist_id": {+ "name": "checklist_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "done": {+ "name": "done",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_item_checklist_idx": {+ "name": "issue_checklist_item_checklist_idx",+ "columns": [+ {+ "expression": "checklist_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",+ "tableFrom": "issue_checklist_item",+ "tableTo": "issue_checklist",+ "columnsFrom": [+ "checklist_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_cycle": {+ "name": "issue_cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_cycle_issue_idx": {+ "name": "issue_cycle_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_cycle_idx": {+ "name": "issue_cycle_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_open_idx": {+ "name": "issue_cycle_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"issue_cycle\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_cycle_issue_id_issue_id_fk": {+ "name": "issue_cycle_issue_id_issue_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_cycle_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_cycle_id_cycle_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_development_check": {+ "name": "issue_development_check",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "development_link_id": {+ "name": "development_link_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "app_id": {+ "name": "app_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "head_sha": {+ "name": "head_sha",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_development_check_link_sha_idx": {+ "name": "issue_development_check_link_sha_idx",+ "columns": [+ {+ "expression": "development_link_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "head_sha",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_development_check_development_link_id_issue_development_link_id_fk": {+ "name": "issue_development_check_development_link_id_issue_development_link_id_fk",+ "tableFrom": "issue_development_check",+ "tableTo": "issue_development_link",+ "columnsFrom": [+ "development_link_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_check_development_link_id_app_id_name_unique": {+ "name": "issue_development_check_development_link_id_app_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "development_link_id",+ "app_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_development_link": {+ "name": "issue_development_link",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "repository": {+ "name": "repository",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pull_request'"+ },+ "external_key": {+ "name": "external_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "number": {+ "name": "number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "draft": {+ "name": "draft",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "source_branch": {+ "name": "source_branch",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_branch": {+ "name": "target_branch",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "head_sha": {+ "name": "head_sha",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pipeline_status": {+ "name": "pipeline_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pipeline_url": {+ "name": "pipeline_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_development_link_issue_idx": {+ "name": "issue_development_link_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_development_link_pr_idx": {+ "name": "issue_development_link_pr_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "repository",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_development_link_sha_idx": {+ "name": "issue_development_link_sha_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "repository",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "head_sha",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_development_link_issue_id_issue_id_fk": {+ "name": "issue_development_link_issue_id_issue_id_fk",+ "tableFrom": "issue_development_link",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_link_issue_id_provider_repository_external_key_unique": {+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "provider",+ "repository",+ "external_key"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_option": {+ "name": "issue_field_option",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "option_id": {+ "name": "option_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_option_issue_id_issue_id_fk": {+ "name": "issue_field_option_issue_id_issue_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_field_id_custom_field_id_fk": {+ "name": "issue_field_option_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_option_id_custom_field_option_id_fk": {+ "name": "issue_field_option_option_id_custom_field_option_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field_option",+ "columnsFrom": [+ "option_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_field_option_issue_id_field_id_option_id_pk": {+ "name": "issue_field_option_issue_id_field_id_option_id_pk",+ "columns": [+ "issue_id",+ "field_id",+ "option_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_value": {+ "name": "issue_field_value",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value_text": {+ "name": "value_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "value_number": {+ "name": "value_number",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "value_bool": {+ "name": "value_bool",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "value_date": {+ "name": "value_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime": {+ "name": "value_datetime",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime_end": {+ "name": "value_datetime_end",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_user_id": {+ "name": "value_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_value_issue_id_issue_id_fk": {+ "name": "issue_field_value_issue_id_issue_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_field_id_custom_field_id_fk": {+ "name": "issue_field_value_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_value_user_id_user_id_fk": {+ "name": "issue_field_value_value_user_id_user_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "user",+ "columnsFrom": [+ "value_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_field_value_issue_id_field_id_unique": {+ "name": "issue_field_value_issue_id_field_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "field_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_import": {+ "name": "issue_import",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "attachment_id": {+ "name": "attachment_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'mapped'"+ },+ "mapping": {+ "name": "mapping",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error_text": {+ "name": "error_text",+ "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": {+ "issue_import_project_idx": {+ "name": "issue_import_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_import_project_id_project_id_fk": {+ "name": "issue_import_project_id_project_id_fk",+ "tableFrom": "issue_import",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_import_attachment_id_chat_attachment_id_fk": {+ "name": "issue_import_attachment_id_chat_attachment_id_fk",+ "tableFrom": "issue_import",+ "tableTo": "chat_attachment",+ "columnsFrom": [+ "attachment_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_import_public_id_unique": {+ "name": "issue_import_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_label": {+ "name": "issue_label",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_label_issue_id_issue_id_fk": {+ "name": "issue_label_issue_id_issue_id_fk",+ "tableFrom": "issue_label",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_label_label_id_label_id_fk": {+ "name": "issue_label_label_id_label_id_fk",+ "tableFrom": "issue_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_label_issue_id_label_id_pk": {+ "name": "issue_label_issue_id_label_id_pk",+ "columns": [+ "issue_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_link": {+ "name": "issue_link",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "target_issue_id": {+ "name": "target_issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_link_pair_kind_idx": {+ "name": "issue_link_pair_kind_idx",+ "columns": [+ {+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ },+ {+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_link_source_idx": {+ "name": "issue_link_source_idx",+ "columns": [+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_link_target_idx": {+ "name": "issue_link_target_idx",+ "columns": [+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_link_source_issue_id_issue_id_fk": {+ "name": "issue_link_source_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "tableTo": "issue",+ "columnsFrom": [+ "source_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_link_target_issue_id_issue_id_fk": {+ "name": "issue_link_target_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "tableTo": "issue",+ "columnsFrom": [+ "target_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_link_kind_check": {+ "name": "issue_link_kind_check",+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"+ },+ "issue_link_self_check": {+ "name": "issue_link_self_check",+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_status": {+ "name": "issue_status",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_name": {+ "name": "column_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_status_issue_idx": {+ "name": "issue_status_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_status_column_idx": {+ "name": "issue_status_column_idx",+ "columns": [+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_status_open_idx": {+ "name": "issue_status_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"issue_status\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_status_issue_id_issue_id_fk": {+ "name": "issue_status_issue_id_issue_id_fk",+ "tableFrom": "issue_status",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_status_column_id_project_column_id_fk": {+ "name": "issue_status_column_id_project_column_id_fk",+ "tableFrom": "issue_status",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_template": {+ "name": "issue_template",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "title_template": {+ "name": "title_template",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "description_template": {+ "name": "description_template",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_template_project_id_project_id_fk": {+ "name": "issue_template_project_id_project_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_template_type_id_issue_type_id_fk": {+ "name": "issue_template_type_id_issue_type_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_template_column_id_project_column_id_fk": {+ "name": "issue_template_column_id_project_column_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_template_assignee_user_id_user_id_fk": {+ "name": "issue_template_assignee_user_id_user_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_template_project_id_name_unique": {+ "name": "issue_template_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_template_label": {+ "name": "issue_template_label",+ "schema": "",+ "columns": {+ "template_id": {+ "name": "template_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_template_label_template_id_issue_template_id_fk": {+ "name": "issue_template_label_template_id_issue_template_id_fk",+ "tableFrom": "issue_template_label",+ "tableTo": "issue_template",+ "columnsFrom": [+ "template_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_template_label_label_id_label_id_fk": {+ "name": "issue_template_label_label_id_label_id_fk",+ "tableFrom": "issue_template_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_template_label_template_id_label_id_pk": {+ "name": "issue_template_label_template_id_label_id_pk",+ "columns": [+ "template_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_type": {+ "name": "issue_type",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_type_project_id_project_id_fk": {+ "name": "issue_type_project_id_project_id_fk",+ "tableFrom": "issue_type",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_type_project_id_name_unique": {+ "name": "issue_type_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_watcher": {+ "name": "issue_watcher",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subscribed": {+ "name": "subscribed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_watcher_issue_id_issue_id_fk": {+ "name": "issue_watcher_issue_id_issue_id_fk",+ "tableFrom": "issue_watcher",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_watcher_user_id_user_id_fk": {+ "name": "issue_watcher_user_id_user_id_fk",+ "tableFrom": "issue_watcher",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_watcher_issue_id_user_id_pk": {+ "name": "issue_watcher_issue_id_user_id_pk",+ "columns": [+ "issue_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_worklog": {+ "name": "issue_worklog",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "minutes": {+ "name": "minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "spent_on": {+ "name": "spent_on",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_worklog_issue_idx": {+ "name": "issue_worklog_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "spent_on",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_worklog_issue_id_issue_id_fk": {+ "name": "issue_worklog_issue_id_issue_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_worklog_user_id_user_id_fk": {+ "name": "issue_worklog_user_id_user_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_worklog_minutes_check": {+ "name": "issue_worklog_minutes_check",+ "value": "\"issue_worklog\".\"minutes\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.label": {+ "name": "label",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_project_id_project_id_fk": {+ "name": "label_project_id_project_id_fk",+ "tableFrom": "label",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "label_group_id_label_group_id_fk": {+ "name": "label_group_id_label_group_id_fk",+ "tableFrom": "label",+ "tableTo": "label_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_project_id_name_unique": {+ "name": "label_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.label_group": {+ "name": "label_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_group_project_id_project_id_fk": {+ "name": "label_group_project_id_project_id_fk",+ "tableFrom": "label_group",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_group_project_id_name_unique": {+ "name": "label_group_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board": {+ "name": "note_board",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "canvas": {+ "name": "canvas",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "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": {+ "note_board_project_idx": {+ "name": "note_board_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_project_id_project_id_fk": {+ "name": "note_board_project_id_project_id_fk",+ "tableFrom": "note_board",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_owner_user_id_user_id_fk": {+ "name": "note_board_owner_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_created_by_user_id_user_id_fk": {+ "name": "note_board_created_by_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board_member": {+ "name": "note_board_member",+ "schema": "",+ "columns": {+ "board_id": {+ "name": "board_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "note_board_member_user_idx": {+ "name": "note_board_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_member_board_id_note_board_id_fk": {+ "name": "note_board_member_board_id_note_board_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "note_board",+ "columnsFrom": [+ "board_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_member_user_id_user_id_fk": {+ "name": "note_board_member_user_id_user_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "note_board_member_board_id_user_id_pk": {+ "name": "note_board_member_board_id_user_id_pk",+ "columns": [+ "board_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification": {+ "name": "notification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "read_at": {+ "name": "read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "notification_user_idx": {+ "name": "notification_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "notification_user_unread_idx": {+ "name": "notification_user_unread_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification\".\"read_at\" IS NULL",+ "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": "no action"+ },+ "notification_project_id_project_id_fk": {+ "name": "notification_project_id_project_id_fk",+ "tableFrom": "notification",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_issue_id_issue_id_fk": {+ "name": "notification_issue_id_issue_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_source_activity_id_issue_activity_id_fk": {+ "name": "notification_source_activity_id_issue_activity_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "notification_actor_user_id_user_id_fk": {+ "name": "notification_actor_user_id_user_id_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_type_check": {+ "name": "notification_type_check",+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.notification_delivery": {+ "name": "notification_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "channel": {+ "name": "channel",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "recipient": {+ "name": "recipient",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "notification_delivery_due_idx": {+ "name": "notification_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_delivery_project_id_project_id_fk": {+ "name": "notification_delivery_project_id_project_id_fk",+ "tableFrom": "notification_delivery",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_delivery_channel_check": {+ "name": "notification_delivery_channel_check",+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "next_sequence": {+ "name": "next_sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "initiatives_enabled": {+ "name": "initiatives_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "dashboards_enabled": {+ "name": "dashboards_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "documents_enabled": {+ "name": "documents_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "notes_enabled": {+ "name": "notes_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "cycles_enabled": {+ "name": "cycles_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "subtasks_enabled": {+ "name": "subtasks_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "checklists_enabled": {+ "name": "checklists_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_enabled": {+ "name": "issue_stats_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "points_estimate_enabled": {+ "name": "points_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_estimate_enabled": {+ "name": "time_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_logging_enabled": {+ "name": "time_logging_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_team_id_team_id_fk": {+ "name": "project_team_id_team_id_fk",+ "tableFrom": "project",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_team_key_uq": {+ "name": "project_team_key_uq",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "key"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_action": {+ "name": "project_action",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "condition": {+ "name": "condition",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "effect": {+ "name": "effect",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_action_project_idx": {+ "name": "project_action_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_action_project_id_project_id_fk": {+ "name": "project_action_project_id_project_id_fk",+ "tableFrom": "project_action",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_column": {+ "name": "project_column",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unstarted'"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "wip_limit": {+ "name": "wip_limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "wip_mode": {+ "name": "wip_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'soft'"+ },+ "auto_assign_user_id": {+ "name": "auto_assign_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_column_project_id_project_id_fk": {+ "name": "project_column_project_id_project_id_fk",+ "tableFrom": "project_column",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_column_auto_assign_user_id_user_id_fk": {+ "name": "project_column_auto_assign_user_id_user_id_fk",+ "tableFrom": "project_column",+ "tableTo": "user",+ "columnsFrom": [+ "auto_assign_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_column_project_id_position_unique": {+ "name": "project_column_project_id_position_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "position"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_column_state_type_check": {+ "name": "project_column_state_type_check",+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"+ },+ "project_column_wip_mode_check": {+ "name": "project_column_wip_mode_check",+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"+ },+ "project_column_wip_limit_check": {+ "name": "project_column_wip_limit_check",+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_dashboard": {+ "name": "project_dashboard",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "layout": {+ "name": "layout",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_dashboard_project_idx": {+ "name": "project_dashboard_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_dashboard_project_id_project_id_fk": {+ "name": "project_dashboard_project_id_project_id_fk",+ "tableFrom": "project_dashboard",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document": {+ "name": "project_document",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "full_width": {+ "name": "full_width",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_locked": {+ "name": "is_locked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_ancestor_id": {+ "name": "archived_by_ancestor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "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": {+ "project_document_project_tree_idx": {+ "name": "project_document_project_tree_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_document_owner_idx": {+ "name": "project_document_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_document_project_archive_idx": {+ "name": "project_document_project_archive_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "archived_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_project_id_project_id_fk": {+ "name": "project_document_project_id_project_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_parent_id_project_document_id_fk": {+ "name": "project_document_parent_id_project_document_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project_document",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_archived_by_ancestor_id_project_document_id_fk": {+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project_document",+ "columnsFrom": [+ "archived_by_ancestor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_owner_user_id_user_id_fk": {+ "name": "project_document_owner_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_created_by_user_id_user_id_fk": {+ "name": "project_document_created_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_updated_by_user_id_user_id_fk": {+ "name": "project_document_updated_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "updated_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_document_version_check": {+ "name": "project_document_version_check",+ "value": "\"project_document\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_document_initiative": {+ "name": "project_document_initiative",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_initiative_initiative_idx": {+ "name": "project_document_initiative_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_initiative_document_id_project_document_id_fk": {+ "name": "project_document_initiative_document_id_project_document_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_initiative_initiative_id_initiative_id_fk": {+ "name": "project_document_initiative_initiative_id_initiative_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_initiative_created_by_user_id_user_id_fk": {+ "name": "project_document_initiative_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_document_initiative_document_id_initiative_id_pk": {+ "name": "project_document_initiative_document_id_initiative_id_pk",+ "columns": [+ "document_id",+ "initiative_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_issue": {+ "name": "project_document_issue",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_issue_issue_idx": {+ "name": "project_document_issue_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_issue_document_id_project_document_id_fk": {+ "name": "project_document_issue_document_id_project_document_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_issue_issue_id_issue_id_fk": {+ "name": "project_document_issue_issue_id_issue_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_issue_created_by_user_id_user_id_fk": {+ "name": "project_document_issue_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_document_issue_document_id_issue_id_pk": {+ "name": "project_document_issue_document_id_issue_id_pk",+ "columns": [+ "document_id",+ "issue_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_preference": {+ "name": "project_document_preference",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_favorite": {+ "name": "is_favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_preference_user_idx": {+ "name": "project_document_preference_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_preference_document_id_project_document_id_fk": {+ "name": "project_document_preference_document_id_project_document_id_fk",+ "tableFrom": "project_document_preference",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_preference_user_id_user_id_fk": {+ "name": "project_document_preference_user_id_user_id_fk",+ "tableFrom": "project_document_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_document_preference_document_id_user_id_pk": {+ "name": "project_document_preference_document_id_user_id_pk",+ "columns": [+ "document_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_revision": {+ "name": "project_document_revision",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "full_width": {+ "name": "full_width",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_locked": {+ "name": "is_locked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_revision_document_idx": {+ "name": "project_document_revision_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_revision_document_id_project_document_id_fk": {+ "name": "project_document_revision_document_id_project_document_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_revision_owner_user_id_user_id_fk": {+ "name": "project_document_revision_owner_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_revision_created_by_user_id_user_id_fk": {+ "name": "project_document_revision_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_document_revision_document_version_unique": {+ "name": "project_document_revision_document_version_unique",+ "nullsNotDistinct": false,+ "columns": [+ "document_id",+ "version"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_member": {+ "name": "project_member",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "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'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invite'"+ },+ "is_favorite": {+ "name": "is_favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_hidden": {+ "name": "is_hidden",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_member_user_idx": {+ "name": "project_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_member_project_id_project_id_fk": {+ "name": "project_member_project_id_project_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_user_id_user_id_fk": {+ "name": "project_member_user_id_user_id_fk",+ "tableFrom": "project_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_role_id_team_role_id_fk": {+ "name": "project_member_role_id_team_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_member_project_id_user_id_pk": {+ "name": "project_member_project_id_user_id_pk",+ "columns": [+ "project_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_member_role_check": {+ "name": "project_member_role_check",+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"+ },+ "project_member_source_check": {+ "name": "project_member_source_check",+ "value": "\"project_member\".\"source\" IN ('invite', 'scim')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_setting": {+ "name": "project_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_setting_project_id_project_id_fk": {+ "name": "project_setting_project_id_project_id_fk",+ "tableFrom": "project_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_setting_project_id_key_pk": {+ "name": "project_setting_project_id_key_pk",+ "columns": [+ "project_id",+ "key"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view": {+ "name": "project_view",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "filters": {+ "name": "filters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "display": {+ "name": "display",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_view_project_idx": {+ "name": "project_view_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_view_project_id_project_id_fk": {+ "name": "project_view_project_id_project_id_fk",+ "tableFrom": "project_view",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_view_share_token_unique": {+ "name": "project_view_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view_favorite": {+ "name": "project_view_favorite",+ "schema": "",+ "columns": {+ "view_id": {+ "name": "view_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_view_favorite_view_id_project_view_id_fk": {+ "name": "project_view_favorite_view_id_project_view_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "project_view",+ "columnsFrom": [+ "view_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_view_favorite_user_id_user_id_fk": {+ "name": "project_view_favorite_user_id_user_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_view_favorite_view_id_user_id_pk": {+ "name": "project_view_favorite_view_id_user_id_pk",+ "columns": [+ "view_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.revision": {+ "name": "revision",+ "schema": "",+ "columns": {+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "rev": {+ "name": "rev",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {+ "revision_project_idx": {+ "name": "revision_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team": {+ "name": "team",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "default_agent_ids": {+ "name": "default_agent_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_workspace_idx": {+ "name": "team_workspace_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": {+ "team_slug_unique": {+ "name": "team_slug_unique",+ "nullsNotDistinct": false,+ "columns": [+ "slug"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_invite": {+ "name": "team_invite",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "team_role": {+ "name": "team_role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "project_role": {+ "name": "project_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "invited_by_user_id": {+ "name": "invited_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accepted_by_user_id": {+ "name": "accepted_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "responded_at": {+ "name": "responded_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "team_invite_team_pending_uq": {+ "name": "team_invite_team_pending_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_project_pending_uq": {+ "name": "team_invite_project_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_team_idx": {+ "name": "team_invite_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_project_idx": {+ "name": "team_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_invite_team_id_team_id_fk": {+ "name": "team_invite_team_id_team_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_invite_project_id_project_id_fk": {+ "name": "team_invite_project_id_project_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_invite_role_id_team_role_id_fk": {+ "name": "team_invite_role_id_team_role_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "team_invite_invited_by_user_id_user_id_fk": {+ "name": "team_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "team_invite_accepted_by_user_id_user_id_fk": {+ "name": "team_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_invite_token_unique": {+ "name": "team_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "team_invite_team_role_check": {+ "name": "team_invite_team_role_check",+ "value": "\"team_invite\".\"team_role\" IN ('owner', 'manager', 'member')"+ },+ "team_invite_project_role_check": {+ "name": "team_invite_project_role_check",+ "value": "(\"team_invite\".\"project_id\" IS NULL AND \"team_invite\".\"project_role\" IS NULL)\n OR (\"team_invite\".\"project_id\" IS NOT NULL AND \"team_invite\".\"project_role\" IN ('owner', 'member'))"+ },+ "team_invite_status_check": {+ "name": "team_invite_status_check",+ "value": "\"team_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team_member": {+ "name": "team_member",+ "schema": "",+ "columns": {+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "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'"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invite'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_member_user_idx": {+ "name": "team_member_user_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": {+ "team_member_team_id_user_id_pk": {+ "name": "team_member_team_id_user_id_pk",+ "columns": [+ "team_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "team_member_role_check": {+ "name": "team_member_role_check",+ "value": "\"team_member\".\"role\" IN ('owner', 'manager', 'member', 'agent')"+ },+ "team_member_source_check": {+ "name": "team_member_source_check",+ "value": "\"team_member\".\"source\" IN ('invite', 'scim')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team_notification_setting": {+ "name": "team_notification_setting",+ "schema": "",+ "columns": {+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "team_notification_setting_team_id_team_id_fk": {+ "name": "team_notification_setting_team_id_team_id_fk",+ "tableFrom": "team_notification_setting",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_role": {+ "name": "team_role",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "permissions": {+ "name": "permissions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_role_default_uq": {+ "name": "team_role_default_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_role_team_idx": {+ "name": "team_role_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_role_team_id_team_id_fk": {+ "name": "team_role_team_id_team_id_fk",+ "tableFrom": "team_role",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_role_team_id_name_unique": {+ "name": "team_role_team_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_notification_preference": {+ "name": "user_notification_preference",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email_events": {+ "name": "email_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "telegram_events": {+ "name": "telegram_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "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": {},+ "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": "no action"+ },+ "user_notification_preference_project_id_project_id_fk": {+ "name": "user_notification_preference_project_id_project_id_fk",+ "tableFrom": "user_notification_preference",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_notification_pref_user_project_unique": {+ "name": "user_notification_pref_user_project_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id",+ "project_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_preference": {+ "name": "user_preference",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'UTC'"+ },+ "locale": {+ "name": "locale",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'en'"+ },+ "theme": {+ "name": "theme",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "issue_open_mode": {+ "name": "issue_open_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'panel'"+ },+ "start_page": {+ "name": "start_page",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'work-items'"+ },+ "show_chat_by_default": {+ "name": "show_chat_by_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "issue_stats_open": {+ "name": "issue_stats_open",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_view": {+ "name": "issue_stats_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compact'"+ },+ "issue_activity_view": {+ "name": "issue_activity_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'flat'"+ },+ "auto_watch": {+ "name": "auto_watch",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "hotkeys": {+ "name": "hotkeys",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_project_id": {+ "name": "last_project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "seen_version": {+ "name": "seen_version",+ "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": {},+ "foreignKeys": {+ "user_preference_user_id_user_id_fk": {+ "name": "user_preference_user_id_user_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_preference_last_project_id_project_id_fk": {+ "name": "user_preference_last_project_id_project_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "project",+ "columnsFrom": [+ "last_project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "user_preference_theme_check": {+ "name": "user_preference_theme_check",+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"+ },+ "user_preference_issue_open_mode_check": {+ "name": "user_preference_issue_open_mode_check",+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"+ },+ "user_preference_start_page_check": {+ "name": "user_preference_start_page_check",+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"+ },+ "user_preference_issue_stats_view_check": {+ "name": "user_preference_issue_stats_view_check",+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"+ },+ "user_preference_issue_activity_view_check": {+ "name": "user_preference_issue_activity_view_check",+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"+ }+ },+ "isRLSEnabled": false+ },+ "public.user_telegram_account": {+ "name": "user_telegram_account",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "chat_id": {+ "name": "chat_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_name": {+ "name": "first_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "link_code": {+ "name": "link_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "link_code_expires_at": {+ "name": "link_code_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "linked_at": {+ "name": "linked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_telegram_account_chat_id_unique": {+ "name": "user_telegram_account_chat_id_unique",+ "columns": [+ {+ "expression": "chat_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_telegram_account_link_code_unique": {+ "name": "user_telegram_account_link_code_unique",+ "columns": [+ {+ "expression": "link_code",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_telegram_account_user_id_user_id_fk": {+ "name": "user_telegram_account_user_id_user_id_fk",+ "tableFrom": "user_telegram_account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.webhook": {+ "name": "webhook",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "events": {+ "name": "events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "consecutive_failures": {+ "name": "consecutive_failures",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "webhook_project_idx": {+ "name": "webhook_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "webhook_project_id_project_id_fk": {+ "name": "webhook_project_id_project_id_fk",+ "tableFrom": "webhook",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.webhook_delivery": {+ "name": "webhook_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "webhook_id": {+ "name": "webhook_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "event_id": {+ "name": "event_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "response_status": {+ "name": "response_status",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "response_body": {+ "name": "response_body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "webhook_delivery_due_idx": {+ "name": "webhook_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"webhook_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "webhook_delivery_webhook_idx": {+ "name": "webhook_delivery_webhook_idx",+ "columns": [+ {+ "expression": "webhook_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "webhook_delivery_webhook_id_webhook_id_fk": {+ "name": "webhook_delivery_webhook_id_webhook_id_fk",+ "tableFrom": "webhook_delivery",+ "tableTo": "webhook",+ "columnsFrom": [+ "webhook_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace": {+ "name": "workspace",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace_manager": {+ "name": "workspace_manager",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "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": "'admin'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_manager_owner_uq": {+ "name": "workspace_manager_owner_uq",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"workspace_manager\".\"role\" = 'owner'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_manager_user_idx": {+ "name": "workspace_manager_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_manager_workspace_id_workspace_id_fk": {+ "name": "workspace_manager_workspace_id_workspace_id_fk",+ "tableFrom": "workspace_manager",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "workspace_manager_user_id_user_id_fk": {+ "name": "workspace_manager_user_id_user_id_fk",+ "tableFrom": "workspace_manager",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "workspace_manager_workspace_id_user_id_pk": {+ "name": "workspace_manager_workspace_id_user_id_pk",+ "columns": [+ "workspace_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "workspace_manager_role_check": {+ "name": "workspace_manager_role_check",+ "value": "\"workspace_manager\".\"role\" IN ('owner', 'admin')"+ }+ },+ "isRLSEnabled": false+ },+ "public.scim_group": {+ "name": "scim_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "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": {},+ "foreignKeys": {+ "scim_group_workspace_id_workspace_id_fk": {+ "name": "scim_group_workspace_id_workspace_id_fk",+ "tableFrom": "scim_group",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_workspace_id_display_name_unique": {+ "name": "scim_group_workspace_id_display_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "workspace_id",+ "display_name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.scim_group_mapping": {+ "name": "scim_group_mapping",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "scim_group_mapping_project_idx": {+ "name": "scim_group_mapping_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_mapping_group_id_scim_group_id_fk": {+ "name": "scim_group_mapping_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "scim_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_mapping_project_id_project_id_fk": {+ "name": "scim_group_mapping_project_id_project_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_mapping_role_id_team_role_id_fk": {+ "name": "scim_group_mapping_role_id_team_role_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_mapping_group_id_project_id_unique": {+ "name": "scim_group_mapping_group_id_project_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "group_id",+ "project_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "scim_group_mapping_role_check": {+ "name": "scim_group_mapping_role_check",+ "value": "\"scim_group_mapping\".\"role\" IN ('owner', 'member')"+ }+ },+ "isRLSEnabled": false+ },+ "public.scim_group_member": {+ "name": "scim_group_member",+ "schema": "",+ "columns": {+ "group_id": {+ "name": "group_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "scim_group_member_user_idx": {+ "name": "scim_group_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_member_group_id_scim_group_id_fk": {+ "name": "scim_group_member_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_member",+ "tableTo": "scim_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_member_user_id_user_id_fk": {+ "name": "scim_group_member_user_id_user_id_fk",+ "tableFrom": "scim_group_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "scim_group_member_group_id_user_id_pk": {+ "name": "scim_group_member_group_id_user_id_pk",+ "columns": [+ "group_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.scim_user": {+ "name": "scim_user",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "active": {+ "name": "active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "scim_user_user_idx": {+ "name": "scim_user_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_user_workspace_id_workspace_id_fk": {+ "name": "scim_user_workspace_id_workspace_id_fk",+ "tableFrom": "scim_user",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_user_user_id_user_id_fk": {+ "name": "scim_user_user_id_user_id_fk",+ "tableFrom": "scim_user",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "scim_user_workspace_id_user_id_pk": {+ "name": "scim_user_workspace_id_user_id_pk",+ "columns": [+ "workspace_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/0141_snapshot.json b/packages/db/drizzle/meta/0141_snapshot.jsonnew file mode 100644index 00000000..9b207d97--- /dev/null+++ b/packages/db/drizzle/meta/0141_snapshot.json@@ -0,0 +1,11295 @@+{+ "id": "c736bbbe-ac3b-431a-b2b2-a6021af53090",+ "prevId": "9f734828-62f2-427b-b1c4-12797e44fcf9",+ "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()"+ },+ "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.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+ },+ "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": 1000+ },+ "rate_limit_max": {+ "name": "rate_limit_max",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 100+ },+ "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_referenceId_idx": {+ "name": "apikey_referenceId_idx",+ "columns": [+ {+ "expression": "reference_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": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_access_token": {+ "name": "oauth_access_token",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "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": true+ }+ },+ "indexes": {+ "oauthAccessToken_clientId_idx": {+ "name": "oauthAccessToken_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessToken_userId_idx": {+ "name": "oauthAccessToken_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_access_token_client_id_oauth_application_client_id_fk": {+ "name": "oauth_access_token_client_id_oauth_application_client_id_fk",+ "tableFrom": "oauth_access_token",+ "tableTo": "oauth_application",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_access_token_user_id_user_id_fk": {+ "name": "oauth_access_token_user_id_user_id_fk",+ "tableFrom": "oauth_access_token",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_access_token_access_token_unique": {+ "name": "oauth_access_token_access_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "access_token"+ ]+ },+ "oauth_access_token_refresh_token_unique": {+ "name": "oauth_access_token_refresh_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "refresh_token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_application": {+ "name": "oauth_application",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_secret": {+ "name": "client_secret",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "redirect_urls": {+ "name": "redirect_urls",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "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+ }+ },+ "indexes": {+ "oauthApplication_userId_idx": {+ "name": "oauthApplication_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_application_user_id_user_id_fk": {+ "name": "oauth_application_user_id_user_id_fk",+ "tableFrom": "oauth_application",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_application_client_id_unique": {+ "name": "oauth_application_client_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "client_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_consent": {+ "name": "oauth_consent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scopes": {+ "name": "scopes",+ "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": true+ },+ "consent_given": {+ "name": "consent_given",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthConsent_clientId_idx": {+ "name": "oauthConsent_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthConsent_userId_idx": {+ "name": "oauthConsent_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_consent_client_id_oauth_application_client_id_fk": {+ "name": "oauth_consent_client_id_oauth_application_client_id_fk",+ "tableFrom": "oauth_consent",+ "tableTo": "oauth_application",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_consent_user_id_user_id_fk": {+ "name": "oauth_consent_user_id_user_id_fk",+ "tableFrom": "oauth_consent",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.passkey": {+ "name": "passkey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "public_key": {+ "name": "public_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "device_type": {+ "name": "device_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "backed_up": {+ "name": "backed_up",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "aaguid": {+ "name": "aaguid",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "passkey_userId_idx": {+ "name": "passkey_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "passkey_credentialID_idx": {+ "name": "passkey_credentialID_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "passkey_user_id_user_id_fk": {+ "name": "passkey_user_id_user_id_fk",+ "tableFrom": "passkey",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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()"+ },+ "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+ }+ },+ "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.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,+ "default": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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()"+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_username": {+ "name": "display_username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'user'"+ },+ "active": {+ "name": "active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ },+ "user_username_unique": {+ "name": "user_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "username"+ ]+ }+ },+ "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()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "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.agent_chat_event": {+ "name": "agent_chat_event",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "bigserial",+ "primaryKey": true,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_event_message_idx": {+ "name": "agent_chat_event_message_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_event_message_id_agent_chat_message_id_fk": {+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",+ "tableFrom": "agent_chat_event",+ "tableTo": "agent_chat_message",+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_favorite": {+ "name": "agent_chat_favorite",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "agent_chat_favorite_user_id_user_id_fk": {+ "name": "agent_chat_favorite_user_id_user_id_fk",+ "tableFrom": "agent_chat_favorite",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_favorite",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_chat_favorite_user_id_thread_id_pk": {+ "name": "agent_chat_favorite_user_id_thread_id_pk",+ "columns": [+ "user_id",+ "thread_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_message": {+ "name": "agent_chat_message",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_message_thread_idx": {+ "name": "agent_chat_message_thread_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_chat_message_due_idx": {+ "name": "agent_chat_message_due_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "agent_chat_thread",+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_message_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_chat_message_role_check": {+ "name": "agent_chat_message_role_check",+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"+ },+ "agent_chat_message_status_check": {+ "name": "agent_chat_message_status_check",+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_chat_thread": {+ "name": "agent_chat_thread",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cli_session_id": {+ "name": "cli_session_id",+ "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": {+ "agent_chat_thread_agent_user_idx": {+ "name": "agent_chat_thread_agent_user_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_thread_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_thread_user_id_user_id_fk": {+ "name": "agent_chat_thread_user_id_user_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_usage": {+ "name": "agent_chat_usage",+ "schema": "",+ "columns": {+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_usage_agent_idx": {+ "name": "agent_chat_usage_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_usage_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_usage",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_field_trigger": {+ "name": "agent_field_trigger",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "delay_sec": {+ "name": "delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ }+ },+ "indexes": {+ "agent_field_trigger_field_idx": {+ "name": "agent_field_trigger_field_idx",+ "columns": [+ {+ "expression": "field_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_field_trigger_agent_id_ai_agent_id_fk": {+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_field_trigger_field_id_custom_field_id_fk": {+ "name": "agent_field_trigger_field_id_custom_field_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_field_trigger_agent_id_field_id_pk": {+ "name": "agent_field_trigger_agent_id_field_id_pk",+ "columns": [+ "agent_id",+ "field_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_field_trigger_delay_check": {+ "name": "agent_field_trigger_delay_check",+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_run": {+ "name": "agent_run",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "schedule_id": {+ "name": "schedule_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'delegation'"+ },+ "scheduled_for": {+ "name": "scheduled_for",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "output": {+ "name": "output",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_run_schedule_fire_uq": {+ "name": "agent_run_schedule_fire_uq",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scheduled_for",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_due_idx": {+ "name": "agent_run_due_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_schedule_idx": {+ "name": "agent_run_schedule_idx",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_project_idx": {+ "name": "agent_run_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_run_agent_id_ai_agent_id_fk": {+ "name": "agent_run_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_project_id_project_id_fk": {+ "name": "agent_run_project_id_project_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_issue_id_issue_id_fk": {+ "name": "agent_run_issue_id_issue_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_schedule_id_agent_schedule_id_fk": {+ "name": "agent_run_schedule_id_agent_schedule_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "agent_schedule",+ "columnsFrom": [+ "schedule_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_source_activity_id_issue_activity_id_fk": {+ "name": "agent_run_source_activity_id_issue_activity_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_run_status_check": {+ "name": "agent_run_status_check",+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed', 'canceled')"+ },+ "agent_run_trigger_check": {+ "name": "agent_run_trigger_check",+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', 'schedule', 'manual')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_schedule": {+ "name": "agent_schedule",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "next_run_at": {+ "name": "next_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_schedule_due_idx": {+ "name": "agent_schedule_due_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_agent_idx": {+ "name": "agent_schedule_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_project_idx": {+ "name": "agent_schedule_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_schedule_agent_id_ai_agent_id_fk": {+ "name": "agent_schedule_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_schedule_project_id_project_id_fk": {+ "name": "agent_schedule_project_id_project_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_project_id_agent_id_name_unique": {+ "name": "agent_schedule_project_id_agent_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "agent_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_schedule_status_check": {+ "name": "agent_schedule_status_check",+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill": {+ "name": "agent_skill",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_url": {+ "name": "source_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_prefix": {+ "name": "s3_prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "files": {+ "name": "files",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_skill_team_idx": {+ "name": "agent_skill_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_team_id_team_id_fk": {+ "name": "agent_skill_team_id_team_id_fk",+ "tableFrom": "agent_skill",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_team_id_name_unique": {+ "name": "agent_skill_team_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_skill_source_check": {+ "name": "agent_skill_source_check",+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill_link": {+ "name": "agent_skill_link",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "skill_id": {+ "name": "skill_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_skill_link_skill_idx": {+ "name": "agent_skill_link_skill_idx",+ "columns": [+ {+ "expression": "skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_link_agent_id_ai_agent_id_fk": {+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_skill_link",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_skill_link_skill_id_agent_skill_id_fk": {+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",+ "tableFrom": "agent_skill_link",+ "tableTo": "agent_skill",+ "columnsFrom": [+ "skill_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_skill_link_agent_id_skill_id_pk": {+ "name": "agent_skill_link_agent_id_skill_id_pk",+ "columns": [+ "agent_id",+ "skill_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_tool": {+ "name": "agent_tool",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "tool_key": {+ "name": "tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_tool_team_idx": {+ "name": "agent_tool_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_tool_credential_idx": {+ "name": "agent_tool_credential_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_tool_team_id_team_id_fk": {+ "name": "agent_tool_team_id_team_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_tool_credential_id_integration_credential_id_fk": {+ "name": "agent_tool_credential_id_integration_credential_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "integration_credential",+ "columnsFrom": [+ "credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_tool_team_id_tool_key_credential_id_unique": {+ "name": "agent_tool_team_id_tool_key_credential_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "tool_key",+ "credential_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_tool_link": {+ "name": "agent_tool_link",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "agent_tool_id": {+ "name": "agent_tool_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_tool_link_tool_idx": {+ "name": "agent_tool_link_tool_idx",+ "columns": [+ {+ "expression": "agent_tool_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_tool_link_agent_id_ai_agent_id_fk": {+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_tool_link",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",+ "tableFrom": "agent_tool_link",+ "tableTo": "agent_tool",+ "columnsFrom": [+ "agent_tool_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_tool_link_agent_id_agent_tool_id_pk": {+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",+ "columns": [+ "agent_id",+ "agent_tool_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.ai_agent": {+ "name": "ai_agent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model_credential_id": {+ "name": "model_credential_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tools": {+ "name": "tools",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "temperature": {+ "name": "temperature",+ "type": "double precision",+ "primaryKey": false,+ "notNull": false+ },+ "max_steps": {+ "name": "max_steps",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_on_mention": {+ "name": "trigger_on_mention",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "trigger_on_assign": {+ "name": "trigger_on_assign",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "delegation_delay_sec": {+ "name": "delegation_delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ },+ "api_key_ciphertext": {+ "name": "api_key_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "api_key_iv": {+ "name": "api_key_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "api_key_auth_tag": {+ "name": "api_key_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_enabled": {+ "name": "memory_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "memory_last_messages": {+ "name": "memory_last_messages",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runner_scope": {+ "name": "runner_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'team'"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "ai_agent_team_username_uq": {+ "name": "ai_agent_team_username_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"username\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_agent_team_idx": {+ "name": "ai_agent_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_agent_team_id_team_id_fk": {+ "name": "ai_agent_team_id_team_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_agent_user_id_user_id_fk": {+ "name": "ai_agent_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_agent_model_credential_id_integration_credential_id_fk": {+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "integration_credential",+ "columnsFrom": [+ "model_credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "ai_agent_owner_user_id_user_id_fk": {+ "name": "ai_agent_owner_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "ai_agent_user_id_unique": {+ "name": "ai_agent_user_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "ai_agent_kind_check": {+ "name": "ai_agent_kind_check",+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"+ },+ "ai_agent_runner_scope_check": {+ "name": "ai_agent_runner_scope_check",+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'team')"+ },+ "ai_agent_delegation_delay_check": {+ "name": "ai_agent_delegation_delay_check",+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.app_secret": {+ "name": "app_secret",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.app_setting": {+ "name": "app_setting",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.chat_attachment": {+ "name": "chat_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by_user_id": {+ "name": "uploaded_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "chat_attachment_project_idx": {+ "name": "chat_attachment_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chat_attachment_project_id_project_id_fk": {+ "name": "chat_attachment_project_id_project_id_fk",+ "tableFrom": "chat_attachment",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_attachment_uploaded_by_user_id_user_id_fk": {+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",+ "tableFrom": "chat_attachment",+ "tableTo": "user",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "chat_attachment_public_id_unique": {+ "name": "chat_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.custom_field": {+ "name": "custom_field",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_type_id": {+ "name": "issue_type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "field_type": {+ "name": "field_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "member_scope": {+ "name": "member_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "show_in_body": {+ "name": "show_in_body",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_project_id_project_id_fk": {+ "name": "custom_field_project_id_project_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "custom_field_issue_type_id_issue_type_id_fk": {+ "name": "custom_field_issue_type_id_issue_type_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "issue_type",+ "columnsFrom": [+ "issue_type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "custom_field_field_type_check": {+ "name": "custom_field_field_type_check",+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"+ },+ "custom_field_member_scope_check": {+ "name": "custom_field_member_scope_check",+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"+ }+ },+ "isRLSEnabled": false+ },+ "public.custom_field_option": {+ "name": "custom_field_option",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_option_field_id_custom_field_id_fk": {+ "name": "custom_field_option_field_id_custom_field_id_fk",+ "tableFrom": "custom_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "custom_field_option_field_id_value_unique": {+ "name": "custom_field_option_field_id_value_unique",+ "nullsNotDistinct": false,+ "columns": [+ "field_id",+ "value"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cycle": {+ "name": "cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "goal": {+ "name": "goal",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "end_date": {+ "name": "end_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "cycle_project_idx": {+ "name": "cycle_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "start_date",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "cycle_project_id_project_id_fk": {+ "name": "cycle_project_id_project_id_fk",+ "tableFrom": "cycle",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "cycle_dates_check": {+ "name": "cycle_dates_check",+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""+ }+ },+ "isRLSEnabled": false+ },+ "public.document_asset": {+ "name": "document_asset",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by_user_id": {+ "name": "uploaded_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_asset_document_idx": {+ "name": "document_asset_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_asset_document_id_project_document_id_fk": {+ "name": "document_asset_document_id_project_document_id_fk",+ "tableFrom": "document_asset",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_asset_uploaded_by_user_id_user_id_fk": {+ "name": "document_asset_uploaded_by_user_id_user_id_fk",+ "tableFrom": "document_asset",+ "tableTo": "user",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "document_asset_public_id_unique": {+ "name": "document_asset_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_collaboration": {+ "name": "document_collaboration",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "epoch": {+ "name": "epoch",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_collaboration_document_id_project_document_id_fk": {+ "name": "document_collaboration_document_id_project_document_id_fk",+ "tableFrom": "document_collaboration",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_comment": {+ "name": "document_comment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_id": {+ "name": "author_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "quote": {+ "name": "quote",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "selection_from": {+ "name": "selection_from",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "selection_to": {+ "name": "selection_to",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "orphaned": {+ "name": "orphaned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_comment_document_idx": {+ "name": "document_comment_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_comment_document_id_project_document_id_fk": {+ "name": "document_comment_document_id_project_document_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_parent_id_document_comment_id_fk": {+ "name": "document_comment_parent_id_document_comment_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "document_comment",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_author_id_user_id_fk": {+ "name": "document_comment_author_id_user_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "user",+ "columnsFrom": [+ "author_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_step": {+ "name": "document_step",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "step": {+ "name": "step",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_step_document_id_project_document_id_fk": {+ "name": "document_step_document_id_project_document_id_fk",+ "tableFrom": "document_step",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "document_step_document_id_version_pk": {+ "name": "document_step_document_id_version_pk",+ "columns": [+ "document_id",+ "version"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.git_managed_repository": {+ "name": "git_managed_repository",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "connection_id": {+ "name": "connection_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "full_name": {+ "name": "full_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "web_url": {+ "name": "web_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "webhook_external_id": {+ "name": "webhook_external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'connected'"+ },+ "last_error": {+ "name": "last_error",+ "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": {+ "git_managed_repository_project_connection_idx": {+ "name": "git_managed_repository_project_connection_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "git_managed_repository_project_id_project_id_fk": {+ "name": "git_managed_repository_project_id_project_id_fk",+ "tableFrom": "git_managed_repository",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "git_managed_repository_connection_id_git_provider_connection_id_fk": {+ "name": "git_managed_repository_connection_id_git_provider_connection_id_fk",+ "tableFrom": "git_managed_repository",+ "tableTo": "git_provider_connection",+ "columnsFrom": [+ "connection_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "git_managed_repository_project_connection_external_unique": {+ "name": "git_managed_repository_project_connection_external_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "connection_id",+ "external_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.git_provider_connection": {+ "name": "git_provider_connection",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "base_url": {+ "name": "base_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "account_login": {+ "name": "account_login",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "git_provider_connection_team_idx": {+ "name": "git_provider_connection_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "git_provider_connection_team_id_team_id_fk": {+ "name": "git_provider_connection_team_id_team_id_fk",+ "tableFrom": "git_provider_connection",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.import_job": {+ "name": "import_job",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "phase": {+ "name": "phase",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'discover'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "cursor": {+ "name": "cursor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "credential_ciphertext": {+ "name": "credential_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_iv": {+ "name": "credential_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_auth_tag": {+ "name": "credential_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "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": {+ "import_job_project_idx": {+ "name": "import_job_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_job_due_idx": {+ "name": "import_job_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"import_job\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "import_job_project_id_project_id_fk": {+ "name": "import_job_project_id_project_id_fk",+ "tableFrom": "import_job",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "import_job_created_by_user_id_user_id_fk": {+ "name": "import_job_created_by_user_id_user_id_fk",+ "tableFrom": "import_job",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "import_job_source_check": {+ "name": "import_job_source_check",+ "value": "\"import_job\".\"source\" IN ('plane')"+ },+ "import_job_phase_check": {+ "name": "import_job_phase_check",+ "value": "\"import_job\".\"phase\" IN ('discover', 'create', 'link', 'rewrite', 'attachments', 'done')"+ },+ "import_job_status_check": {+ "name": "import_job_status_check",+ "value": "\"import_job\".\"status\" IN ('pending', 'running', 'paused', 'completed', 'failed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.import_record": {+ "name": "import_record",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "import_job_id": {+ "name": "import_job_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "source_entity_type": {+ "name": "source_entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_display_id": {+ "name": "source_display_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "local_entity_type": {+ "name": "local_entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "local_id": {+ "name": "local_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "import_record_job_source_uq": {+ "name": "import_record_job_source_uq",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_record_job_local_idx": {+ "name": "import_record_job_local_idx",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "local_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "local_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_record_job_display_idx": {+ "name": "import_record_job_display_idx",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_display_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "import_record_import_job_id_import_job_id_fk": {+ "name": "import_record_import_job_id_import_job_id_fk",+ "tableFrom": "import_record",+ "tableTo": "import_job",+ "columnsFrom": [+ "import_job_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "import_record_source_entity_type_check": {+ "name": "import_record_source_entity_type_check",+ "value": "\"import_record\".\"source_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"+ },+ "import_record_local_entity_type_check": {+ "name": "import_record_local_entity_type_check",+ "value": "\"import_record\".\"local_entity_type\" IS NULL OR \"import_record\".\"local_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative": {+ "name": "initiative",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planned'"+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "target_date": {+ "name": "target_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "initiative_project_idx": {+ "name": "initiative_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_project_id_project_id_fk": {+ "name": "initiative_project_id_project_id_fk",+ "tableFrom": "initiative",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_owner_user_id_user_id_fk": {+ "name": "initiative_owner_user_id_user_id_fk",+ "tableFrom": "initiative",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "initiative_status_check": {+ "name": "initiative_status_check",+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative_attachment": {+ "name": "initiative_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "initiative_attachment_initiative_idx": {+ "name": "initiative_attachment_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_attachment_initiative_id_initiative_id_fk": {+ "name": "initiative_attachment_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_attachment",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "initiative_attachment_public_id_unique": {+ "name": "initiative_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.initiative_label": {+ "name": "initiative_label",+ "schema": "",+ "columns": {+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "initiative_label_initiative_id_initiative_id_fk": {+ "name": "initiative_label_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_label_label_id_label_id_fk": {+ "name": "initiative_label_label_id_label_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "initiative_label_initiative_id_label_id_pk": {+ "name": "initiative_label_initiative_id_label_id_pk",+ "columns": [+ "initiative_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.integration_credential": {+ "name": "integration_credential",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "integration_key": {+ "name": "integration_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "integration_credential_team_idx": {+ "name": "integration_credential_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_team_id_team_id_fk": {+ "name": "integration_credential_team_id_team_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue": {+ "name": "issue",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sequence_number": {+ "name": "sequence_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "delegate_user_id": {+ "name": "delegate_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_points": {+ "name": "estimate_points",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_minutes": {+ "name": "estimate_minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "due_date": {+ "name": "due_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": 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": {+ "issue_project_active_idx": {+ "name": "issue_project_active_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"archived_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_project_title_idx": {+ "name": "issue_project_title_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(btrim(\"title\"))",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_parent_idx": {+ "name": "issue_parent_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"parent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_idx": {+ "name": "issue_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_project_id_project_id_fk": {+ "name": "issue_project_id_project_id_fk",+ "tableFrom": "issue",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_type_id_issue_type_id_fk": {+ "name": "issue_type_id_issue_type_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_initiative_id_initiative_id_fk": {+ "name": "issue_initiative_id_initiative_id_fk",+ "tableFrom": "issue",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_id_cycle_id_fk",+ "tableFrom": "issue",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_column_id_project_column_id_fk": {+ "name": "issue_column_id_project_column_id_fk",+ "tableFrom": "issue",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_parent_id_issue_id_fk": {+ "name": "issue_parent_id_issue_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_assignee_user_id_user_id_fk": {+ "name": "issue_assignee_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_delegate_user_id_user_id_fk": {+ "name": "issue_delegate_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "delegate_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_share_token_unique": {+ "name": "issue_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ },+ "issue_project_id_sequence_number_unique": {+ "name": "issue_project_id_sequence_number_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "sequence_number"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "issue_estimate_points_check": {+ "name": "issue_estimate_points_check",+ "value": "\"issue\".\"estimate_points\" >= 0"+ },+ "issue_estimate_minutes_check": {+ "name": "issue_estimate_minutes_check",+ "value": "\"issue\".\"estimate_minutes\" >= 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_activity": {+ "name": "issue_activity",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reply_to_id": {+ "name": "reply_to_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "edited_at": {+ "name": "edited_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_activity_issue_idx": {+ "name": "issue_activity_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_reply_idx": {+ "name": "issue_activity_reply_idx",+ "columns": [+ {+ "expression": "reply_to_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_initiative_idx": {+ "name": "issue_activity_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_activity_issue_id_issue_id_fk": {+ "name": "issue_activity_issue_id_issue_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_initiative_id_initiative_id_fk": {+ "name": "issue_activity_initiative_id_initiative_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_reply_to_id_issue_activity_id_fk": {+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "reply_to_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_actor_user_id_user_id_fk": {+ "name": "issue_activity_actor_user_id_user_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_activity_kind_check": {+ "name": "issue_activity_kind_check",+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"+ },+ "issue_activity_owner_check": {+ "name": "issue_activity_owner_check",+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_attachment": {+ "name": "issue_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_attachment_issue_idx": {+ "name": "issue_attachment_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_attachment_issue_id_issue_id_fk": {+ "name": "issue_attachment_issue_id_issue_id_fk",+ "tableFrom": "issue_attachment",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_attachment_public_id_unique": {+ "name": "issue_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist": {+ "name": "issue_checklist",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_issue_idx": {+ "name": "issue_checklist_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_issue_id_issue_id_fk": {+ "name": "issue_checklist_issue_id_issue_id_fk",+ "tableFrom": "issue_checklist",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist_item": {+ "name": "issue_checklist_item",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "checklist_id": {+ "name": "checklist_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "done": {+ "name": "done",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_item_checklist_idx": {+ "name": "issue_checklist_item_checklist_idx",+ "columns": [+ {+ "expression": "checklist_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",+ "tableFrom": "issue_checklist_item",+ "tableTo": "issue_checklist",+ "columnsFrom": [+ "checklist_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_cycle": {+ "name": "issue_cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_cycle_issue_idx": {+ "name": "issue_cycle_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_cycle_idx": {+ "name": "issue_cycle_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_open_idx": {+ "name": "issue_cycle_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"issue_cycle\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_cycle_issue_id_issue_id_fk": {+ "name": "issue_cycle_issue_id_issue_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_cycle_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_cycle_id_cycle_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_development_check": {+ "name": "issue_development_check",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "development_link_id": {+ "name": "development_link_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "app_id": {+ "name": "app_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "head_sha": {+ "name": "head_sha",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_development_check_link_sha_idx": {+ "name": "issue_development_check_link_sha_idx",+ "columns": [+ {+ "expression": "development_link_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "head_sha",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_development_check_development_link_id_issue_development_link_id_fk": {+ "name": "issue_development_check_development_link_id_issue_development_link_id_fk",+ "tableFrom": "issue_development_check",+ "tableTo": "issue_development_link",+ "columnsFrom": [+ "development_link_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_check_development_link_id_app_id_name_unique": {+ "name": "issue_development_check_development_link_id_app_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "development_link_id",+ "app_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_development_link": {+ "name": "issue_development_link",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "repository": {+ "name": "repository",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pull_request'"+ },+ "external_key": {+ "name": "external_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "number": {+ "name": "number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "draft": {+ "name": "draft",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "source_branch": {+ "name": "source_branch",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_branch": {+ "name": "target_branch",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "head_sha": {+ "name": "head_sha",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pipeline_status": {+ "name": "pipeline_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pipeline_url": {+ "name": "pipeline_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_development_link_issue_idx": {+ "name": "issue_development_link_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_development_link_pr_idx": {+ "name": "issue_development_link_pr_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "repository",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_development_link_sha_idx": {+ "name": "issue_development_link_sha_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "repository",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "head_sha",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_development_link_issue_id_issue_id_fk": {+ "name": "issue_development_link_issue_id_issue_id_fk",+ "tableFrom": "issue_development_link",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_link_issue_id_provider_repository_external_key_unique": {+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "provider",+ "repository",+ "external_key"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_option": {+ "name": "issue_field_option",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "option_id": {+ "name": "option_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_option_issue_id_issue_id_fk": {+ "name": "issue_field_option_issue_id_issue_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_field_id_custom_field_id_fk": {+ "name": "issue_field_option_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_option_id_custom_field_option_id_fk": {+ "name": "issue_field_option_option_id_custom_field_option_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field_option",+ "columnsFrom": [+ "option_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_field_option_issue_id_field_id_option_id_pk": {+ "name": "issue_field_option_issue_id_field_id_option_id_pk",+ "columns": [+ "issue_id",+ "field_id",+ "option_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_value": {+ "name": "issue_field_value",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value_text": {+ "name": "value_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "value_number": {+ "name": "value_number",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "value_bool": {+ "name": "value_bool",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "value_date": {+ "name": "value_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime": {+ "name": "value_datetime",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime_end": {+ "name": "value_datetime_end",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_user_id": {+ "name": "value_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_value_issue_id_issue_id_fk": {+ "name": "issue_field_value_issue_id_issue_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_field_id_custom_field_id_fk": {+ "name": "issue_field_value_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_value_user_id_user_id_fk": {+ "name": "issue_field_value_value_user_id_user_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "user",+ "columnsFrom": [+ "value_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_field_value_issue_id_field_id_unique": {+ "name": "issue_field_value_issue_id_field_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "field_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_import": {+ "name": "issue_import",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "attachment_id": {+ "name": "attachment_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'mapped'"+ },+ "mapping": {+ "name": "mapping",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error_text": {+ "name": "error_text",+ "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": {+ "issue_import_project_idx": {+ "name": "issue_import_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_import_project_id_project_id_fk": {+ "name": "issue_import_project_id_project_id_fk",+ "tableFrom": "issue_import",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_import_attachment_id_chat_attachment_id_fk": {+ "name": "issue_import_attachment_id_chat_attachment_id_fk",+ "tableFrom": "issue_import",+ "tableTo": "chat_attachment",+ "columnsFrom": [+ "attachment_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_import_public_id_unique": {+ "name": "issue_import_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_label": {+ "name": "issue_label",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_label_issue_id_issue_id_fk": {+ "name": "issue_label_issue_id_issue_id_fk",+ "tableFrom": "issue_label",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_label_label_id_label_id_fk": {+ "name": "issue_label_label_id_label_id_fk",+ "tableFrom": "issue_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_label_issue_id_label_id_pk": {+ "name": "issue_label_issue_id_label_id_pk",+ "columns": [+ "issue_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_link": {+ "name": "issue_link",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "target_issue_id": {+ "name": "target_issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_link_pair_kind_idx": {+ "name": "issue_link_pair_kind_idx",+ "columns": [+ {+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ },+ {+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_link_source_idx": {+ "name": "issue_link_source_idx",+ "columns": [+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_link_target_idx": {+ "name": "issue_link_target_idx",+ "columns": [+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_link_source_issue_id_issue_id_fk": {+ "name": "issue_link_source_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "tableTo": "issue",+ "columnsFrom": [+ "source_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_link_target_issue_id_issue_id_fk": {+ "name": "issue_link_target_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "tableTo": "issue",+ "columnsFrom": [+ "target_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_link_kind_check": {+ "name": "issue_link_kind_check",+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"+ },+ "issue_link_self_check": {+ "name": "issue_link_self_check",+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_status": {+ "name": "issue_status",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_name": {+ "name": "column_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_status_issue_idx": {+ "name": "issue_status_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_status_column_idx": {+ "name": "issue_status_column_idx",+ "columns": [+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_status_open_idx": {+ "name": "issue_status_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"issue_status\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_status_issue_id_issue_id_fk": {+ "name": "issue_status_issue_id_issue_id_fk",+ "tableFrom": "issue_status",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_status_column_id_project_column_id_fk": {+ "name": "issue_status_column_id_project_column_id_fk",+ "tableFrom": "issue_status",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_template": {+ "name": "issue_template",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "title_template": {+ "name": "title_template",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "description_template": {+ "name": "description_template",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_template_project_id_project_id_fk": {+ "name": "issue_template_project_id_project_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_template_type_id_issue_type_id_fk": {+ "name": "issue_template_type_id_issue_type_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_template_column_id_project_column_id_fk": {+ "name": "issue_template_column_id_project_column_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_template_assignee_user_id_user_id_fk": {+ "name": "issue_template_assignee_user_id_user_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_template_project_id_name_unique": {+ "name": "issue_template_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_template_label": {+ "name": "issue_template_label",+ "schema": "",+ "columns": {+ "template_id": {+ "name": "template_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_template_label_template_id_issue_template_id_fk": {+ "name": "issue_template_label_template_id_issue_template_id_fk",+ "tableFrom": "issue_template_label",+ "tableTo": "issue_template",+ "columnsFrom": [+ "template_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_template_label_label_id_label_id_fk": {+ "name": "issue_template_label_label_id_label_id_fk",+ "tableFrom": "issue_template_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_template_label_template_id_label_id_pk": {+ "name": "issue_template_label_template_id_label_id_pk",+ "columns": [+ "template_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_type": {+ "name": "issue_type",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_type_project_id_project_id_fk": {+ "name": "issue_type_project_id_project_id_fk",+ "tableFrom": "issue_type",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_type_project_id_name_unique": {+ "name": "issue_type_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_watcher": {+ "name": "issue_watcher",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subscribed": {+ "name": "subscribed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_watcher_issue_id_issue_id_fk": {+ "name": "issue_watcher_issue_id_issue_id_fk",+ "tableFrom": "issue_watcher",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_watcher_user_id_user_id_fk": {+ "name": "issue_watcher_user_id_user_id_fk",+ "tableFrom": "issue_watcher",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_watcher_issue_id_user_id_pk": {+ "name": "issue_watcher_issue_id_user_id_pk",+ "columns": [+ "issue_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_worklog": {+ "name": "issue_worklog",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "minutes": {+ "name": "minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "spent_on": {+ "name": "spent_on",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_worklog_issue_idx": {+ "name": "issue_worklog_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "spent_on",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_worklog_issue_id_issue_id_fk": {+ "name": "issue_worklog_issue_id_issue_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_worklog_user_id_user_id_fk": {+ "name": "issue_worklog_user_id_user_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_worklog_minutes_check": {+ "name": "issue_worklog_minutes_check",+ "value": "\"issue_worklog\".\"minutes\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.label": {+ "name": "label",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_project_id_project_id_fk": {+ "name": "label_project_id_project_id_fk",+ "tableFrom": "label",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "label_group_id_label_group_id_fk": {+ "name": "label_group_id_label_group_id_fk",+ "tableFrom": "label",+ "tableTo": "label_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_project_id_name_unique": {+ "name": "label_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.label_group": {+ "name": "label_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_group_project_id_project_id_fk": {+ "name": "label_group_project_id_project_id_fk",+ "tableFrom": "label_group",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_group_project_id_name_unique": {+ "name": "label_group_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board": {+ "name": "note_board",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "canvas": {+ "name": "canvas",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "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": {+ "note_board_project_idx": {+ "name": "note_board_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_project_id_project_id_fk": {+ "name": "note_board_project_id_project_id_fk",+ "tableFrom": "note_board",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_owner_user_id_user_id_fk": {+ "name": "note_board_owner_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_created_by_user_id_user_id_fk": {+ "name": "note_board_created_by_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board_member": {+ "name": "note_board_member",+ "schema": "",+ "columns": {+ "board_id": {+ "name": "board_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "note_board_member_user_idx": {+ "name": "note_board_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_member_board_id_note_board_id_fk": {+ "name": "note_board_member_board_id_note_board_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "note_board",+ "columnsFrom": [+ "board_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_member_user_id_user_id_fk": {+ "name": "note_board_member_user_id_user_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "note_board_member_board_id_user_id_pk": {+ "name": "note_board_member_board_id_user_id_pk",+ "columns": [+ "board_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification": {+ "name": "notification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "read_at": {+ "name": "read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "notification_user_idx": {+ "name": "notification_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "notification_user_unread_idx": {+ "name": "notification_user_unread_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification\".\"read_at\" IS NULL",+ "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": "no action"+ },+ "notification_project_id_project_id_fk": {+ "name": "notification_project_id_project_id_fk",+ "tableFrom": "notification",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_issue_id_issue_id_fk": {+ "name": "notification_issue_id_issue_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_source_activity_id_issue_activity_id_fk": {+ "name": "notification_source_activity_id_issue_activity_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "notification_actor_user_id_user_id_fk": {+ "name": "notification_actor_user_id_user_id_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_type_check": {+ "name": "notification_type_check",+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.notification_delivery": {+ "name": "notification_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "channel": {+ "name": "channel",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "recipient": {+ "name": "recipient",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "notification_delivery_due_idx": {+ "name": "notification_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_delivery_project_id_project_id_fk": {+ "name": "notification_delivery_project_id_project_id_fk",+ "tableFrom": "notification_delivery",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_delivery_channel_check": {+ "name": "notification_delivery_channel_check",+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "next_sequence": {+ "name": "next_sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "initiatives_enabled": {+ "name": "initiatives_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "dashboards_enabled": {+ "name": "dashboards_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "documents_enabled": {+ "name": "documents_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "notes_enabled": {+ "name": "notes_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "cycles_enabled": {+ "name": "cycles_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "subtasks_enabled": {+ "name": "subtasks_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "checklists_enabled": {+ "name": "checklists_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_enabled": {+ "name": "issue_stats_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "points_estimate_enabled": {+ "name": "points_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_estimate_enabled": {+ "name": "time_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_logging_enabled": {+ "name": "time_logging_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_team_id_team_id_fk": {+ "name": "project_team_id_team_id_fk",+ "tableFrom": "project",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_team_key_uq": {+ "name": "project_team_key_uq",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "key"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_action": {+ "name": "project_action",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "condition": {+ "name": "condition",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "effect": {+ "name": "effect",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_action_project_idx": {+ "name": "project_action_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_action_project_id_project_id_fk": {+ "name": "project_action_project_id_project_id_fk",+ "tableFrom": "project_action",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_column": {+ "name": "project_column",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unstarted'"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "wip_limit": {+ "name": "wip_limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "wip_mode": {+ "name": "wip_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'soft'"+ },+ "auto_assign_user_id": {+ "name": "auto_assign_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_column_project_id_project_id_fk": {+ "name": "project_column_project_id_project_id_fk",+ "tableFrom": "project_column",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_column_auto_assign_user_id_user_id_fk": {+ "name": "project_column_auto_assign_user_id_user_id_fk",+ "tableFrom": "project_column",+ "tableTo": "user",+ "columnsFrom": [+ "auto_assign_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_column_project_id_position_unique": {+ "name": "project_column_project_id_position_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "position"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_column_state_type_check": {+ "name": "project_column_state_type_check",+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"+ },+ "project_column_wip_mode_check": {+ "name": "project_column_wip_mode_check",+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"+ },+ "project_column_wip_limit_check": {+ "name": "project_column_wip_limit_check",+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_dashboard": {+ "name": "project_dashboard",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "layout": {+ "name": "layout",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_dashboard_project_idx": {+ "name": "project_dashboard_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_dashboard_project_id_project_id_fk": {+ "name": "project_dashboard_project_id_project_id_fk",+ "tableFrom": "project_dashboard",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document": {+ "name": "project_document",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "full_width": {+ "name": "full_width",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_locked": {+ "name": "is_locked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_ancestor_id": {+ "name": "archived_by_ancestor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by_user_id": {+ "name": "updated_by_user_id",+ "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": {+ "project_document_project_tree_idx": {+ "name": "project_document_project_tree_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_document_owner_idx": {+ "name": "project_document_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_document_project_archive_idx": {+ "name": "project_document_project_archive_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "archived_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_project_id_project_id_fk": {+ "name": "project_document_project_id_project_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_parent_id_project_document_id_fk": {+ "name": "project_document_parent_id_project_document_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project_document",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_archived_by_ancestor_id_project_document_id_fk": {+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project_document",+ "columnsFrom": [+ "archived_by_ancestor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_owner_user_id_user_id_fk": {+ "name": "project_document_owner_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_created_by_user_id_user_id_fk": {+ "name": "project_document_created_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_updated_by_user_id_user_id_fk": {+ "name": "project_document_updated_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "updated_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_document_version_check": {+ "name": "project_document_version_check",+ "value": "\"project_document\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_document_initiative": {+ "name": "project_document_initiative",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_initiative_initiative_idx": {+ "name": "project_document_initiative_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_initiative_document_id_project_document_id_fk": {+ "name": "project_document_initiative_document_id_project_document_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_initiative_initiative_id_initiative_id_fk": {+ "name": "project_document_initiative_initiative_id_initiative_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_initiative_created_by_user_id_user_id_fk": {+ "name": "project_document_initiative_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_document_initiative_document_id_initiative_id_pk": {+ "name": "project_document_initiative_document_id_initiative_id_pk",+ "columns": [+ "document_id",+ "initiative_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_issue": {+ "name": "project_document_issue",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_issue_issue_idx": {+ "name": "project_document_issue_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_issue_document_id_project_document_id_fk": {+ "name": "project_document_issue_document_id_project_document_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_issue_issue_id_issue_id_fk": {+ "name": "project_document_issue_issue_id_issue_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_issue_created_by_user_id_user_id_fk": {+ "name": "project_document_issue_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_document_issue_document_id_issue_id_pk": {+ "name": "project_document_issue_document_id_issue_id_pk",+ "columns": [+ "document_id",+ "issue_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_preference": {+ "name": "project_document_preference",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_favorite": {+ "name": "is_favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_preference_user_idx": {+ "name": "project_document_preference_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_preference_document_id_project_document_id_fk": {+ "name": "project_document_preference_document_id_project_document_id_fk",+ "tableFrom": "project_document_preference",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_preference_user_id_user_id_fk": {+ "name": "project_document_preference_user_id_user_id_fk",+ "tableFrom": "project_document_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_document_preference_document_id_user_id_pk": {+ "name": "project_document_preference_document_id_user_id_pk",+ "columns": [+ "document_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_revision": {+ "name": "project_document_revision",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "full_width": {+ "name": "full_width",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_locked": {+ "name": "is_locked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_revision_document_idx": {+ "name": "project_document_revision_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_revision_document_id_project_document_id_fk": {+ "name": "project_document_revision_document_id_project_document_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_revision_owner_user_id_user_id_fk": {+ "name": "project_document_revision_owner_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_revision_created_by_user_id_user_id_fk": {+ "name": "project_document_revision_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_document_revision_document_version_unique": {+ "name": "project_document_revision_document_version_unique",+ "nullsNotDistinct": false,+ "columns": [+ "document_id",+ "version"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_member": {+ "name": "project_member",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "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'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invite'"+ },+ "is_favorite": {+ "name": "is_favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_hidden": {+ "name": "is_hidden",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_member_user_idx": {+ "name": "project_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_member_project_id_project_id_fk": {+ "name": "project_member_project_id_project_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_user_id_user_id_fk": {+ "name": "project_member_user_id_user_id_fk",+ "tableFrom": "project_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_role_id_team_role_id_fk": {+ "name": "project_member_role_id_team_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_member_project_id_user_id_pk": {+ "name": "project_member_project_id_user_id_pk",+ "columns": [+ "project_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_member_role_check": {+ "name": "project_member_role_check",+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"+ },+ "project_member_source_check": {+ "name": "project_member_source_check",+ "value": "\"project_member\".\"source\" IN ('invite', 'scim')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_setting": {+ "name": "project_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_setting_project_id_project_id_fk": {+ "name": "project_setting_project_id_project_id_fk",+ "tableFrom": "project_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_setting_project_id_key_pk": {+ "name": "project_setting_project_id_key_pk",+ "columns": [+ "project_id",+ "key"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view": {+ "name": "project_view",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "filters": {+ "name": "filters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "display": {+ "name": "display",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_view_project_idx": {+ "name": "project_view_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_view_project_id_project_id_fk": {+ "name": "project_view_project_id_project_id_fk",+ "tableFrom": "project_view",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_view_share_token_unique": {+ "name": "project_view_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view_favorite": {+ "name": "project_view_favorite",+ "schema": "",+ "columns": {+ "view_id": {+ "name": "view_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_view_favorite_view_id_project_view_id_fk": {+ "name": "project_view_favorite_view_id_project_view_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "project_view",+ "columnsFrom": [+ "view_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_view_favorite_user_id_user_id_fk": {+ "name": "project_view_favorite_user_id_user_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_view_favorite_view_id_user_id_pk": {+ "name": "project_view_favorite_view_id_user_id_pk",+ "columns": [+ "view_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.revision": {+ "name": "revision",+ "schema": "",+ "columns": {+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "rev": {+ "name": "rev",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {+ "revision_project_idx": {+ "name": "revision_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team": {+ "name": "team",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "default_agent_ids": {+ "name": "default_agent_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_workspace_idx": {+ "name": "team_workspace_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": {+ "team_slug_unique": {+ "name": "team_slug_unique",+ "nullsNotDistinct": false,+ "columns": [+ "slug"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_invite": {+ "name": "team_invite",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "team_role": {+ "name": "team_role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "project_role": {+ "name": "project_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "invited_by_user_id": {+ "name": "invited_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accepted_by_user_id": {+ "name": "accepted_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "responded_at": {+ "name": "responded_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "team_invite_team_pending_uq": {+ "name": "team_invite_team_pending_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_project_pending_uq": {+ "name": "team_invite_project_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_team_idx": {+ "name": "team_invite_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_project_idx": {+ "name": "team_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_invite_team_id_team_id_fk": {+ "name": "team_invite_team_id_team_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_invite_project_id_project_id_fk": {+ "name": "team_invite_project_id_project_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_invite_role_id_team_role_id_fk": {+ "name": "team_invite_role_id_team_role_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "team_invite_invited_by_user_id_user_id_fk": {+ "name": "team_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "team_invite_accepted_by_user_id_user_id_fk": {+ "name": "team_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_invite_token_unique": {+ "name": "team_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "team_invite_team_role_check": {+ "name": "team_invite_team_role_check",+ "value": "\"team_invite\".\"team_role\" IN ('owner', 'manager', 'member')"+ },+ "team_invite_project_role_check": {+ "name": "team_invite_project_role_check",+ "value": "(\"team_invite\".\"project_id\" IS NULL AND \"team_invite\".\"project_role\" IS NULL)\n OR (\"team_invite\".\"project_id\" IS NOT NULL AND \"team_invite\".\"project_role\" IN ('owner', 'member'))"+ },+ "team_invite_status_check": {+ "name": "team_invite_status_check",+ "value": "\"team_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team_member": {+ "name": "team_member",+ "schema": "",+ "columns": {+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "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'"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invite'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_member_user_idx": {+ "name": "team_member_user_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": {+ "team_member_team_id_user_id_pk": {+ "name": "team_member_team_id_user_id_pk",+ "columns": [+ "team_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "team_member_role_check": {+ "name": "team_member_role_check",+ "value": "\"team_member\".\"role\" IN ('owner', 'manager', 'member', 'agent')"+ },+ "team_member_source_check": {+ "name": "team_member_source_check",+ "value": "\"team_member\".\"source\" IN ('invite', 'scim')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team_notification_setting": {+ "name": "team_notification_setting",+ "schema": "",+ "columns": {+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "team_notification_setting_team_id_team_id_fk": {+ "name": "team_notification_setting_team_id_team_id_fk",+ "tableFrom": "team_notification_setting",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_role": {+ "name": "team_role",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "permissions": {+ "name": "permissions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_role_default_uq": {+ "name": "team_role_default_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_role_team_idx": {+ "name": "team_role_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_role_team_id_team_id_fk": {+ "name": "team_role_team_id_team_id_fk",+ "tableFrom": "team_role",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_role_team_id_name_unique": {+ "name": "team_role_team_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_notification_preference": {+ "name": "user_notification_preference",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email_events": {+ "name": "email_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "telegram_events": {+ "name": "telegram_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "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": {},+ "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": "no action"+ },+ "user_notification_preference_project_id_project_id_fk": {+ "name": "user_notification_preference_project_id_project_id_fk",+ "tableFrom": "user_notification_preference",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_notification_pref_user_project_unique": {+ "name": "user_notification_pref_user_project_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id",+ "project_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_preference": {+ "name": "user_preference",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'UTC'"+ },+ "locale": {+ "name": "locale",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'en'"+ },+ "theme": {+ "name": "theme",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "issue_open_mode": {+ "name": "issue_open_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'panel'"+ },+ "start_page": {+ "name": "start_page",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'work-items'"+ },+ "show_chat_by_default": {+ "name": "show_chat_by_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "issue_stats_open": {+ "name": "issue_stats_open",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_view": {+ "name": "issue_stats_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compact'"+ },+ "issue_activity_view": {+ "name": "issue_activity_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'flat'"+ },+ "auto_watch": {+ "name": "auto_watch",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "hotkeys": {+ "name": "hotkeys",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_project_id": {+ "name": "last_project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "seen_version": {+ "name": "seen_version",+ "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": {},+ "foreignKeys": {+ "user_preference_user_id_user_id_fk": {+ "name": "user_preference_user_id_user_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_preference_last_project_id_project_id_fk": {+ "name": "user_preference_last_project_id_project_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "project",+ "columnsFrom": [+ "last_project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "user_preference_theme_check": {+ "name": "user_preference_theme_check",+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"+ },+ "user_preference_issue_open_mode_check": {+ "name": "user_preference_issue_open_mode_check",+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"+ },+ "user_preference_start_page_check": {+ "name": "user_preference_start_page_check",+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"+ },+ "user_preference_issue_stats_view_check": {+ "name": "user_preference_issue_stats_view_check",+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"+ },+ "user_preference_issue_activity_view_check": {+ "name": "user_preference_issue_activity_view_check",+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"+ }+ },+ "isRLSEnabled": false+ },+ "public.user_telegram_account": {+ "name": "user_telegram_account",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "chat_id": {+ "name": "chat_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_name": {+ "name": "first_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "link_code": {+ "name": "link_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "link_code_expires_at": {+ "name": "link_code_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "linked_at": {+ "name": "linked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_telegram_account_chat_id_unique": {+ "name": "user_telegram_account_chat_id_unique",+ "columns": [+ {+ "expression": "chat_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_telegram_account_link_code_unique": {+ "name": "user_telegram_account_link_code_unique",+ "columns": [+ {+ "expression": "link_code",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_telegram_account_user_id_user_id_fk": {+ "name": "user_telegram_account_user_id_user_id_fk",+ "tableFrom": "user_telegram_account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.webhook": {+ "name": "webhook",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "events": {+ "name": "events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "consecutive_failures": {+ "name": "consecutive_failures",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "webhook_project_idx": {+ "name": "webhook_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "webhook_project_id_project_id_fk": {+ "name": "webhook_project_id_project_id_fk",+ "tableFrom": "webhook",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.webhook_delivery": {+ "name": "webhook_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "webhook_id": {+ "name": "webhook_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "event_id": {+ "name": "event_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "response_status": {+ "name": "response_status",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "response_body": {+ "name": "response_body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "webhook_delivery_due_idx": {+ "name": "webhook_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"webhook_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "webhook_delivery_webhook_idx": {+ "name": "webhook_delivery_webhook_idx",+ "columns": [+ {+ "expression": "webhook_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "webhook_delivery_webhook_id_webhook_id_fk": {+ "name": "webhook_delivery_webhook_id_webhook_id_fk",+ "tableFrom": "webhook_delivery",+ "tableTo": "webhook",+ "columnsFrom": [+ "webhook_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace": {+ "name": "workspace",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "team_creation": {+ "name": "team_creation",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'owner'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "workspace_team_creation_check": {+ "name": "workspace_team_creation_check",+ "value": "\"workspace\".\"team_creation\" IN ('owner', 'managers', 'members')"+ }+ },+ "isRLSEnabled": false+ },+ "public.workspace_manager": {+ "name": "workspace_manager",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "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": "'admin'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_manager_owner_uq": {+ "name": "workspace_manager_owner_uq",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"workspace_manager\".\"role\" = 'owner'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_manager_user_idx": {+ "name": "workspace_manager_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_manager_workspace_id_workspace_id_fk": {+ "name": "workspace_manager_workspace_id_workspace_id_fk",+ "tableFrom": "workspace_manager",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "workspace_manager_user_id_user_id_fk": {+ "name": "workspace_manager_user_id_user_id_fk",+ "tableFrom": "workspace_manager",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "workspace_manager_workspace_id_user_id_pk": {+ "name": "workspace_manager_workspace_id_user_id_pk",+ "columns": [+ "workspace_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "workspace_manager_role_check": {+ "name": "workspace_manager_role_check",+ "value": "\"workspace_manager\".\"role\" IN ('owner', 'admin')"+ }+ },+ "isRLSEnabled": false+ },+ "public.scim_group": {+ "name": "scim_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "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": {},+ "foreignKeys": {+ "scim_group_workspace_id_workspace_id_fk": {+ "name": "scim_group_workspace_id_workspace_id_fk",+ "tableFrom": "scim_group",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_workspace_id_display_name_unique": {+ "name": "scim_group_workspace_id_display_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "workspace_id",+ "display_name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.scim_group_mapping": {+ "name": "scim_group_mapping",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "scim_group_mapping_project_idx": {+ "name": "scim_group_mapping_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_mapping_group_id_scim_group_id_fk": {+ "name": "scim_group_mapping_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "scim_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_mapping_project_id_project_id_fk": {+ "name": "scim_group_mapping_project_id_project_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_mapping_role_id_team_role_id_fk": {+ "name": "scim_group_mapping_role_id_team_role_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_mapping_group_id_project_id_unique": {+ "name": "scim_group_mapping_group_id_project_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "group_id",+ "project_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "scim_group_mapping_role_check": {+ "name": "scim_group_mapping_role_check",+ "value": "\"scim_group_mapping\".\"role\" IN ('owner', 'member')"+ }+ },+ "isRLSEnabled": false+ },+ "public.scim_group_member": {+ "name": "scim_group_member",+ "schema": "",+ "columns": {+ "group_id": {+ "name": "group_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "scim_group_member_user_idx": {+ "name": "scim_group_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_member_group_id_scim_group_id_fk": {+ "name": "scim_group_member_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_member",+ "tableTo": "scim_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_member_user_id_user_id_fk": {+ "name": "scim_group_member_user_id_user_id_fk",+ "tableFrom": "scim_group_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "scim_group_member_group_id_user_id_pk": {+ "name": "scim_group_member_group_id_user_id_pk",+ "columns": [+ "group_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.scim_user": {+ "name": "scim_user",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "active": {+ "name": "active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "scim_user_user_idx": {+ "name": "scim_user_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_user_workspace_id_workspace_id_fk": {+ "name": "scim_user_workspace_id_workspace_id_fk",+ "tableFrom": "scim_user",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_user_user_id_user_id_fk": {+ "name": "scim_user_user_id_user_id_fk",+ "tableFrom": "scim_user",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "scim_user_workspace_id_user_id_pk": {+ "name": "scim_user_workspace_id_user_id_pk",+ "columns": [+ "workspace_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex c9cf9b44..04376bb4 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -981,6 +981,20 @@"when": 1791064765087,"tag": "0139_project_archive","breakpoints": true+ },+ {+ "idx": 140,+ "version": "7",+ "when": 1791138774176,+ "tag": "0140_account_active",+ "breakpoints": true+ },+ {+ "idx": 141,+ "version": "7",+ "when": 1791145933934,+ "tag": "0141_workspace_settings",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/index.ts b/packages/db/src/index.tsindex 7d2272c8..d9eaafab 100644--- a/packages/db/src/index.ts+++ b/packages/db/src/index.ts@@ -3,7 +3,7 @@ export * from './schema';export * from './permissions';export { getSetting, getOrCreateSetting, setSetting } from './settings';export { readSecret, writeSecret } from './secrets';-export { instanceWorkspaceId, teamWorkspaceId } from './workspace';+export { createWorkspace, instanceWorkspaceId, teamWorkspaceId } from './workspace';export {TELEGRAM_BOT_SECRET_KEY,getInstanceBotConfig,diff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.tsindex cf25ae04..a7e28b95 100644--- a/packages/db/src/schema/app.ts+++ b/packages/db/src/schema/app.ts@@ -49,13 +49,28 @@ export const appSecret = pgTable('app_secret', {updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),});-// A workspace owns teams. A self-hosted instance has exactly one, created by the-// migration that introduced the table; its members are derived from its teams.-export const workspace = pgTable('workspace', {- id: serial('id').primaryKey(),- name: text('name').notNull(),- createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),-});+// A workspace owns teams; its members are derived from them. The instance workspace was+// created by the migration that introduced the table and belongs to the instance owner;+// everyone else gets one of their own at sign-up.+export const workspace = pgTable(+ 'workspace',+ {+ id: serial('id').primaryKey(),+ name: text('name').notNull(),+ // The tile colour in the workspace rails, as #rrggbb; null keeps the neutral tile.+ color: text('color'),+ // Who creates teams in it: the owner alone, the owner and admins (managers), or+ // anyone in one of its teams (members).+ teamCreation: text('team_creation').notNull().default('owner'),+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),+ },+ (t) => [+ check(+ 'workspace_team_creation_check',+ sql`${t.teamCreation} IN ('owner', 'managers', 'members')`,+ ),+ ],+);// The people who administer a workspace. Nobody else is listed here: membership comes// from team_member.diff --git a/packages/db/src/schema/auth.ts b/packages/db/src/schema/auth.tsindex 7a1d38e7..16615b42 100644--- a/packages/db/src/schema/auth.ts+++ b/packages/db/src/schema/auth.ts@@ -22,6 +22,7 @@ export const user = pgTable("user", {username: text("username").unique(),displayUsername: text("display_username"),role: text("role").default("user"),+ active: boolean("active").default(true),});export const session = pgTable(diff --git a/packages/db/src/schema/scim.ts b/packages/db/src/schema/scim.tsindex d0386167..7ae02aaa 100644--- a/packages/db/src/schema/scim.ts+++ b/packages/db/src/schema/scim.ts@@ -18,10 +18,12 @@ import { sql } from 'drizzle-orm';import { user } from './auth';import { project, teamRole, workspace } from './app';-// An account as the identity provider of one workspace sees it. The provider decides-// who has the workspace, not who has an account: `active` false means the person was-// taken out of the workspace's teams and its groups grant them nothing, and the account-// itself is untouched. Every workspace's provider keeps its own row for the same person.+// An account as the identity provider of one workspace sees it. While SCIM is the+// instance's, the instance workspace's provider speaks for the whole instance and+// `active` false means the account cannot sign in. Set up per workspace, the provider+// decides who has the workspace, not who has an account: `active` false means the person+// was taken out of the workspace's teams and its groups grant them nothing. Every+// workspace's provider keeps its own row for the same person.export const scimUser = pgTable('scim_user',{diff --git a/packages/db/src/workspace.ts b/packages/db/src/workspace.tsindex 9fa71e8b..ac1f497e 100644--- a/packages/db/src/workspace.ts+++ b/packages/db/src/workspace.ts@@ -1,8 +1,8 @@import { asc, eq } from 'drizzle-orm';import type { DbExecutor } from './client';-import { team, workspace } from './schema';+import { team, workspace, workspaceManager } from './schema';-// The workspace a self-hosted instance puts its teams in. Migration 0135 creates it.+// The instance owner's workspace, the first one. Migration 0135 creates it.export async function instanceWorkspaceId(executor: DbExecutor): Promise<number> {const [row] = await executor.select({ id: workspace.id })@@ -21,3 +21,17 @@ export async function teamWorkspaceId(teamId: number, executor: DbExecutor): Proif (!row) throw new Error(`Team ${teamId} does not exist`);return row.workspaceId;}++// A workspace with `ownerId` as its owner. Run it in a transaction so neither row is+// written without the other.+export async function createWorkspace(+ executor: DbExecutor,+ name: string,+ ownerId: string,+): Promise<number> {+ const [row] = await executor.insert(workspace).values({ name }).returning({ id: workspace.id });+ await executor+ .insert(workspaceManager)+ .values({ workspaceId: row!.id, userId: ownerId, role: 'owner' });+ return row!.id;+}