diff --git a/.docker/Dockerfile.api b/.docker/Dockerfile.roomote-api similarity index 100% rename from .docker/Dockerfile.api rename to .docker/Dockerfile.roomote-api diff --git a/.docker/Dockerfile.controller b/.docker/Dockerfile.roomote-controller similarity index 100% rename from .docker/Dockerfile.controller rename to .docker/Dockerfile.roomote-controller diff --git a/.docker/Dockerfile.dashboard b/.docker/Dockerfile.roomote-dashboard similarity index 74% rename from .docker/Dockerfile.dashboard rename to .docker/Dockerfile.roomote-dashboard index f04160d9d2..df1b9af90a 100644 --- a/.docker/Dockerfile.dashboard +++ b/.docker/Dockerfile.roomote-dashboard @@ -1,4 +1,4 @@ -# docker compose build base dashboard +# docker compose build base roomote-dashboard FROM roomote-base AS base @@ -14,12 +14,10 @@ COPY apps/roomote/package.json ./apps/roomote/ COPY scripts/bootstrap.mjs ./scripts/ RUN pnpm install -COPY apps/roomote ./apps/roomote/ +COPY apps/roomote-dashboard ./apps/roomote-dashboard/ COPY packages/config-eslint ./packages/config-eslint/ COPY packages/config-typescript ./packages/config-typescript/ -COPY packages/types ./packages/types/ -COPY packages/ipc ./packages/ipc/ -WORKDIR /roo/apps/roomote +WORKDIR /roo/apps/roomote-dashboard EXPOSE 3002 -CMD ["pnpm", "dashboard"] +CMD ["pnpm", "dev"] diff --git a/.docker/Dockerfile.worker b/.docker/Dockerfile.roomote-worker similarity index 100% rename from .docker/Dockerfile.worker rename to .docker/Dockerfile.roomote-worker diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0d68be504f..df1aa6af99 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -40,7 +40,7 @@ jobs: env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password - POSTGRES_DB: roo_code_test + POSTGRES_DB: test ports: - 5432:5432 options: >- @@ -69,13 +69,13 @@ jobs: - name: Run type checker run: pnpm check-types - name: Setup database schema - run: pnpm --filter @roo-code-cloud/web db:test:push --force + run: pnpm --filter @roo-code-cloud/db db:test:push --force env: - DATABASE_URL: postgres://postgres:password@localhost:5432/roo_code_test + DATABASE_URL: postgres://postgres:password@localhost:5432/test - name: Run unit tests run: pnpm test env: - DATABASE_URL: postgres://postgres:password@localhost:5432/roo_code_test + DATABASE_URL: postgres://postgres:password@localhost:5432/test check: needs: [build, test] @@ -106,6 +106,6 @@ jobs: run: pnpm install - name: Migrate production database run: npx drizzle-kit migrate - working-directory: apps/web + working-directory: apps/db env: DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }} diff --git a/.gitignore b/.gitignore index ba03f70657..9ddabbc89b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Thumbs.db # .env .env .env*.local +.env*.preview .env*.production # turbo diff --git a/apps/roomote-dashboard/eslint.config.mjs b/apps/roomote-dashboard/eslint.config.mjs new file mode 100644 index 0000000000..c072244298 --- /dev/null +++ b/apps/roomote-dashboard/eslint.config.mjs @@ -0,0 +1,4 @@ +import { config } from "@roo-code-cloud/config-eslint/base" + +/** @type {import("eslint").Linter.Config} */ +export default [...config] diff --git a/apps/roomote-dashboard/package.json b/apps/roomote-dashboard/package.json new file mode 100644 index 0000000000..607a319c9e --- /dev/null +++ b/apps/roomote-dashboard/package.json @@ -0,0 +1,26 @@ +{ + "name": "@roo-code-cloud/roomote-dashboard", + "private": true, + "type": "module", + "scripts": { + "lint": "eslint src --ext=ts --max-warnings=0", + "check-types": "tsc --noEmit", + "dev": "tsx src/index.ts", + "clean": "rimraf .turbo" + }, + "dependencies": { + "@bull-board/api": "^6.10.1", + "@bull-board/express": "^6.10.1", + "@bull-board/ui": "^6.10.1", + "bullmq": "^5.54.3", + "express": "^5.1.0", + "ioredis": "^5.6.1" + }, + "devDependencies": { + "@roo-code-cloud/config-eslint": "workspace:^", + "@roo-code-cloud/config-typescript": "workspace:^", + "@types/express": "^5.0.3", + "@types/node": "^24.0.3", + "tsx": "^4.19.3" + } +} diff --git a/apps/roomote/scripts/dashboard.ts b/apps/roomote-dashboard/src/index.ts similarity index 81% rename from apps/roomote/scripts/dashboard.ts rename to apps/roomote-dashboard/src/index.ts index 7600bf2251..3b122d77f7 100644 --- a/apps/roomote/scripts/dashboard.ts +++ b/apps/roomote-dashboard/src/index.ts @@ -1,24 +1,27 @@ -import IORedis from 'ioredis'; +import { Redis } from 'ioredis'; import { Queue } from 'bullmq'; import { ExpressAdapter } from '@bull-board/express'; -import { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; +import { BullMQAdapter } from '@bull-board/api/bullMQAdapter.js'; import { createBullBoard } from '@bull-board/api'; import express from 'express'; import type { Express, Request, Response } from 'express'; -const redis = new IORedis(process.env.REDIS_URL || 'redis://localhost:6380', { +const redis = new Redis(process.env.REDIS_URL || 'redis://localhost:6380', { maxRetriesPerRequest: null, }); + const queue = new Queue('roomote', { connection: redis }); const serverAdapter = new ExpressAdapter(); serverAdapter.setBasePath('/admin/queues'); createBullBoard({ queues: [new BullMQAdapter(queue)], serverAdapter }); -const port = 3002; const app: Express = express(); app.use('/admin/queues', serverAdapter.getRouter()); app.use('/', (req: Request, res: Response) => res.redirect('/admin/queues')); + +const port = 3002; + app.listen(port, () => console.log(`Bull Board running on: http://localhost:${port}/admin/queues`), ); diff --git a/apps/roomote-dashboard/tsconfig.json b/apps/roomote-dashboard/tsconfig.json new file mode 100644 index 0000000000..231e1b06d8 --- /dev/null +++ b/apps/roomote-dashboard/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "@roo-code-cloud/config-typescript/base.json", + "include": ["src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/apps/roomote/drizzle/0000_cuddly_luke_cage.sql b/apps/roomote/drizzle/0000_cuddly_luke_cage.sql deleted file mode 100644 index 2535f219e2..0000000000 --- a/apps/roomote/drizzle/0000_cuddly_luke_cage.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "cloud_jobs" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "cloud_jobs_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "type" text NOT NULL, - "status" text DEFAULT 'pending' NOT NULL, - "payload" jsonb NOT NULL, - "result" jsonb, - "error" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "started_at" timestamp, - "completed_at" timestamp -); ---> statement-breakpoint -CREATE TABLE "cloud_tasks" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "cloud_tasks_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "job_id" integer NOT NULL, - "task_id" integer, - "container_id" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "cloud_tasks" ADD CONSTRAINT "cloud_tasks_job_id_cloud_jobs_id_fk" FOREIGN KEY ("job_id") REFERENCES "public"."cloud_jobs"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file diff --git a/apps/roomote/drizzle/0001_fluffy_sasquatch.sql b/apps/roomote/drizzle/0001_fluffy_sasquatch.sql deleted file mode 100644 index aeddbe02a8..0000000000 --- a/apps/roomote/drizzle/0001_fluffy_sasquatch.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "cloud_jobs" ADD COLUMN "slack_thread_ts" text; \ No newline at end of file diff --git a/apps/roomote/drizzle/0002_brief_sentry.sql b/apps/roomote/drizzle/0002_brief_sentry.sql deleted file mode 100644 index 2f22f7825c..0000000000 --- a/apps/roomote/drizzle/0002_brief_sentry.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE "cloud_tasks" CASCADE; \ No newline at end of file diff --git a/apps/roomote/drizzle/meta/0000_snapshot.json b/apps/roomote/drizzle/meta/0000_snapshot.json deleted file mode 100644 index ea3dda697f..0000000000 --- a/apps/roomote/drizzle/meta/0000_snapshot.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "id": "8f65bfed-78de-4e22-a15f-36de8afe5f2e", - "prevId": "00000000-0000-0000-0000-000000000000", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.cloud_jobs": { - "name": "cloud_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cloud_jobs_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "result": { - "name": "result", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "started_at": { - "name": "started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cloud_tasks": { - "name": "cloud_tasks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cloud_tasks_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "job_id": { - "name": "job_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "task_id": { - "name": "task_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "container_id": { - "name": "container_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cloud_tasks_job_id_cloud_jobs_id_fk": { - "name": "cloud_tasks_job_id_cloud_jobs_id_fk", - "tableFrom": "cloud_tasks", - "tableTo": "cloud_jobs", - "columnsFrom": ["job_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/roomote/drizzle/meta/0001_snapshot.json b/apps/roomote/drizzle/meta/0001_snapshot.json deleted file mode 100644 index 14c0e9c48c..0000000000 --- a/apps/roomote/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "id": "4cae0c18-141d-40a3-acc8-38fcd7f07534", - "prevId": "8f65bfed-78de-4e22-a15f-36de8afe5f2e", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.cloud_jobs": { - "name": "cloud_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cloud_jobs_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "result": { - "name": "result", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "slack_thread_ts": { - "name": "slack_thread_ts", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "started_at": { - "name": "started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cloud_tasks": { - "name": "cloud_tasks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cloud_tasks_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "job_id": { - "name": "job_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "task_id": { - "name": "task_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "container_id": { - "name": "container_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cloud_tasks_job_id_cloud_jobs_id_fk": { - "name": "cloud_tasks_job_id_cloud_jobs_id_fk", - "tableFrom": "cloud_tasks", - "tableTo": "cloud_jobs", - "columnsFrom": ["job_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/roomote/drizzle/meta/0002_snapshot.json b/apps/roomote/drizzle/meta/0002_snapshot.json deleted file mode 100644 index dbbc7d7cdc..0000000000 --- a/apps/roomote/drizzle/meta/0002_snapshot.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "id": "16afebd7-b27a-457e-b3d5-4de50a597c2e", - "prevId": "4cae0c18-141d-40a3-acc8-38fcd7f07534", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.cloud_jobs": { - "name": "cloud_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cloud_jobs_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "result": { - "name": "result", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "slack_thread_ts": { - "name": "slack_thread_ts", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "started_at": { - "name": "started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/roomote/drizzle/meta/_journal.json b/apps/roomote/drizzle/meta/_journal.json deleted file mode 100644 index 179f2cdbf7..0000000000 --- a/apps/roomote/drizzle/meta/_journal.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "7", - "when": 1749740498648, - "tag": "0000_cuddly_luke_cage", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1750099429125, - "tag": "0001_fluffy_sasquatch", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1750107620472, - "tag": "0002_brief_sentry", - "breakpoints": true - } - ] -} diff --git a/apps/roomote/package.json b/apps/roomote/package.json index b51dea3908..0fff5ac1c1 100644 --- a/apps/roomote/package.json +++ b/apps/roomote/package.json @@ -6,36 +6,24 @@ "lint": "next lint --max-warnings 0", "check-types": "tsc --noEmit", "test": "vitest", - "dev": "concurrently \"next dev --port 3001\" \"ngrok http 3001 --domain cte.ngrok.dev\"", + "dev": "next dev --port 3001", + "tunnel": "ngrok http 3001 --domain cte.ngrok.dev", "build": "next build", "start": "next start --port 3001", "clean": "rimraf .next .turbo", - "drizzle-kit": "dotenvx run -f .env -- tsx node_modules/drizzle-kit/bin.cjs", - "db:generate": "pnpm drizzle-kit generate", - "db:migrate": "pnpm drizzle-kit migrate", - "db:push": "pnpm drizzle-kit push", - "db:check": "pnpm drizzle-kit check", - "db:studio": "pnpm drizzle-kit studio", - "services:start": "docker compose up -d db redis dashboard", - "services:stop": "docker compose down dashboard redis db", - "worker": "dotenvx run -f .env -- tsx src/lib/worker.ts", - "controller": "dotenvx run -f .env -- tsx src/lib/controller.ts", - "dashboard": "tsx scripts/dashboard.ts" + "worker": "dotenvx run -f ../../.env -- tsx src/lib/worker.ts", + "controller": "dotenvx run -f ../../.env -- tsx src/lib/controller.ts" }, "dependencies": { - "@bull-board/api": "^6.10.1", - "@bull-board/express": "^6.10.1", - "@bull-board/ui": "^6.10.1", - "@roo-code/types": "^1.26.0", + "@roo-code-cloud/db": "workspace:^", "@roo-code-cloud/ipc": "workspace:^", + "@roo-code/types": "^1.26.0", "bullmq": "^5.37.0", - "drizzle-orm": "^0.44.1", + "drizzle-orm": "^0.44.2", "execa": "^9.6.0", - "express": "^5.1.0", - "ioredis": "^5.4.3", + "ioredis": "^5.6.1", "next": "^15.3.3", "p-wait-for": "^5.0.2", - "postgres": "^3.4.7", "react": "^19.1.0", "react-dom": "^19.1.0", "zod": "^3.25.41" @@ -43,12 +31,9 @@ "devDependencies": { "@roo-code-cloud/config-eslint": "workspace:^", "@roo-code-cloud/config-typescript": "workspace:^", - "@types/express": "^5.0.3", "@types/node": "^22.15.20", "@types/react": "^19.1.6", "@types/react-dom": "^19.1.6", - "concurrently": "^9.1.0", - "drizzle-kit": "^0.31.1", "tsx": "^4.19.3", "vitest": "^3.2.3" } diff --git a/apps/roomote/src/app/api/health/route.ts b/apps/roomote/src/app/api/health/route.ts index 8141a28259..f30d2acfe1 100644 --- a/apps/roomote/src/app/api/health/route.ts +++ b/apps/roomote/src/app/api/health/route.ts @@ -1,6 +1,7 @@ import { NextResponse } from 'next/server'; -import { db } from '@/db'; +import { db } from '@roo-code-cloud/db/server'; + import { redis } from '@/lib'; export async function GET() { diff --git a/apps/roomote/src/app/api/jobs/[id]/route.ts b/apps/roomote/src/app/api/jobs/[id]/route.ts index 05c02c869f..153c0cfa1e 100644 --- a/apps/roomote/src/app/api/jobs/[id]/route.ts +++ b/apps/roomote/src/app/api/jobs/[id]/route.ts @@ -1,12 +1,12 @@ import { NextRequest, NextResponse } from 'next/server'; import { eq } from 'drizzle-orm'; -import { db, cloudJobs } from '@/db'; +import { db, cloudJobs } from '@roo-code-cloud/db/server'; type Params = Promise<{ id: string }>; export async function GET( - request: NextRequest, + request856rf8pu9: NextRequest, { params }: { params: Params }, ) { try { @@ -40,6 +40,7 @@ export async function GET( }); } catch (error) { console.error('Error fetching job:', error); + return NextResponse.json( { error: 'Internal server error' }, { status: 500 }, diff --git a/apps/roomote/src/app/api/jobs/route.ts b/apps/roomote/src/app/api/jobs/route.ts index 50bdc20e24..eb759d12fa 100644 --- a/apps/roomote/src/app/api/jobs/route.ts +++ b/apps/roomote/src/app/api/jobs/route.ts @@ -1,8 +1,9 @@ import { NextRequest, NextResponse } from 'next/server'; import { z } from 'zod'; +import { db, cloudJobs } from '@roo-code-cloud/db/server'; + import { createJobSchema } from '@/types'; -import { db, cloudJobs } from '@/db'; import { enqueue } from '@/lib'; export async function POST(request: NextRequest) { diff --git a/apps/roomote/src/app/api/webhooks/github/handlers/__tests__/utils.test.ts b/apps/roomote/src/app/api/webhooks/github/handlers/__tests__/utils.test.ts index d535591a5a..985ee26ce3 100644 --- a/apps/roomote/src/app/api/webhooks/github/handlers/__tests__/utils.test.ts +++ b/apps/roomote/src/app/api/webhooks/github/handlers/__tests__/utils.test.ts @@ -2,7 +2,7 @@ import { createHmac } from 'crypto'; -vi.mock('@/db', () => ({ +vi.mock('@roo-code-cloud/db/server', () => ({ db: { insert: vi.fn(), }, @@ -22,7 +22,7 @@ describe('GitHub Webhook Utils', () => { beforeEach(async () => { vi.clearAllMocks(); - const dbModule = await import('@/db'); + const dbModule = await import('@roo-code-cloud/db/server'); const libModule = await import('@/lib'); mockDb = dbModule.db as unknown as { insert: ReturnType }; mockEnqueue = libModule.enqueue as unknown as ReturnType; @@ -45,28 +45,23 @@ describe('GitHub Webhook Utils', () => { const actualHash = createHmac('sha256', secret) .update(body, 'utf8') .digest('hex'); + const validSignature = `sha256=${actualHash}`; - const result = verifySignature(body, validSignature, secret); - expect(result).toBe(true); }); it('should return false for invalid signature', () => { const body = 'test body'; const invalidSignature = 'sha256=invalid'; - const result = verifySignature(body, invalidSignature, secret); - expect(result).toBe(false); }); it('should handle signature without sha256= prefix', () => { const body = 'test body'; const signature = '1234567890abcdef'; - const result = verifySignature(body, signature, secret); - // This will be false since we're not mocking crypto properly for this test. expect(typeof result).toBe('boolean'); }); @@ -74,18 +69,14 @@ describe('GitHub Webhook Utils', () => { it('should work with empty body', () => { const body = ''; const signature = 'sha256=somehash'; - const result = verifySignature(body, signature, secret); - expect(typeof result).toBe('boolean'); }); it('should work with special characters in body', () => { const body = '{"test": "value with 特殊字符 and émojis 🎉"}'; const signature = 'sha256=somehash'; - const result = verifySignature(body, signature, secret); - expect(typeof result).toBe('boolean'); }); }); @@ -101,6 +92,7 @@ describe('GitHub Webhook Utils', () => { returning: vi.fn().mockResolvedValue([mockJob]), }), }); + mockEnqueue.mockResolvedValue(mockEnqueuedJob); }); diff --git a/apps/roomote/src/app/api/webhooks/github/handlers/pullRequestHandler.ts b/apps/roomote/src/app/api/webhooks/github/handlers/pullRequestHandler.ts index c762f7db3b..e9b9d74757 100644 --- a/apps/roomote/src/app/api/webhooks/github/handlers/pullRequestHandler.ts +++ b/apps/roomote/src/app/api/webhooks/github/handlers/pullRequestHandler.ts @@ -2,7 +2,8 @@ import { NextResponse } from 'next/server'; import { eq } from 'drizzle-orm'; import { z } from 'zod'; -import { db, cloudJobs } from '@/db'; +import { db, cloudJobs } from '@roo-code-cloud/db/server'; + import { SlackNotifier } from '@/lib/slack'; const githubPullRequestWebhookSchema = z.object({ diff --git a/apps/roomote/src/app/api/webhooks/github/handlers/utils.ts b/apps/roomote/src/app/api/webhooks/github/handlers/utils.ts index 0e600fe7f5..3e198f11a4 100644 --- a/apps/roomote/src/app/api/webhooks/github/handlers/utils.ts +++ b/apps/roomote/src/app/api/webhooks/github/handlers/utils.ts @@ -1,7 +1,8 @@ import { createHmac } from 'crypto'; +import { db, cloudJobs } from '@roo-code-cloud/db/server'; + import type { JobType, JobPayload } from '@/types'; -import { db, cloudJobs } from '@/db'; import { enqueue } from '@/lib'; export function verifySignature( diff --git a/apps/roomote/src/db/index.ts b/apps/roomote/src/db/index.ts deleted file mode 100644 index 526c25304c..0000000000 --- a/apps/roomote/src/db/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { drizzle } from 'drizzle-orm/postgres-js'; -import postgres from 'postgres'; - -import { schema } from './schema'; - -export const db = drizzle( - postgres(process.env.DATABASE_URL!, { prepare: false }), - { schema }, -); - -export * from './schema'; diff --git a/apps/roomote/src/db/schema.ts b/apps/roomote/src/db/schema.ts deleted file mode 100644 index 5eb82dbbd7..0000000000 --- a/apps/roomote/src/db/schema.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { pgTable, text, timestamp, integer, jsonb } from 'drizzle-orm/pg-core'; - -import type { JobType, JobStatus, JobPayload } from '@/types'; - -/** - * cloudJobs - */ - -export const cloudJobs = pgTable('cloud_jobs', { - id: integer().primaryKey().generatedAlwaysAsIdentity(), - type: text().notNull().$type(), - status: text().notNull().default('pending').$type(), - payload: jsonb().notNull().$type(), - result: jsonb(), - error: text(), - slackThreadTs: text('slack_thread_ts'), - startedAt: timestamp('started_at'), - completedAt: timestamp('completed_at'), - createdAt: timestamp('created_at').notNull().defaultNow(), -}); - -export type CloudJob = typeof cloudJobs.$inferSelect; - -export type InsertCloudJob = typeof cloudJobs.$inferInsert; - -export type UpdateCloudJob = Partial>; - -/** - * schema - */ - -export const schema = { - cloudJobs, -}; diff --git a/apps/roomote/src/lib/job.ts b/apps/roomote/src/lib/job.ts index 8f45335de6..fab31f3c02 100644 --- a/apps/roomote/src/lib/job.ts +++ b/apps/roomote/src/lib/job.ts @@ -1,7 +1,8 @@ import { eq } from 'drizzle-orm'; import { Job } from 'bullmq'; -import { db, cloudJobs, type UpdateCloudJob } from '@/db'; +import { db, cloudJobs, type UpdateCloudJob } from '@roo-code-cloud/db/server'; + import type { JobType, JobStatus, JobParams, JobPayload } from '@/types'; import { fixGitHubIssue } from './jobs/fixGitHubIssue'; diff --git a/apps/roomote/src/lib/redis.ts b/apps/roomote/src/lib/redis.ts index 7a3554f7fa..a86b6f3809 100644 --- a/apps/roomote/src/lib/redis.ts +++ b/apps/roomote/src/lib/redis.ts @@ -1,6 +1,6 @@ -import IORedis from 'ioredis'; +import { Redis } from 'ioredis'; -export const redis = new IORedis( +export const redis = new Redis( process.env.REDIS_URL || 'redis://localhost:6379', { maxRetriesPerRequest: null, diff --git a/apps/web/.env.development b/apps/web/.env.development index 8a065f1e7f..6e0821d034 100644 --- a/apps/web/.env.development +++ b/apps/web/.env.development @@ -1,3 +1,3 @@ -DATABASE_URL=postgres://postgres:password@localhost:5432/roo_code_development +DATABASE_URL=postgres://postgres:password@localhost:5432/development CLICKHOUSE_URL=http://localhost:8123/default CLICKHOUSE_PASSWORD=password diff --git a/apps/web/.env.test b/apps/web/.env.test index f0a4a83413..77c12cfbf7 100644 --- a/apps/web/.env.test +++ b/apps/web/.env.test @@ -1 +1,3 @@ -DATABASE_URL=postgres://postgres:password@localhost:5432/roo_code_test +DATABASE_URL=postgres://postgres:password@localhost:5432/test +CLICKHOUSE_URL=http://localhost:8123/default +CLICKHOUSE_PASSWORD=password diff --git a/apps/web/drizzle.config.ts b/apps/web/drizzle.config.ts deleted file mode 100644 index 0bf74f0fc5..0000000000 --- a/apps/web/drizzle.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { defineConfig } from 'drizzle-kit'; - -export default defineConfig({ - out: './src/db/migrations', - schema: './src/db/schema.ts', - dialect: 'postgresql', - dbCredentials: { url: process.env.DATABASE_URL! }, - verbose: true, - strict: true, -}); diff --git a/apps/web/package.json b/apps/web/package.json index 3b7651a975..5e67cdca58 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -8,11 +8,7 @@ "dev": "next dev --turbopack", "build": "next build", "start": "next start", - "clean": "rimraf .next .turbo out", - "db:generate": "dotenvx run -f .env.development -- drizzle-kit generate", - "db:migrate": "dotenvx run -f .env.development -- drizzle-kit migrate", - "db:push": "dotenvx run -f .env.development -- drizzle-kit push", - "db:test:push": "dotenvx run -f .env.test -- drizzle-kit push" + "clean": "rimraf .next .turbo out" }, "dependencies": { "@clerk/localizations": "^3.16.3", @@ -35,6 +31,7 @@ "@radix-ui/react-tabs": "^1.1.12", "@radix-ui/react-toast": "^1.2.14", "@radix-ui/react-tooltip": "^1.2.7", + "@roo-code-cloud/db": "workspace:^", "@roo-code/types": "^1.26.0", "@sentry/nextjs": "^9.23.0", "@t3-oss/env-nextjs": "^0.13.6", @@ -46,8 +43,7 @@ "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^4.1.0", - "drizzle-orm": "^0.43.1", - "drizzle-zod": "^0.7.1", + "drizzle-orm": "^0.44.2", "fuzzysort": "^3.1.0", "import-in-the-middle": "^1.14.2", "jsonwebtoken": "^9.0.2", @@ -88,7 +84,6 @@ "@types/react": "^19.1.6", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.5.2", - "drizzle-kit": "^0.31.1", "eslint-config-prettier": "^10.1.5", "eslint-plugin-only-warn": "^1.1.0", "eslint-plugin-react": "^7.37.5", diff --git a/apps/web/src/actions/__tests__/agents.test.ts b/apps/web/src/actions/__tests__/agents.test.ts index 09103a2058..294c9a3eb4 100644 --- a/apps/web/src/actions/__tests__/agents.test.ts +++ b/apps/web/src/actions/__tests__/agents.test.ts @@ -5,14 +5,15 @@ import { clerkClient, auth } from '@clerk/nextjs/server'; import type { Mock } from 'vitest'; import { - client as db, + type Agent, + db, agents, users, orgs, agentRequestLogs, -} from '@/db/server'; +} from '@roo-code-cloud/db/server'; + import type { CreateAgentRequest } from '@/types'; -import type { Agent } from '@/db/types'; import { createAgent, revokeAgent, updateAgentUsage } from '../agents'; diff --git a/apps/web/src/actions/__tests__/syncCurrentUser.test.ts b/apps/web/src/actions/__tests__/syncCurrentUser.test.ts index 0800faa5e8..5a7a9baf2c 100644 --- a/apps/web/src/actions/__tests__/syncCurrentUser.test.ts +++ b/apps/web/src/actions/__tests__/syncCurrentUser.test.ts @@ -2,8 +2,9 @@ import { eq } from 'drizzle-orm'; +import { db, users, orgs } from '@roo-code-cloud/db/server'; + import { logger } from '@/lib/server/logger'; -import { client as db, users, orgs } from '@/db/server'; import { syncCurrentUser } from '../sync'; diff --git a/apps/web/src/actions/__tests__/syncOrg.test.ts b/apps/web/src/actions/__tests__/syncOrg.test.ts index 0ccb1b5b5b..4276425ad9 100644 --- a/apps/web/src/actions/__tests__/syncOrg.test.ts +++ b/apps/web/src/actions/__tests__/syncOrg.test.ts @@ -3,8 +3,9 @@ import { eq } from 'drizzle-orm'; import { clerkClient } from '@clerk/nextjs/server'; +import { db, orgs } from '@roo-code-cloud/db/server'; + import { logger } from '@/lib/server/logger'; -import { client as db, orgs } from '@/db/server'; import { syncOrg } from '../sync'; diff --git a/apps/web/src/actions/agents.ts b/apps/web/src/actions/agents.ts index d8e29097f0..d5123fc9fa 100644 --- a/apps/web/src/actions/agents.ts +++ b/apps/web/src/actions/agents.ts @@ -4,12 +4,16 @@ import { eq, and } from 'drizzle-orm'; import { clerkClient } from '@clerk/nextjs/server'; import crypto from 'crypto'; -import type { Agent } from '@/db/types'; +import { + type Agent, + db, + agents, + agentRequestLogs, +} from '@roo-code-cloud/db/server'; import { type CreateAgentRequest, createAgentRequestSchema, } from '@/types/agents'; -import { client as db, agents, agentRequestLogs } from '@/db/server'; import { authorize } from './auth'; diff --git a/apps/web/src/actions/analytics/events.ts b/apps/web/src/actions/analytics/events.ts index 683922a445..eb479fe0f3 100644 --- a/apps/web/src/actions/analytics/events.ts +++ b/apps/web/src/actions/analytics/events.ts @@ -10,7 +10,7 @@ import { import type { AnyTimePeriod } from '@/types'; import { analytics } from '@/lib/server'; import { tokenSumSql } from '@/lib'; -import { type User, getUsersById } from '@/db/server'; +import { type User, getUsersById } from '@roo-code-cloud/db/server'; import { authorizeAnalytics } from '@/actions/auth'; type Table = 'events' | 'messages'; diff --git a/apps/web/src/actions/auditLogs.ts b/apps/web/src/actions/auditLogs.ts index ebeac188da..5dabf2e009 100644 --- a/apps/web/src/actions/auditLogs.ts +++ b/apps/web/src/actions/auditLogs.ts @@ -7,9 +7,9 @@ import { type DatabaseOrTransaction, type AuditLogWithUser, type CreateAuditLog, - client as db, + db, auditLogs, -} from '@/db/server'; +} from '@roo-code-cloud/db/server'; export const getAuditLogs = async ({ orgId, diff --git a/apps/web/src/actions/organizationSettings.ts b/apps/web/src/actions/organizationSettings.ts index d1b73c2cf7..7cae24f948 100644 --- a/apps/web/src/actions/organizationSettings.ts +++ b/apps/web/src/actions/organizationSettings.ts @@ -12,7 +12,7 @@ import { ORGANIZATION_DEFAULT, } from '@roo-code/types'; -import { AuditLogTargetType, client as db, orgSettings } from '@/db/server'; +import { AuditLogTargetType, db, orgSettings } from '@roo-code-cloud/db/server'; import { authorize } from './auth'; import { insertAuditLog } from './auditLogs'; diff --git a/apps/web/src/actions/sync.ts b/apps/web/src/actions/sync.ts index 2ad2bc57ba..8fef0af800 100644 --- a/apps/web/src/actions/sync.ts +++ b/apps/web/src/actions/sync.ts @@ -6,10 +6,11 @@ import { clerkClient, currentUser } from '@clerk/nextjs/server'; import { type CreateUser, type CreateOrg, - client as db, + db, users, orgs, -} from '@/db/server'; +} from '@roo-code-cloud/db/server'; + import { logger } from '@/lib/server'; export async function syncCurrentUser({ diff --git a/apps/web/src/actions/taskSharing.ts b/apps/web/src/actions/taskSharing.ts index 67ad06e709..8c5fab5863 100644 --- a/apps/web/src/actions/taskSharing.ts +++ b/apps/web/src/actions/taskSharing.ts @@ -2,15 +2,21 @@ import { eq, and, sql, desc } from 'drizzle-orm'; +import { + type TaskShare, + AuditLogTargetType, + db, + taskShares, + users, +} from '@roo-code-cloud/db/server'; + import { type CreateTaskShareRequest, + type SharedByUser, + TaskShareVisibility, createTaskShareSchema, shareIdSchema, } from '@/types'; -import type { SharedByUser } from '@/types/task-sharing'; -import { TaskShareVisibility } from '@/types/task-sharing'; -import { type TaskShare, AuditLogTargetType } from '@/db'; -import { client as db, taskShares, users } from '@/db/server'; import { handleError, generateShareToken } from '@/lib/server'; import { isValidShareToken, diff --git a/apps/web/src/app/(authenticated)/audit-logs/AuditLogs.tsx b/apps/web/src/app/(authenticated)/audit-logs/AuditLogs.tsx index 450abfda49..f65257fbb4 100644 --- a/apps/web/src/app/(authenticated)/audit-logs/AuditLogs.tsx +++ b/apps/web/src/app/(authenticated)/audit-logs/AuditLogs.tsx @@ -4,8 +4,9 @@ import { useState } from 'react'; import { useAuth } from '@clerk/nextjs'; import { useQuery } from '@tanstack/react-query'; +import type { AuditLogWithUser } from '@roo-code-cloud/db'; + import { type TimePeriod, timePeriods } from '@/types'; -import type { AuditLogWithUser } from '@/db'; import { getAuditLogs } from '@/actions/auditLogs'; import { Button, diff --git a/apps/web/src/components/audit-logs/AuditLogCard.tsx b/apps/web/src/components/audit-logs/AuditLogCard.tsx index b2c8905bee..77d30940b7 100644 --- a/apps/web/src/components/audit-logs/AuditLogCard.tsx +++ b/apps/web/src/components/audit-logs/AuditLogCard.tsx @@ -7,7 +7,8 @@ import { useAuth } from '@clerk/nextjs'; import { useQuery } from '@tanstack/react-query'; import { ArrowRightIcon } from 'lucide-react'; -import type { AuditLogWithUser } from '@/db'; +import type { AuditLogWithUser } from '@roo-code-cloud/db'; + import { getAuditLogs } from '@/actions/auditLogs'; import { Card, diff --git a/apps/web/src/components/audit-logs/AuditLogDetails.tsx b/apps/web/src/components/audit-logs/AuditLogDetails.tsx index f6acaf4d5f..916ba99e20 100644 --- a/apps/web/src/components/audit-logs/AuditLogDetails.tsx +++ b/apps/web/src/components/audit-logs/AuditLogDetails.tsx @@ -1,7 +1,7 @@ import Link from 'next/link'; import { ArrowRight, Calendar, Clock, User } from 'lucide-react'; -import type { AuditLogWithUser } from '@/db'; +import type { AuditLogWithUser } from '@roo-code-cloud/db'; export const AuditLogDetails = ({ log }: { log: AuditLogWithUser }) => (
diff --git a/apps/web/src/components/audit-logs/AuditLogDrawer.tsx b/apps/web/src/components/audit-logs/AuditLogDrawer.tsx index edf20161f2..5c35cb361a 100644 --- a/apps/web/src/components/audit-logs/AuditLogDrawer.tsx +++ b/apps/web/src/components/audit-logs/AuditLogDrawer.tsx @@ -1,4 +1,5 @@ -import type { AuditLogWithUser } from '@/db'; +import type { AuditLogWithUser } from '@roo-code-cloud/db'; + import { Drawer, DrawerContent, diff --git a/apps/web/src/components/audit-logs/AuditLogEntry.tsx b/apps/web/src/components/audit-logs/AuditLogEntry.tsx index 46ff8edb81..992924bf55 100644 --- a/apps/web/src/components/audit-logs/AuditLogEntry.tsx +++ b/apps/web/src/components/audit-logs/AuditLogEntry.tsx @@ -1,7 +1,7 @@ import { formatDistance } from 'date-fns'; import { Settings, Sliders, Users } from 'lucide-react'; -import { type AuditLogWithUser, AuditLogTargetType } from '@/db'; +import { type AuditLogWithUser, AuditLogTargetType } from '@roo-code-cloud/db'; type AuditLogEntryProps = { log: AuditLogWithUser; diff --git a/apps/web/src/components/task-sharing/ShareButton.tsx b/apps/web/src/components/task-sharing/ShareButton.tsx index c52b31813f..39ce03427c 100644 --- a/apps/web/src/components/task-sharing/ShareButton.tsx +++ b/apps/web/src/components/task-sharing/ShareButton.tsx @@ -12,9 +12,10 @@ import { } from 'lucide-react'; import { toast } from 'sonner'; -import type { TaskShare } from '@/db'; -import type { TaskWithUser } from '@/actions/analytics'; +import type { TaskShare } from '@roo-code-cloud/db'; + import { TaskShareVisibility } from '@/types/task-sharing'; +import type { TaskWithUser } from '@/actions/analytics'; import { createTaskShare, deleteTaskShare, diff --git a/apps/web/src/db/db.ts b/apps/web/src/db/db.ts deleted file mode 100644 index 16943eb346..0000000000 --- a/apps/web/src/db/db.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { drizzle } from 'drizzle-orm/postgres-js'; -import postgres from 'postgres'; - -import { Env } from '@/lib/server'; -import * as schema from './schema'; - -const postgresClient = postgres(Env.DATABASE_URL, { prepare: false }); -const client = drizzle({ client: postgresClient, schema }); - -if (process.env.NODE_ENV === 'test') { - if ( - !Env.DATABASE_URL.includes('test') || - !Env.DATABASE_URL.includes('localhost') - ) { - throw new Error('DATABASE_URL is not a test database'); - } -} - -const disconnect = async () => postgresClient.end(); - -type DatabaseOrTransaction = - | typeof client - | Parameters[0]>[0]; - -export { client, disconnect, type DatabaseOrTransaction }; diff --git a/apps/web/src/db/migrations/.gitkeep b/apps/web/src/db/migrations/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/web/src/db/migrations/0000_daffy_psylocke.sql b/apps/web/src/db/migrations/0000_daffy_psylocke.sql deleted file mode 100644 index c9aeb22eb6..0000000000 --- a/apps/web/src/db/migrations/0000_daffy_psylocke.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "audit_logs" ( - "id" uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(), - "user_id" text NOT NULL, - "organization_id" text NOT NULL, - "target_type" integer NOT NULL, - "target_id" text NOT NULL, - "new_value" jsonb NOT NULL, - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "description" text NOT NULL -); diff --git a/apps/web/src/db/migrations/0001_add_organization_settings.sql b/apps/web/src/db/migrations/0001_add_organization_settings.sql deleted file mode 100644 index 7db27ae7d1..0000000000 --- a/apps/web/src/db/migrations/0001_add_organization_settings.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "organization_settings" ( - "organization_id" text PRIMARY KEY NOT NULL, - "version" integer NOT NULL DEFAULT 1, - "default_settings" jsonb NOT NULL DEFAULT '{}', - "allow_list" jsonb NOT NULL DEFAULT '{"allowAll": true, "providers": {}}'::jsonb, - "created_at" timestamp NOT NULL DEFAULT now(), - "updated_at" timestamp NOT NULL DEFAULT now() -); \ No newline at end of file diff --git a/apps/web/src/db/migrations/0002_normal_mephistopheles.sql b/apps/web/src/db/migrations/0002_normal_mephistopheles.sql deleted file mode 100644 index 987feaeafb..0000000000 --- a/apps/web/src/db/migrations/0002_normal_mephistopheles.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "organizations" ( - "id" text PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "slug" text NOT NULL, - "image_url" text NOT NULL, - "entity" jsonb NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "users" ( - "id" text PRIMARY KEY NOT NULL, - "organization_id" text, - "organization_role" text, - "name" text NOT NULL, - "email" text NOT NULL, - "image_url" text NOT NULL, - "entity" jsonb NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "audit_logs" ALTER COLUMN "id" SET DATA TYPE uuid;--> statement-breakpoint -ALTER TABLE "audit_logs" ALTER COLUMN "id" SET DEFAULT gen_random_uuid();--> statement-breakpoint -ALTER TABLE "audit_logs" ALTER COLUMN "created_at" SET DATA TYPE timestamp;--> statement-breakpoint -ALTER TABLE "audit_logs" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "organization_settings" ALTER COLUMN "version" SET DEFAULT 1;--> statement-breakpoint -ALTER TABLE "organization_settings" ALTER COLUMN "allow_list" SET DEFAULT '{"allowAll":true,"providers":{}}'::jsonb;--> statement-breakpoint -ALTER TABLE "users" ADD CONSTRAINT "users_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "organizations_slug_idx" ON "organizations" USING btree ("slug");--> statement-breakpoint -CREATE INDEX "organizations_created_at_idx" ON "organizations" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "users_organization_id_idx" ON "users" USING btree ("organization_id");--> statement-breakpoint -CREATE INDEX "users_organization_role_idx" ON "users" USING btree ("organization_id","organization_role");--> statement-breakpoint -CREATE INDEX "users_email_idx" ON "users" USING btree ("email");--> statement-breakpoint -CREATE INDEX "users_created_at_idx" ON "users" USING btree ("created_at");--> statement-breakpoint -ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "organization_settings" ADD CONSTRAINT "organization_settings_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "audit_logs_user_id_idx" ON "audit_logs" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "audit_logs_organization_id_idx" ON "audit_logs" USING btree ("organization_id");--> statement-breakpoint -CREATE INDEX "audit_logs_target_idx" ON "audit_logs" USING btree ("target_type","target_id");--> statement-breakpoint -CREATE INDEX "audit_logs_created_at_idx" ON "audit_logs" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "organization_settings_created_at_idx" ON "organization_settings" USING btree ("created_at"); \ No newline at end of file diff --git a/apps/web/src/db/migrations/0003_strange_wild_pack.sql b/apps/web/src/db/migrations/0003_strange_wild_pack.sql deleted file mode 100644 index 23edfaa6d7..0000000000 --- a/apps/web/src/db/migrations/0003_strange_wild_pack.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "organizations" ADD COLUMN "last_sync_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "last_sync_at" timestamp DEFAULT now() NOT NULL; \ No newline at end of file diff --git a/apps/web/src/db/migrations/0004_overjoyed_bucky.sql b/apps/web/src/db/migrations/0004_overjoyed_bucky.sql deleted file mode 100644 index 5572451cc4..0000000000 --- a/apps/web/src/db/migrations/0004_overjoyed_bucky.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "organization_settings" ADD COLUMN "cloud_settings" jsonb DEFAULT '{}'::jsonb NOT NULL; \ No newline at end of file diff --git a/apps/web/src/db/migrations/0005_watery_sphinx.sql b/apps/web/src/db/migrations/0005_watery_sphinx.sql deleted file mode 100644 index f15d5e3e6c..0000000000 --- a/apps/web/src/db/migrations/0005_watery_sphinx.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "task_shares" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "task_id" text NOT NULL, - "organization_id" text NOT NULL, - "created_by_user_id" text NOT NULL, - "share_token" text NOT NULL, - "expires_at" timestamp, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "task_shares_share_token_unique" UNIQUE("share_token") -); ---> statement-breakpoint -ALTER TABLE "task_shares" ADD CONSTRAINT "task_shares_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "task_shares" ADD CONSTRAINT "task_shares_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "task_shares_share_token_idx" ON "task_shares" USING btree ("share_token");--> statement-breakpoint -CREATE INDEX "task_shares_task_id_idx" ON "task_shares" USING btree ("task_id");--> statement-breakpoint -CREATE INDEX "task_shares_org_id_idx" ON "task_shares" USING btree ("organization_id");--> statement-breakpoint -CREATE INDEX "task_shares_expires_at_idx" ON "task_shares" USING btree ("expires_at");--> statement-breakpoint -CREATE INDEX "task_shares_created_by_user_id_idx" ON "task_shares" USING btree ("created_by_user_id"); \ No newline at end of file diff --git a/apps/web/src/db/migrations/0006_ambiguous_professor_monster.sql b/apps/web/src/db/migrations/0006_ambiguous_professor_monster.sql deleted file mode 100644 index c170004ff0..0000000000 --- a/apps/web/src/db/migrations/0006_ambiguous_professor_monster.sql +++ /dev/null @@ -1,36 +0,0 @@ -CREATE TABLE "agent_request_logs" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "agent_id" text NOT NULL, - "organization_id" text NOT NULL, - "endpoint" text NOT NULL, - "method" text NOT NULL, - "status_code" integer NOT NULL, - "response_time_ms" integer NOT NULL, - "user_agent" text, - "ip_address" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "agents" ( - "id" text PRIMARY KEY NOT NULL, - "organization_id" text NOT NULL, - "display_name" text NOT NULL, - "description" text, - "is_active" integer DEFAULT 1 NOT NULL, - "last_used_at" timestamp, - "total_requests" integer DEFAULT 0 NOT NULL, - "created_by_user_id" text NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "agent_request_logs" ADD CONSTRAINT "agent_request_logs_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "agent_request_logs" ADD CONSTRAINT "agent_request_logs_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "agents" ADD CONSTRAINT "agents_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "agents" ADD CONSTRAINT "agents_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "agent_request_logs_agent_id_idx" ON "agent_request_logs" USING btree ("agent_id");--> statement-breakpoint -CREATE INDEX "agent_request_logs_org_id_idx" ON "agent_request_logs" USING btree ("organization_id");--> statement-breakpoint -CREATE INDEX "agent_request_logs_created_at_idx" ON "agent_request_logs" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "agents_org_id_idx" ON "agents" USING btree ("organization_id");--> statement-breakpoint -CREATE INDEX "agents_active_idx" ON "agents" USING btree ("is_active") WHERE "agents"."is_active" = 1;--> statement-breakpoint -CREATE INDEX "agents_last_used_idx" ON "agents" USING btree ("last_used_at"); \ No newline at end of file diff --git a/apps/web/src/db/migrations/0007_tidy_blue_blade.sql b/apps/web/src/db/migrations/0007_tidy_blue_blade.sql deleted file mode 100644 index dab2f790bc..0000000000 --- a/apps/web/src/db/migrations/0007_tidy_blue_blade.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "task_shares" ADD COLUMN "visibility" text DEFAULT 'organization' NOT NULL;--> statement-breakpoint -CREATE INDEX "task_shares_visibility_idx" ON "task_shares" USING btree ("visibility"); \ No newline at end of file diff --git a/apps/web/src/db/migrations/meta/0000_snapshot.json b/apps/web/src/db/migrations/meta/0000_snapshot.json deleted file mode 100644 index a6ce0433b6..0000000000 --- a/apps/web/src/db/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "id": "6600a193-62ff-4475-9533-eb1dafc7339e", - "prevId": "00000000-0000-0000-0000-000000000000", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/0001_snapshot.json b/apps/web/src/db/migrations/meta/0001_snapshot.json deleted file mode 100644 index 1be76dd48c..0000000000 --- a/apps/web/src/db/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "id": "a7b8c9d0-e1f2-3456-7890-a1b2c3d4e5f6", - "prevId": "6600a193-62ff-4475-9533-eb1dafc7339e", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization_settings": { - "name": "organization_settings", - "schema": "", - "columns": { - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": "1" - }, - "default_settings": { - "name": "default_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "allow_list": { - "name": "allow_list", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "{\"allowAll\": true, \"providers\": {}}" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/0002_snapshot.json b/apps/web/src/db/migrations/meta/0002_snapshot.json deleted file mode 100644 index 6b50351027..0000000000 --- a/apps/web/src/db/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,482 +0,0 @@ -{ - "id": "c88e310b-6684-4083-a251-4e794bcefbbd", - "prevId": "a7b8c9d0-e1f2-3456-7890-a1b2c3d4e5f6", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "audit_logs_user_id_idx": { - "name": "audit_logs_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_organization_id_idx": { - "name": "audit_logs_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_target_idx": { - "name": "audit_logs_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_created_at_idx": { - "name": "audit_logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "audit_logs_user_id_users_id_fk": { - "name": "audit_logs_user_id_users_id_fk", - "tableFrom": "audit_logs", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "audit_logs_organization_id_organizations_id_fk": { - "name": "audit_logs_organization_id_organizations_id_fk", - "tableFrom": "audit_logs", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization_settings": { - "name": "organization_settings", - "schema": "", - "columns": { - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "default_settings": { - "name": "default_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "allow_list": { - "name": "allow_list", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{\"allowAll\":true,\"providers\":{}}'::jsonb" - }, - "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": { - "organization_settings_created_at_idx": { - "name": "organization_settings_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organization_settings_organization_id_organizations_id_fk": { - "name": "organization_settings_organization_id_organizations_id_fk", - "tableFrom": "organization_settings", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "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": { - "organizations_slug_idx": { - "name": "organizations_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_idx": { - "name": "organizations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "organization_role": { - "name": "organization_role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "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": { - "users_organization_id_idx": { - "name": "users_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_organization_role_idx": { - "name": "users_organization_role_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "organization_role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_organization_id_organizations_id_fk": { - "name": "users_organization_id_organizations_id_fk", - "tableFrom": "users", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/0003_snapshot.json b/apps/web/src/db/migrations/meta/0003_snapshot.json deleted file mode 100644 index 6bd577a3db..0000000000 --- a/apps/web/src/db/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,496 +0,0 @@ -{ - "id": "bef500d1-5175-4068-af51-1f565355f1ac", - "prevId": "c88e310b-6684-4083-a251-4e794bcefbbd", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "audit_logs_user_id_idx": { - "name": "audit_logs_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_organization_id_idx": { - "name": "audit_logs_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_target_idx": { - "name": "audit_logs_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_created_at_idx": { - "name": "audit_logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "audit_logs_user_id_users_id_fk": { - "name": "audit_logs_user_id_users_id_fk", - "tableFrom": "audit_logs", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "audit_logs_organization_id_organizations_id_fk": { - "name": "audit_logs_organization_id_organizations_id_fk", - "tableFrom": "audit_logs", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization_settings": { - "name": "organization_settings", - "schema": "", - "columns": { - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "default_settings": { - "name": "default_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "allow_list": { - "name": "allow_list", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{\"allowAll\":true,\"providers\":{}}'::jsonb" - }, - "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": { - "organization_settings_created_at_idx": { - "name": "organization_settings_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organization_settings_organization_id_organizations_id_fk": { - "name": "organization_settings_organization_id_organizations_id_fk", - "tableFrom": "organization_settings", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "organizations_slug_idx": { - "name": "organizations_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_idx": { - "name": "organizations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "organization_role": { - "name": "organization_role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "users_organization_id_idx": { - "name": "users_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_organization_role_idx": { - "name": "users_organization_role_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "organization_role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_organization_id_organizations_id_fk": { - "name": "users_organization_id_organizations_id_fk", - "tableFrom": "users", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/0004_snapshot.json b/apps/web/src/db/migrations/meta/0004_snapshot.json deleted file mode 100644 index c074dd0b79..0000000000 --- a/apps/web/src/db/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,503 +0,0 @@ -{ - "id": "5c95f3bf-5048-4ba1-9f71-2110879fc161", - "prevId": "bef500d1-5175-4068-af51-1f565355f1ac", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "audit_logs_user_id_idx": { - "name": "audit_logs_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_organization_id_idx": { - "name": "audit_logs_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_target_idx": { - "name": "audit_logs_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_created_at_idx": { - "name": "audit_logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "audit_logs_user_id_users_id_fk": { - "name": "audit_logs_user_id_users_id_fk", - "tableFrom": "audit_logs", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "audit_logs_organization_id_organizations_id_fk": { - "name": "audit_logs_organization_id_organizations_id_fk", - "tableFrom": "audit_logs", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization_settings": { - "name": "organization_settings", - "schema": "", - "columns": { - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "cloud_settings": { - "name": "cloud_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "default_settings": { - "name": "default_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "allow_list": { - "name": "allow_list", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{\"allowAll\":true,\"providers\":{}}'::jsonb" - }, - "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": { - "organization_settings_created_at_idx": { - "name": "organization_settings_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organization_settings_organization_id_organizations_id_fk": { - "name": "organization_settings_organization_id_organizations_id_fk", - "tableFrom": "organization_settings", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "organizations_slug_idx": { - "name": "organizations_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_idx": { - "name": "organizations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "organization_role": { - "name": "organization_role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "users_organization_id_idx": { - "name": "users_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_organization_role_idx": { - "name": "users_organization_role_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "organization_role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_organization_id_organizations_id_fk": { - "name": "users_organization_id_organizations_id_fk", - "tableFrom": "users", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/0005_snapshot.json b/apps/web/src/db/migrations/meta/0005_snapshot.json deleted file mode 100644 index d1884ee91c..0000000000 --- a/apps/web/src/db/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,668 +0,0 @@ -{ - "id": "9cf3a792-c153-4ad4-a3f5-0f8054abf28d", - "prevId": "5c95f3bf-5048-4ba1-9f71-2110879fc161", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "audit_logs_user_id_idx": { - "name": "audit_logs_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_organization_id_idx": { - "name": "audit_logs_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_target_idx": { - "name": "audit_logs_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_created_at_idx": { - "name": "audit_logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "audit_logs_user_id_users_id_fk": { - "name": "audit_logs_user_id_users_id_fk", - "tableFrom": "audit_logs", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "audit_logs_organization_id_organizations_id_fk": { - "name": "audit_logs_organization_id_organizations_id_fk", - "tableFrom": "audit_logs", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization_settings": { - "name": "organization_settings", - "schema": "", - "columns": { - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "cloud_settings": { - "name": "cloud_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "default_settings": { - "name": "default_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "allow_list": { - "name": "allow_list", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{\"allowAll\":true,\"providers\":{}}'::jsonb" - }, - "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": { - "organization_settings_created_at_idx": { - "name": "organization_settings_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organization_settings_organization_id_organizations_id_fk": { - "name": "organization_settings_organization_id_organizations_id_fk", - "tableFrom": "organization_settings", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "organizations_slug_idx": { - "name": "organizations_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_idx": { - "name": "organizations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.task_shares": { - "name": "task_shares", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "task_id": { - "name": "task_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "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()" - } - }, - "indexes": { - "task_shares_share_token_idx": { - "name": "task_shares_share_token_idx", - "columns": [ - { - "expression": "share_token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_task_id_idx": { - "name": "task_shares_task_id_idx", - "columns": [ - { - "expression": "task_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_org_id_idx": { - "name": "task_shares_org_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_expires_at_idx": { - "name": "task_shares_expires_at_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_created_by_user_id_idx": { - "name": "task_shares_created_by_user_id_idx", - "columns": [ - { - "expression": "created_by_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "task_shares_organization_id_organizations_id_fk": { - "name": "task_shares_organization_id_organizations_id_fk", - "tableFrom": "task_shares", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "task_shares_created_by_user_id_users_id_fk": { - "name": "task_shares_created_by_user_id_users_id_fk", - "tableFrom": "task_shares", - "tableTo": "users", - "columnsFrom": ["created_by_user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "task_shares_share_token_unique": { - "name": "task_shares_share_token_unique", - "nullsNotDistinct": false, - "columns": ["share_token"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "organization_role": { - "name": "organization_role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "users_organization_id_idx": { - "name": "users_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_organization_role_idx": { - "name": "users_organization_role_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "organization_role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_organization_id_organizations_id_fk": { - "name": "users_organization_id_organizations_id_fk", - "tableFrom": "users", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/0006_snapshot.json b/apps/web/src/db/migrations/meta/0006_snapshot.json deleted file mode 100644 index a06b59d3b0..0000000000 --- a/apps/web/src/db/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,951 +0,0 @@ -{ - "id": "d720a01c-3f4b-4000-a6fd-c5abfc6816b7", - "prevId": "9cf3a792-c153-4ad4-a3f5-0f8054abf28d", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.agent_request_logs": { - "name": "agent_request_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "endpoint": { - "name": "endpoint", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "method": { - "name": "method", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_code": { - "name": "status_code", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "response_time_ms": { - "name": "response_time_ms", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "agent_request_logs_agent_id_idx": { - "name": "agent_request_logs_agent_id_idx", - "columns": [ - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_request_logs_org_id_idx": { - "name": "agent_request_logs_org_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_request_logs_created_at_idx": { - "name": "agent_request_logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_request_logs_agent_id_agents_id_fk": { - "name": "agent_request_logs_agent_id_agents_id_fk", - "tableFrom": "agent_request_logs", - "tableTo": "agents", - "columnsFrom": ["agent_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "agent_request_logs_organization_id_organizations_id_fk": { - "name": "agent_request_logs_organization_id_organizations_id_fk", - "tableFrom": "agent_request_logs", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agents": { - "name": "agents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "total_requests": { - "name": "total_requests", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_by_user_id": { - "name": "created_by_user_id", - "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, - "default": "now()" - } - }, - "indexes": { - "agents_org_id_idx": { - "name": "agents_org_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agents_active_idx": { - "name": "agents_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "where": "\"agents\".\"is_active\" = 1", - "concurrently": false, - "method": "btree", - "with": {} - }, - "agents_last_used_idx": { - "name": "agents_last_used_idx", - "columns": [ - { - "expression": "last_used_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agents_organization_id_organizations_id_fk": { - "name": "agents_organization_id_organizations_id_fk", - "tableFrom": "agents", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "agents_created_by_user_id_users_id_fk": { - "name": "agents_created_by_user_id_users_id_fk", - "tableFrom": "agents", - "tableTo": "users", - "columnsFrom": ["created_by_user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.audit_logs": { - "name": "audit_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "new_value": { - "name": "new_value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "audit_logs_user_id_idx": { - "name": "audit_logs_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_organization_id_idx": { - "name": "audit_logs_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_target_idx": { - "name": "audit_logs_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "audit_logs_created_at_idx": { - "name": "audit_logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "audit_logs_user_id_users_id_fk": { - "name": "audit_logs_user_id_users_id_fk", - "tableFrom": "audit_logs", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "audit_logs_organization_id_organizations_id_fk": { - "name": "audit_logs_organization_id_organizations_id_fk", - "tableFrom": "audit_logs", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization_settings": { - "name": "organization_settings", - "schema": "", - "columns": { - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "cloud_settings": { - "name": "cloud_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "default_settings": { - "name": "default_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "allow_list": { - "name": "allow_list", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{\"allowAll\":true,\"providers\":{}}'::jsonb" - }, - "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": { - "organization_settings_created_at_idx": { - "name": "organization_settings_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organization_settings_organization_id_organizations_id_fk": { - "name": "organization_settings_organization_id_organizations_id_fk", - "tableFrom": "organization_settings", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "organizations_slug_idx": { - "name": "organizations_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_idx": { - "name": "organizations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.task_shares": { - "name": "task_shares", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "task_id": { - "name": "task_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "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()" - } - }, - "indexes": { - "task_shares_share_token_idx": { - "name": "task_shares_share_token_idx", - "columns": [ - { - "expression": "share_token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_task_id_idx": { - "name": "task_shares_task_id_idx", - "columns": [ - { - "expression": "task_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_org_id_idx": { - "name": "task_shares_org_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_expires_at_idx": { - "name": "task_shares_expires_at_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "task_shares_created_by_user_id_idx": { - "name": "task_shares_created_by_user_id_idx", - "columns": [ - { - "expression": "created_by_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "task_shares_organization_id_organizations_id_fk": { - "name": "task_shares_organization_id_organizations_id_fk", - "tableFrom": "task_shares", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "task_shares_created_by_user_id_users_id_fk": { - "name": "task_shares_created_by_user_id_users_id_fk", - "tableFrom": "task_shares", - "tableTo": "users", - "columnsFrom": ["created_by_user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "task_shares_share_token_unique": { - "name": "task_shares_share_token_unique", - "nullsNotDistinct": false, - "columns": ["share_token"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "organization_role": { - "name": "organization_role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity": { - "name": "entity", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "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": { - "users_organization_id_idx": { - "name": "users_organization_id_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_organization_role_idx": { - "name": "users_organization_role_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "organization_role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_organization_id_organizations_id_fk": { - "name": "users_organization_id_organizations_id_fk", - "tableFrom": "users", - "tableTo": "organizations", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/apps/web/src/db/migrations/meta/_journal.json b/apps/web/src/db/migrations/meta/_journal.json deleted file mode 100644 index 5dbff50f39..0000000000 --- a/apps/web/src/db/migrations/meta/_journal.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "7", - "when": 1747347845063, - "tag": "0000_daffy_psylocke", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1747347900000, - "tag": "0001_add_organization_settings", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1747537218300, - "tag": "0002_normal_mephistopheles", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1747551227749, - "tag": "0003_strange_wild_pack", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1748555520729, - "tag": "0004_overjoyed_bucky", - "breakpoints": true - }, - { - "idx": 5, - "version": "7", - "when": 1748916566563, - "tag": "0005_watery_sphinx", - "breakpoints": true - }, - { - "idx": 6, - "version": "7", - "when": 1750289379751, - "tag": "0006_ambiguous_professor_monster", - "breakpoints": true - }, - { - "idx": 7, - "version": "7", - "when": 1750363919215, - "tag": "0007_tidy_blue_blade", - "breakpoints": true - } - ] -} diff --git a/apps/web/src/db/types.ts b/apps/web/src/db/types.ts deleted file mode 100644 index e201da2da5..0000000000 --- a/apps/web/src/db/types.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { - users, - orgs, - orgSettings, - auditLogs, - taskShares, - agents, - agentRequestLogs, -} from './schema'; - -type Generated = 'id' | 'createdAt' | 'updatedAt'; - -/** - * users - */ - -export type User = typeof users.$inferSelect; - -export type CreateUser = Omit; - -/** - * orgs - */ - -export type Org = typeof orgs.$inferSelect; - -export type CreateOrg = Omit; - -/** - * orgSettings - */ - -export type OrgSettings = typeof orgSettings.$inferSelect; - -export type CreateOrgSettings = Omit< - typeof orgSettings.$inferInsert, - Generated ->; - -/** - * auditLogs - */ - -export type AuditLog = typeof auditLogs.$inferSelect; - -export type CreateAuditLog = Omit; - -export type AuditLogWithUser = AuditLog & { - user: User; -}; - -/** - * taskShares - */ - -export type TaskShare = typeof taskShares.$inferSelect; - -export type CreateTaskShare = Omit; - -/** - * agents - */ - -export type Agent = typeof agents.$inferSelect; - -export type CreateAgent = Omit; - -/** - * agentRequestLogs - */ - -export type RequestLog = typeof agentRequestLogs.$inferSelect; - -export type CreateRequestLog = Omit< - typeof agentRequestLogs.$inferInsert, - Generated ->; diff --git a/apps/web/vitest.setup.server.ts b/apps/web/vitest.setup.server.ts index 2dcb4bd497..ee4c16c0a3 100644 --- a/apps/web/vitest.setup.server.ts +++ b/apps/web/vitest.setup.server.ts @@ -5,13 +5,10 @@ import { sql } from 'drizzle-orm'; let pgClient: ReturnType | undefined = undefined; async function resetTestDatabase() { - pgClient = postgres( - 'postgres://postgres:password@localhost:5432/roo_code_test', - { - prepare: false, - onnotice: () => {}, // Suppress NOTICE logs. - }, - ); + pgClient = postgres('postgres://postgres:password@localhost:5432/test', { + prepare: false, + onnotice: () => {}, // Suppress NOTICE logs. + }); const db = drizzle({ client: pgClient }); diff --git a/docker-compose.yml b/docker-compose.yml index 15455d3fe0..6c6d719f65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,11 +18,11 @@ services: environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password - - POSTGRES_DATABASES=roo_code_development,roo_code_test + - POSTGRES_DATABASES=test,development healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres -d roo_code_development"] + test: ["CMD-SHELL", "pg_isready -U postgres -d development"] interval: 5s - timeout: 5s + timeout: 30s retries: 5 start_period: 30s @@ -47,7 +47,7 @@ services: "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1", ] interval: 5s - timeout: 5s + timeout: 30s retries: 5 start_period: 30s diff --git a/package.json b/package.json index 136c572d1a..8880760727 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "services:down": "docker compose down postgres clickhouse redis roomote-dashboard", "db:up": "docker compose up postgres clickhouse -d --wait && pnpm db:push", "db:down": "docker compose down postgres clickhouse", - "db:push": "pnpm --filter @roo-code-cloud/web db:push --force && pnpm --filter @roo-code-cloud/web db:test:push --force", + "db:push": "pnpm --filter @roo-code-cloud/db db:push --force && pnpm --filter @roo-code-cloud/db db:test:push --force", "db:reset": "pnpm db:down && rimraf .docker/data .docker/logs && pnpm db:up" }, "devDependencies": { diff --git a/packages/config-typescript/base.json b/packages/config-typescript/base.json index 5117f2a3d1..e37177b54b 100644 --- a/packages/config-typescript/base.json +++ b/packages/config-typescript/base.json @@ -14,6 +14,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "strict": true, - "target": "ES2022" + "target": "ES2022", + "types": ["node"] } } diff --git a/packages/db/.env.development b/packages/db/.env.development new file mode 100644 index 0000000000..6e0821d034 --- /dev/null +++ b/packages/db/.env.development @@ -0,0 +1,3 @@ +DATABASE_URL=postgres://postgres:password@localhost:5432/development +CLICKHOUSE_URL=http://localhost:8123/default +CLICKHOUSE_PASSWORD=password diff --git a/packages/db/.env.test b/packages/db/.env.test new file mode 100644 index 0000000000..77c12cfbf7 --- /dev/null +++ b/packages/db/.env.test @@ -0,0 +1,3 @@ +DATABASE_URL=postgres://postgres:password@localhost:5432/test +CLICKHOUSE_URL=http://localhost:8123/default +CLICKHOUSE_PASSWORD=password diff --git a/apps/web/src/db/clickhouse/events.sql b/packages/db/clickhouse/events.sql similarity index 100% rename from apps/web/src/db/clickhouse/events.sql rename to packages/db/clickhouse/events.sql diff --git a/apps/web/src/db/clickhouse/messages.sql b/packages/db/clickhouse/messages.sql similarity index 100% rename from apps/web/src/db/clickhouse/messages.sql rename to packages/db/clickhouse/messages.sql diff --git a/apps/roomote/drizzle.config.ts b/packages/db/drizzle.config.ts similarity index 85% rename from apps/roomote/drizzle.config.ts rename to packages/db/drizzle.config.ts index 9233f37d33..4f185d7fda 100644 --- a/apps/roomote/drizzle.config.ts +++ b/packages/db/drizzle.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'drizzle-kit'; export default defineConfig({ - schema: './src/db/schema.ts', + schema: './src/schema.ts', out: './drizzle', dialect: 'postgresql', dbCredentials: { diff --git a/packages/db/drizzle/0000_freezing_beyonder.sql b/packages/db/drizzle/0000_freezing_beyonder.sql new file mode 100644 index 0000000000..e962429e32 --- /dev/null +++ b/packages/db/drizzle/0000_freezing_beyonder.sql @@ -0,0 +1,130 @@ +CREATE TABLE "agent_request_logs" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "agent_id" text NOT NULL, + "organization_id" text NOT NULL, + "endpoint" text NOT NULL, + "method" text NOT NULL, + "status_code" integer NOT NULL, + "response_time_ms" integer NOT NULL, + "user_agent" text, + "ip_address" text, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "agents" ( + "id" text PRIMARY KEY NOT NULL, + "organization_id" text NOT NULL, + "display_name" text NOT NULL, + "description" text, + "is_active" integer DEFAULT 1 NOT NULL, + "last_used_at" timestamp, + "total_requests" integer DEFAULT 0 NOT NULL, + "created_by_user_id" text NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "audit_logs" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "user_id" text NOT NULL, + "organization_id" text NOT NULL, + "target_type" integer NOT NULL, + "target_id" text NOT NULL, + "new_value" jsonb NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "description" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE "cloud_jobs" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "cloud_jobs_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "type" text NOT NULL, + "status" text DEFAULT 'pending' NOT NULL, + "payload" jsonb NOT NULL, + "result" jsonb, + "error" text, + "slack_thread_ts" text, + "started_at" timestamp, + "completed_at" timestamp, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "organization_settings" ( + "organization_id" text PRIMARY KEY NOT NULL, + "version" integer DEFAULT 1 NOT NULL, + "cloud_settings" jsonb DEFAULT '{}'::jsonb NOT NULL, + "default_settings" jsonb DEFAULT '{}'::jsonb NOT NULL, + "allow_list" jsonb DEFAULT '{"allowAll":true,"providers":{}}'::jsonb NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "organizations" ( + "id" text PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "slug" text NOT NULL, + "image_url" text NOT NULL, + "entity" jsonb NOT NULL, + "last_sync_at" timestamp DEFAULT now() NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "task_shares" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "task_id" text NOT NULL, + "organization_id" text NOT NULL, + "created_by_user_id" text NOT NULL, + "share_token" text NOT NULL, + "visibility" text DEFAULT 'organization' NOT NULL, + "expires_at" timestamp, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "task_shares_share_token_unique" UNIQUE("share_token") +); +--> statement-breakpoint +CREATE TABLE "users" ( + "id" text PRIMARY KEY NOT NULL, + "organization_id" text, + "organization_role" text, + "name" text NOT NULL, + "email" text NOT NULL, + "image_url" text NOT NULL, + "entity" jsonb NOT NULL, + "last_sync_at" timestamp DEFAULT now() NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "agent_request_logs" ADD CONSTRAINT "agent_request_logs_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "agent_request_logs" ADD CONSTRAINT "agent_request_logs_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "agents" ADD CONSTRAINT "agents_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "agents" ADD CONSTRAINT "agents_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "organization_settings" ADD CONSTRAINT "organization_settings_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "task_shares" ADD CONSTRAINT "task_shares_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "task_shares" ADD CONSTRAINT "task_shares_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "users" ADD CONSTRAINT "users_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "agent_request_logs_agent_id_idx" ON "agent_request_logs" USING btree ("agent_id");--> statement-breakpoint +CREATE INDEX "agent_request_logs_org_id_idx" ON "agent_request_logs" USING btree ("organization_id");--> statement-breakpoint +CREATE INDEX "agent_request_logs_created_at_idx" ON "agent_request_logs" USING btree ("created_at");--> statement-breakpoint +CREATE INDEX "agents_org_id_idx" ON "agents" USING btree ("organization_id");--> statement-breakpoint +CREATE INDEX "agents_active_idx" ON "agents" USING btree ("is_active") WHERE "agents"."is_active" = 1;--> statement-breakpoint +CREATE INDEX "agents_last_used_idx" ON "agents" USING btree ("last_used_at");--> statement-breakpoint +CREATE INDEX "audit_logs_user_id_idx" ON "audit_logs" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX "audit_logs_organization_id_idx" ON "audit_logs" USING btree ("organization_id");--> statement-breakpoint +CREATE INDEX "audit_logs_target_idx" ON "audit_logs" USING btree ("target_type","target_id");--> statement-breakpoint +CREATE INDEX "audit_logs_created_at_idx" ON "audit_logs" USING btree ("created_at");--> statement-breakpoint +CREATE INDEX "organization_settings_created_at_idx" ON "organization_settings" USING btree ("created_at");--> statement-breakpoint +CREATE INDEX "organizations_slug_idx" ON "organizations" USING btree ("slug");--> statement-breakpoint +CREATE INDEX "organizations_created_at_idx" ON "organizations" USING btree ("created_at");--> statement-breakpoint +CREATE INDEX "task_shares_share_token_idx" ON "task_shares" USING btree ("share_token");--> statement-breakpoint +CREATE INDEX "task_shares_task_id_idx" ON "task_shares" USING btree ("task_id");--> statement-breakpoint +CREATE INDEX "task_shares_org_id_idx" ON "task_shares" USING btree ("organization_id");--> statement-breakpoint +CREATE INDEX "task_shares_expires_at_idx" ON "task_shares" USING btree ("expires_at");--> statement-breakpoint +CREATE INDEX "task_shares_created_by_user_id_idx" ON "task_shares" USING btree ("created_by_user_id");--> statement-breakpoint +CREATE INDEX "task_shares_visibility_idx" ON "task_shares" USING btree ("visibility");--> statement-breakpoint +CREATE INDEX "users_organization_id_idx" ON "users" USING btree ("organization_id");--> statement-breakpoint +CREATE INDEX "users_organization_role_idx" ON "users" USING btree ("organization_id","organization_role");--> statement-breakpoint +CREATE INDEX "users_email_idx" ON "users" USING btree ("email");--> statement-breakpoint +CREATE INDEX "users_created_at_idx" ON "users" USING btree ("created_at"); \ No newline at end of file diff --git a/apps/web/src/db/migrations/meta/0007_snapshot.json b/packages/db/drizzle/meta/0000_snapshot.json similarity index 92% rename from apps/web/src/db/migrations/meta/0007_snapshot.json rename to packages/db/drizzle/meta/0000_snapshot.json index a7c31febb1..bd73cd6840 100644 --- a/apps/web/src/db/migrations/meta/0007_snapshot.json +++ b/packages/db/drizzle/meta/0000_snapshot.json @@ -1,6 +1,6 @@ { - "id": "a6128d1e-dc00-490a-8c2c-70da368301bd", - "prevId": "d720a01c-3f4b-4000-a6fd-c5abfc6816b7", + "id": "8225f80f-a26a-45be-8cef-b67259c6751f", + "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { @@ -436,6 +436,92 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.cloud_jobs": { + "name": "cloud_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "cloud_jobs_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "result": { + "name": "result", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "slack_thread_ts": { + "name": "slack_thread_ts", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.organization_settings": { "name": "organization_settings", "schema": "", diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json new file mode 100644 index 0000000000..fee06ca0c1 --- /dev/null +++ b/packages/db/drizzle/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "7", + "dialect": "postgresql", + "entries": [ + { + "idx": 0, + "version": "7", + "when": 1750457882404, + "tag": "0000_freezing_beyonder", + "breakpoints": true + } + ] +} diff --git a/packages/db/eslint.config.mjs b/packages/db/eslint.config.mjs new file mode 100644 index 0000000000..c072244298 --- /dev/null +++ b/packages/db/eslint.config.mjs @@ -0,0 +1,4 @@ +import { config } from "@roo-code-cloud/config-eslint/base" + +/** @type {import("eslint").Linter.Config} */ +export default [...config] diff --git a/packages/db/package.json b/packages/db/package.json index 88892d64e0..774ed54d7f 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,4 +1,40 @@ { "name": "@roo-code-cloud/db", - "private": true + "private": true, + "main": "./src/index.ts", + "types": "./src/index.ts", + "exports": { + ".": { + "import": "./src/index.ts", + "require": "./src/index.ts", + "types": "./src/index.ts" + }, + "./server": { + "import": "./src/server.ts", + "require": "./src/server.ts", + "types": "./src/server.ts" + } + }, + "scripts": { + "lint": "eslint src --ext=ts --max-warnings=0", + "check-types": "tsc --noEmit", + "clean": "rimraf .turbo", + "drizzle-kit": "dotenvx run -f .env -- tsx node_modules/drizzle-kit/bin.cjs", + "db:generate": "dotenvx run -f .env.development -- drizzle-kit generate", + "db:migrate": "dotenvx run -f .env.development -- drizzle-kit migrate", + "db:push": "dotenvx run -f .env.development -- drizzle-kit push", + "db:test:push": "dotenvx run -f .env.test -- drizzle-kit push" + }, + "dependencies": { + "@roo-code/types": "^1.26.0", + "drizzle-orm": "^0.44.2", + "postgres": "^3.4.7", + "zod": "^3.25.41" + }, + "devDependencies": { + "@roo-code-cloud/config-eslint": "workspace:^", + "@roo-code-cloud/config-typescript": "workspace:^", + "@types/node": "^24.0.3", + "drizzle-kit": "^0.31.1" + } } diff --git a/packages/db/src/db.ts b/packages/db/src/db.ts new file mode 100644 index 0000000000..ed43571276 --- /dev/null +++ b/packages/db/src/db.ts @@ -0,0 +1,24 @@ +import { drizzle } from 'drizzle-orm/postgres-js'; +import postgres from 'postgres'; + +import * as schema from './schema'; + +const client = postgres(process.env.DATABASE_URL!, { prepare: false }); +const db = drizzle({ client, schema }); + +if (process.env.NODE_ENV === 'test') { + if ( + !process.env.DATABASE_URL!.includes('test') || + !process.env.DATABASE_URL!.includes('localhost') + ) { + throw new Error('DATABASE_URL is not a test database'); + } +} + +const disconnect = async () => client.end(); + +type DatabaseOrTransaction = + | typeof db + | Parameters[0]>[0]; + +export { db, disconnect, type DatabaseOrTransaction }; diff --git a/apps/web/src/db/enums.ts b/packages/db/src/enums.ts similarity index 100% rename from apps/web/src/db/enums.ts rename to packages/db/src/enums.ts diff --git a/apps/web/src/db/index.ts b/packages/db/src/index.ts similarity index 100% rename from apps/web/src/db/index.ts rename to packages/db/src/index.ts diff --git a/apps/web/src/db/queries/index.ts b/packages/db/src/queries/index.ts similarity index 100% rename from apps/web/src/db/queries/index.ts rename to packages/db/src/queries/index.ts diff --git a/apps/web/src/db/queries/users.ts b/packages/db/src/queries/users.ts similarity index 90% rename from apps/web/src/db/queries/users.ts rename to packages/db/src/queries/users.ts index abbaced5dd..14d3f5d6e0 100644 --- a/apps/web/src/db/queries/users.ts +++ b/packages/db/src/queries/users.ts @@ -1,6 +1,6 @@ import { inArray } from 'drizzle-orm'; -import { client as db } from '../db'; +import { db } from '../db'; import { users } from '../schema'; import type { User } from '../types'; diff --git a/apps/web/src/db/schema.ts b/packages/db/src/schema.ts similarity index 91% rename from apps/web/src/db/schema.ts rename to packages/db/src/schema.ts index abe7a3c897..025ca22086 100644 --- a/apps/web/src/db/schema.ts +++ b/packages/db/src/schema.ts @@ -17,6 +17,7 @@ import { } from '@roo-code/types'; import { AuditLogTargetType } from './enums'; +import { JobType, JobStatus, JobPayload } from './types'; /** * users @@ -289,3 +290,26 @@ export const agentRequestLogsRelations = relations( }), }), ); + +/** + * cloudJobs + */ + +export const cloudJobs = pgTable('cloud_jobs', { + id: integer().primaryKey().generatedAlwaysAsIdentity(), + type: text().notNull().$type(), + status: text().notNull().default('pending').$type(), + payload: jsonb().notNull().$type(), + result: jsonb(), + error: text(), + slackThreadTs: text('slack_thread_ts'), + startedAt: timestamp('started_at'), + completedAt: timestamp('completed_at'), + createdAt: timestamp('created_at').notNull().defaultNow(), +}); + +export type CloudJob = typeof cloudJobs.$inferSelect; + +export type InsertCloudJob = typeof cloudJobs.$inferInsert; + +export type UpdateCloudJob = Partial>; diff --git a/apps/web/src/db/server.ts b/packages/db/src/server.ts similarity index 100% rename from apps/web/src/db/server.ts rename to packages/db/src/server.ts diff --git a/packages/db/src/types.ts b/packages/db/src/types.ts new file mode 100644 index 0000000000..d504c35496 --- /dev/null +++ b/packages/db/src/types.ts @@ -0,0 +1,147 @@ +import { z } from 'zod'; + +import type { + users, + orgs, + orgSettings, + auditLogs, + taskShares, + agents, + agentRequestLogs, +} from './schema'; + +type Generated = 'id' | 'createdAt' | 'updatedAt'; + +/** + * users + */ + +export type User = typeof users.$inferSelect; + +export type CreateUser = Omit; + +/** + * orgs + */ + +export type Org = typeof orgs.$inferSelect; + +export type CreateOrg = Omit; + +/** + * orgSettings + */ + +export type OrgSettings = typeof orgSettings.$inferSelect; + +export type CreateOrgSettings = Omit< + typeof orgSettings.$inferInsert, + Generated +>; + +/** + * auditLogs + */ + +export type AuditLog = typeof auditLogs.$inferSelect; + +export type CreateAuditLog = Omit; + +export type AuditLogWithUser = AuditLog & { + user: User; +}; + +/** + * taskShares + */ + +export type TaskShare = typeof taskShares.$inferSelect; + +export type CreateTaskShare = Omit; + +/** + * agents + */ + +export type Agent = typeof agents.$inferSelect; + +export type CreateAgent = Omit; + +/** + * agentRequestLogs + */ + +export type RequestLog = typeof agentRequestLogs.$inferSelect; + +export type CreateRequestLog = Omit< + typeof agentRequestLogs.$inferInsert, + Generated +>; + +/** + * CreateJob + */ + +export const createJobSchema = z.discriminatedUnion('type', [ + z.object({ + type: z.literal('github.issue.fix'), + payload: z.object({ + repo: z.string(), + issue: z.number(), + title: z.string(), + body: z.string(), + labels: z.array(z.string()).optional(), + }), + }), + z.object({ + type: z.literal('github.issue.comment.respond'), + payload: z.object({ + repo: z.string(), + issueNumber: z.number(), + issueTitle: z.string(), + issueBody: z.string(), + commentId: z.number(), + commentBody: z.string(), + commentAuthor: z.string(), + commentUrl: z.string(), + }), + }), + z.object({ + type: z.literal('github.pr.comment.respond'), + payload: z.object({ + repo: z.string(), + prNumber: z.number(), + prTitle: z.string(), + prBody: z.string(), + prBranch: z.string(), + baseRef: z.string(), + commentId: z.number(), + commentBody: z.string(), + commentAuthor: z.string(), + commentType: z.enum(['issue_comment', 'review_comment']), + commentUrl: z.string(), + }), + }), +]); + +export type CreateJob = z.infer; + +export type JobTypes = { + [K in CreateJob['type']]: Extract['payload']; +}; + +/** + * JobType, JobStatus, JobPayload, JobParams + */ + +export type JobType = keyof JobTypes; + +export type JobStatus = 'pending' | 'processing' | 'completed' | 'failed'; + +export type JobPayload = JobTypes[T]; + +export type JobParams = { + jobId: number; + type: T; + payload: JobPayload; +}; diff --git a/packages/db/tsconfig.json b/packages/db/tsconfig.json new file mode 100644 index 0000000000..54fa32a48d --- /dev/null +++ b/packages/db/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "@roo-code-cloud/config-typescript/base.json", + "include": ["src"], + "exclude": ["node_modules"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6dbe762f5a..3520db10f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,15 +39,9 @@ importers: apps/roomote: dependencies: - '@bull-board/api': - specifier: ^6.10.1 - version: 6.10.1(@bull-board/ui@6.10.1) - '@bull-board/express': - specifier: ^6.10.1 - version: 6.10.1 - '@bull-board/ui': - specifier: ^6.10.1 - version: 6.10.1 + '@roo-code-cloud/db': + specifier: workspace:^ + version: link:../../packages/db '@roo-code-cloud/ipc': specifier: workspace:^ version: link:../../packages/ipc @@ -58,16 +52,13 @@ importers: specifier: ^5.37.0 version: 5.54.3 drizzle-orm: - specifier: ^0.44.1 + specifier: ^0.44.2 version: 0.44.2(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7) execa: specifier: ^9.6.0 version: 9.6.0 - express: - specifier: ^5.1.0 - version: 5.1.0 ioredis: - specifier: ^5.4.3 + specifier: ^5.6.1 version: 5.6.1 next: specifier: ^15.3.3 @@ -75,9 +66,6 @@ importers: p-wait-for: specifier: ^5.0.2 version: 5.0.2 - postgres: - specifier: ^3.4.7 - version: 3.4.7 react: specifier: ^19.1.0 version: 19.1.0 @@ -94,9 +82,6 @@ importers: '@roo-code-cloud/config-typescript': specifier: workspace:^ version: link:../../packages/config-typescript - '@types/express': - specifier: ^5.0.3 - version: 5.0.3 '@types/node': specifier: ^22.15.20 version: 22.15.32 @@ -106,12 +91,6 @@ importers: '@types/react-dom': specifier: ^19.1.6 version: 19.1.6(@types/react@19.1.6) - concurrently: - specifier: ^9.1.0 - version: 9.1.2 - drizzle-kit: - specifier: ^0.31.1 - version: 0.31.1 tsx: specifier: ^4.19.3 version: 4.20.3 @@ -119,6 +98,43 @@ importers: specifier: ^3.2.3 version: 3.2.4(@types/debug@4.1.12)(@types/node@22.15.32)(jiti@2.4.2)(jsdom@26.1.0)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) + apps/roomote-dashboard: + dependencies: + '@bull-board/api': + specifier: ^6.10.1 + version: 6.10.1(@bull-board/ui@6.10.1) + '@bull-board/express': + specifier: ^6.10.1 + version: 6.10.1 + '@bull-board/ui': + specifier: ^6.10.1 + version: 6.10.1 + bullmq: + specifier: ^5.54.3 + version: 5.54.3 + express: + specifier: ^5.1.0 + version: 5.1.0 + ioredis: + specifier: ^5.6.1 + version: 5.6.1 + devDependencies: + '@roo-code-cloud/config-eslint': + specifier: workspace:^ + version: link:../../packages/config-eslint + '@roo-code-cloud/config-typescript': + specifier: workspace:^ + version: link:../../packages/config-typescript + '@types/express': + specifier: ^5.0.3 + version: 5.0.3 + '@types/node': + specifier: ^24.0.3 + version: 24.0.3 + tsx: + specifier: ^4.19.3 + version: 4.20.3 + apps/web: dependencies: '@clerk/localizations': @@ -181,12 +197,15 @@ importers: '@radix-ui/react-tooltip': specifier: ^1.2.7 version: 1.2.7(@types/react-dom@19.1.6(@types/react@19.1.6))(@types/react@19.1.6)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + '@roo-code-cloud/db': + specifier: workspace:^ + version: link:../../packages/db '@roo-code/types': specifier: ^1.26.0 version: 1.26.0 '@sentry/nextjs': specifier: ^9.23.0 - version: 9.23.0(@opentelemetry/context-async-hooks@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.57.2(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.30.1(@opentelemetry/api@1.9.0))(next@15.3.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react@19.1.0)(webpack@5.99.9(esbuild@0.25.5)) + version: 9.23.0(@opentelemetry/context-async-hooks@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.57.2(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.30.1(@opentelemetry/api@1.9.0))(next@15.3.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react@19.1.0)(webpack@5.99.9) '@t3-oss/env-nextjs': specifier: ^0.13.6 version: 0.13.6(arktype@2.1.20)(typescript@5.8.3)(zod@3.25.41) @@ -215,11 +234,8 @@ importers: specifier: ^4.1.0 version: 4.1.0 drizzle-orm: - specifier: ^0.43.1 - version: 0.43.1(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7) - drizzle-zod: - specifier: ^0.7.1 - version: 0.7.1(drizzle-orm@0.43.1(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7))(zod@3.25.41) + specifier: ^0.44.2 + version: 0.44.2(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7) fuzzysort: specifier: ^3.1.0 version: 3.1.0 @@ -335,9 +351,6 @@ importers: '@vitejs/plugin-react': specifier: ^4.5.2 version: 4.5.2(vite@6.3.5(@types/node@22.15.27)(jiti@2.4.2)(lightningcss@1.30.1)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)) - drizzle-kit: - specifier: ^0.31.1 - version: 0.31.1 eslint-config-prettier: specifier: ^10.1.5 version: 10.1.5(eslint@9.29.0(jiti@2.4.2)) @@ -413,7 +426,33 @@ importers: packages/config-typescript: {} - packages/db: {} + packages/db: + dependencies: + '@roo-code/types': + specifier: ^1.26.0 + version: 1.26.0 + drizzle-orm: + specifier: ^0.44.2 + version: 0.44.2(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7) + postgres: + specifier: ^3.4.7 + version: 3.4.7 + zod: + specifier: ^3.25.41 + version: 3.25.41 + devDependencies: + '@roo-code-cloud/config-eslint': + specifier: workspace:^ + version: link:../config-eslint + '@roo-code-cloud/config-typescript': + specifier: workspace:^ + version: link:../config-typescript + '@types/node': + specifier: ^24.0.3 + version: 24.0.3 + drizzle-kit: + specifier: ^0.31.1 + version: 0.31.1 packages/ipc: dependencies: @@ -2676,6 +2715,9 @@ packages: '@types/node@22.15.32': resolution: {integrity: sha512-3jigKqgSjsH6gYZv2nEsqdXfZqIFGAV36XYYjf9KGZ3PSG+IhLecqPnI310RvjutyMwifE2hhhNEklOUrvx/wA==} + '@types/node@24.0.3': + resolution: {integrity: sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==} + '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -3177,10 +3219,6 @@ packages: cliui@7.0.4: resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} - cliui@8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - clsx@2.1.1: resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} engines: {node: '>=6'} @@ -3236,11 +3274,6 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - concurrently@9.1.2: - resolution: {integrity: sha512-H9MWcoPsYddwbOGM6difjVwVZHl63nwMEwDJG/L7VGtuaJhb12h2caPG2tVPWs7emuYix252iGfqOyrz1GczTQ==} - engines: {node: '>=18'} - hasBin: true - content-disposition@1.0.0: resolution: {integrity: sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==} engines: {node: '>= 0.6'} @@ -3463,95 +3496,6 @@ packages: resolution: {integrity: sha512-PUjYKWtzOzPtdtQlTHQG3qfv4Y0XT8+Eas6UbxCmxTj7qgMf+39dDujf1BP1I+qqZtw9uzwTh8jYtkMuCq+B0Q==} hasBin: true - drizzle-orm@0.43.1: - resolution: {integrity: sha512-dUcDaZtE/zN4RV/xqGrVSMpnEczxd5cIaoDeor7Zst9wOe/HzC/7eAaulywWGYXdDEc9oBPMjayVEDg0ziTLJA==} - peerDependencies: - '@aws-sdk/client-rds-data': '>=3' - '@cloudflare/workers-types': '>=4' - '@electric-sql/pglite': '>=0.2.0' - '@libsql/client': '>=0.10.0' - '@libsql/client-wasm': '>=0.10.0' - '@neondatabase/serverless': '>=0.10.0' - '@op-engineering/op-sqlite': '>=2' - '@opentelemetry/api': ^1.4.1 - '@planetscale/database': '>=1.13' - '@prisma/client': '*' - '@tidbcloud/serverless': '*' - '@types/better-sqlite3': '*' - '@types/pg': '*' - '@types/sql.js': '*' - '@vercel/postgres': '>=0.8.0' - '@xata.io/client': '*' - better-sqlite3: '>=7' - bun-types: '*' - expo-sqlite: '>=14.0.0' - gel: '>=2' - knex: '*' - kysely: '*' - mysql2: '>=2' - pg: '>=8' - postgres: '>=3' - prisma: '*' - sql.js: '>=1' - sqlite3: '>=5' - peerDependenciesMeta: - '@aws-sdk/client-rds-data': - optional: true - '@cloudflare/workers-types': - optional: true - '@electric-sql/pglite': - optional: true - '@libsql/client': - optional: true - '@libsql/client-wasm': - optional: true - '@neondatabase/serverless': - optional: true - '@op-engineering/op-sqlite': - optional: true - '@opentelemetry/api': - optional: true - '@planetscale/database': - optional: true - '@prisma/client': - optional: true - '@tidbcloud/serverless': - optional: true - '@types/better-sqlite3': - optional: true - '@types/pg': - optional: true - '@types/sql.js': - optional: true - '@vercel/postgres': - optional: true - '@xata.io/client': - optional: true - better-sqlite3: - optional: true - bun-types: - optional: true - expo-sqlite: - optional: true - gel: - optional: true - knex: - optional: true - kysely: - optional: true - mysql2: - optional: true - pg: - optional: true - postgres: - optional: true - prisma: - optional: true - sql.js: - optional: true - sqlite3: - optional: true - drizzle-orm@0.44.2: resolution: {integrity: sha512-zGAqBzWWkVSFjZpwPOrmCrgO++1kZ5H/rZ4qTGeGOe18iXGVJWf3WPfHOVwFIbmi8kHjfJstC6rJomzGx8g/dQ==} peerDependencies: @@ -3644,12 +3588,6 @@ packages: sqlite3: optional: true - drizzle-zod@0.7.1: - resolution: {integrity: sha512-nZzALOdz44/AL2U005UlmMqaQ1qe5JfanvLujiTHiiT8+vZJTBFhj3pY4Vk+L6UWyKFfNmLhk602Hn4kCTynKQ==} - peerDependencies: - drizzle-orm: '>=0.36.0' - zod: '>=3.0.0' - dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} @@ -5277,8 +5215,8 @@ packages: pg-protocol@1.10.0: resolution: {integrity: sha512-IpdytjudNuLv8nhlHs/UrVBhU0e78J0oIS/0AVdTbWxSOkFUVdsHC/NrorO6nXsQNDTT1kzDSOMJubBQviX18Q==} - pg-protocol@1.10.1: - resolution: {integrity: sha512-9YS3ZonDj0Lxny//aF0ITPdfrEPgKWCJvONsSXAaIUhgpzlzl5JgaZNlbTFxvYNfm2terGEnHeOSUlF6qRGBzw==} + pg-protocol@1.10.2: + resolution: {integrity: sha512-Ci7jy8PbaWxfsck2dwZdERcDG2A0MG8JoQILs+uZNjABFuBuItAZCWUNz8sXRDMoui24rJw7WlXqgpMdBSN/vQ==} pg-types@2.2.0: resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} @@ -5697,9 +5635,6 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - rxjs@7.8.2: - resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==} - safe-array-concat@1.1.3: resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==} engines: {node: '>=0.4'} @@ -5805,10 +5740,6 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - shell-quote@1.8.3: - resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==} - engines: {node: '>= 0.4'} - shimmer@1.2.1: resolution: {integrity: sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==} @@ -6188,10 +6119,6 @@ packages: resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==} engines: {node: '>=18'} - tree-kill@1.2.2: - resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} - hasBin: true - trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -6330,6 +6257,9 @@ packages: undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici-types@7.8.0: + resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==} + unicorn-magic@0.3.0: resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} engines: {node: '>=18'} @@ -6540,8 +6470,8 @@ packages: resolution: {integrity: sha512-77R0RDmJfj9dyv5p3bM5pOHa+X8/ZkO9c7kpDstigkC4nIDobadsfSGCwB4bKhMVxqAok8tajaoR8rirM7+VFQ==} engines: {node: '>=10.13.0'} - webpack-sources@3.3.2: - resolution: {integrity: sha512-ykKKus8lqlgXX/1WjudpIEjqsafjOTcOJqxnAbMLAu/KCsDCJ6GBtvscewvTkrn24HsnvFwrSCbenFrhtcCsAA==} + webpack-sources@3.3.3: + resolution: {integrity: sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==} engines: {node: '>=10.13.0'} webpack-virtual-modules@0.5.0: @@ -6680,18 +6610,10 @@ packages: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} - yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - yargs@16.2.0: resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} engines: {node: '>=10'} - yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -8489,7 +8411,7 @@ snapshots: '@sentry/core@9.23.0': {} - '@sentry/nextjs@9.23.0(@opentelemetry/context-async-hooks@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.57.2(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.30.1(@opentelemetry/api@1.9.0))(next@15.3.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react@19.1.0)(webpack@5.99.9(esbuild@0.25.5))': + '@sentry/nextjs@9.23.0(@opentelemetry/context-async-hooks@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.57.2(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.30.1(@opentelemetry/api@1.9.0))(next@15.3.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react@19.1.0)(webpack@5.99.9)': dependencies: '@opentelemetry/api': 1.9.0 '@opentelemetry/semantic-conventions': 1.34.0 @@ -8500,7 +8422,7 @@ snapshots: '@sentry/opentelemetry': 9.23.0(@opentelemetry/api@1.9.0)(@opentelemetry/context-async-hooks@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.57.2(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/semantic-conventions@1.34.0) '@sentry/react': 9.23.0(react@19.1.0) '@sentry/vercel-edge': 9.23.0 - '@sentry/webpack-plugin': 3.5.0(webpack@5.99.9(esbuild@0.25.5)) + '@sentry/webpack-plugin': 3.5.0(webpack@5.99.9) chalk: 3.0.0 next: 15.3.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) resolve: 1.22.8 @@ -8577,12 +8499,12 @@ snapshots: '@opentelemetry/api': 1.9.0 '@sentry/core': 9.23.0 - '@sentry/webpack-plugin@3.5.0(webpack@5.99.9(esbuild@0.25.5))': + '@sentry/webpack-plugin@3.5.0(webpack@5.99.9)': dependencies: '@sentry/bundler-plugin-core': 3.5.0 unplugin: 1.0.1 uuid: 9.0.1 - webpack: 5.99.9(esbuild@0.25.5) + webpack: 5.99.9 transitivePeerDependencies: - encoding - supports-color @@ -8877,6 +8799,10 @@ snapshots: dependencies: undici-types: 6.21.0 + '@types/node@24.0.3': + dependencies: + undici-types: 7.8.0 + '@types/normalize-package-data@2.4.4': {} '@types/pg-pool@2.0.6': @@ -9511,12 +9437,6 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 - cliui@8.0.1: - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - clsx@2.1.1: {} cluster-key-slot@1.1.2: {} @@ -9567,16 +9487,6 @@ snapshots: concat-map@0.0.1: {} - concurrently@9.1.2: - dependencies: - chalk: 4.1.2 - lodash: 4.17.21 - rxjs: 7.8.2 - shell-quote: 1.8.3 - supports-color: 8.1.1 - tree-kill: 1.2.2 - yargs: 17.7.2 - content-disposition@1.0.0: dependencies: safe-buffer: 5.2.1 @@ -9784,15 +9694,6 @@ snapshots: transitivePeerDependencies: - supports-color - drizzle-orm@0.43.1(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7): - optionalDependencies: - '@electric-sql/pglite': 0.3.0 - '@libsql/client-wasm': 0.15.5 - '@opentelemetry/api': 1.9.0 - '@types/pg': 8.15.2 - pg: 8.15.6 - postgres: 3.4.7 - drizzle-orm@0.44.2(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7): optionalDependencies: '@electric-sql/pglite': 0.3.0 @@ -9802,11 +9703,6 @@ snapshots: pg: 8.15.6 postgres: 3.4.7 - drizzle-zod@0.7.1(drizzle-orm@0.43.1(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7))(zod@3.25.41): - dependencies: - drizzle-orm: 0.43.1(@electric-sql/pglite@0.3.0)(@libsql/client-wasm@0.15.5)(@opentelemetry/api@1.9.0)(@types/pg@8.15.2)(pg@8.15.6)(postgres@3.4.7) - zod: 3.25.41 - dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 @@ -11733,7 +11629,7 @@ snapshots: pg-protocol@1.10.0: {} - pg-protocol@1.10.1: + pg-protocol@1.10.2: optional: true pg-types@2.2.0: @@ -11758,7 +11654,7 @@ snapshots: dependencies: pg-connection-string: 2.9.1 pg-pool: 3.10.1(pg@8.15.6) - pg-protocol: 1.10.1 + pg-protocol: 1.10.2 pg-types: 2.2.0 pgpass: 1.0.5 optionalDependencies: @@ -12273,10 +12169,6 @@ snapshots: dependencies: queue-microtask: 1.2.3 - rxjs@7.8.2: - dependencies: - tslib: 2.8.1 - safe-array-concat@1.1.3: dependencies: call-bind: 1.0.8 @@ -12423,8 +12315,6 @@ snapshots: shebang-regex@3.0.0: {} - shell-quote@1.8.3: {} - shimmer@1.2.1: {} side-channel-list@1.0.0: @@ -12736,16 +12626,14 @@ snapshots: mkdirp: 3.0.1 yallist: 5.0.0 - terser-webpack-plugin@5.3.14(esbuild@0.25.5)(webpack@5.99.9(esbuild@0.25.5)): + terser-webpack-plugin@5.3.14(webpack@5.99.9): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 4.3.2 serialize-javascript: 6.0.2 terser: 5.43.1 - webpack: 5.99.9(esbuild@0.25.5) - optionalDependencies: - esbuild: 0.25.5 + webpack: 5.99.9 terser@5.43.1: dependencies: @@ -12808,8 +12696,6 @@ snapshots: dependencies: punycode: 2.3.1 - tree-kill@1.2.2: {} - trim-lines@3.0.1: {} trim-newlines@3.0.1: {} @@ -12938,6 +12824,8 @@ snapshots: undici-types@6.21.0: {} + undici-types@7.8.0: {} + unicorn-magic@0.3.0: {} unified@11.0.5: @@ -13357,11 +13245,11 @@ snapshots: webpack-sources@3.3.0: {} - webpack-sources@3.3.2: {} + webpack-sources@3.3.3: {} webpack-virtual-modules@0.5.0: {} - webpack@5.99.9(esbuild@0.25.5): + webpack@5.99.9: dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.8 @@ -13384,9 +13272,9 @@ snapshots: neo-async: 2.6.2 schema-utils: 4.3.2 tapable: 2.2.2 - terser-webpack-plugin: 5.3.14(esbuild@0.25.5)(webpack@5.99.9(esbuild@0.25.5)) + terser-webpack-plugin: 5.3.14(webpack@5.99.9) watchpack: 2.4.4 - webpack-sources: 3.3.2 + webpack-sources: 3.3.3 transitivePeerDependencies: - '@swc/core' - esbuild @@ -13506,8 +13394,6 @@ snapshots: yargs-parser@20.2.9: {} - yargs-parser@21.1.1: {} - yargs@16.2.0: dependencies: cliui: 7.0.4 @@ -13518,16 +13404,6 @@ snapshots: y18n: 5.0.8 yargs-parser: 20.2.9 - yargs@17.7.2: - dependencies: - cliui: 8.0.1 - escalade: 3.2.0 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 21.1.1 - yocto-queue@0.1.0: {} yoctocolors@2.1.1: {}