diff --git a/.opencode-version b/.opencode-version index 67afc371e2..f0257c2afb 100644 --- a/.opencode-version +++ b/.opencode-version @@ -1 +1 @@ -v1.17.4 +v1.17.5 diff --git a/bun.lock b/bun.lock index bc43f72c73..35e183c5d7 100644 --- a/bun.lock +++ b/bun.lock @@ -29,7 +29,7 @@ }, "packages/app": { "name": "@opencode-ai/app", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@kobalte/core": "catalog:", "@opencode-ai/core": "workspace:*", @@ -85,7 +85,7 @@ }, "packages/cli": { "name": "@opencode-ai/cli", - "version": "1.17.4", + "version": "1.17.5", "bin": { "lildax": "./bin/lildax.cjs", }, @@ -110,7 +110,7 @@ }, "packages/console/app": { "name": "@opencode-ai/console-app", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@cloudflare/vite-plugin": "1.15.2", "@ibm/plex": "6.4.1", @@ -146,7 +146,7 @@ }, "packages/console/core": { "name": "@opencode-ai/console-core", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@aws-sdk/client-sts": "3.782.0", "@jsx-email/render": "1.1.1", @@ -173,7 +173,7 @@ }, "packages/console/function": { "name": "@opencode-ai/console-function", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@ai-sdk/anthropic": "3.0.82", "@ai-sdk/openai": "3.0.48", @@ -195,7 +195,7 @@ }, "packages/console/mail": { "name": "@opencode-ai/console-mail", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@jsx-email/all": "2.2.3", "@jsx-email/cli": "1.4.3", @@ -219,7 +219,7 @@ }, "packages/console/support": { "name": "@opencode-ai/console-support", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@cloudflare/vite-plugin": "1.15.2", "@opencode-ai/console-core": "workspace:*", @@ -239,7 +239,7 @@ }, "packages/core": { "name": "@opencode-ai/core", - "version": "1.17.4", + "version": "1.17.5", "bin": { "opencode": "./bin/opencode", }, @@ -330,7 +330,7 @@ }, "packages/desktop": { "name": "@opencode-ai/desktop", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@zip.js/zip.js": "2.7.62", "effect": "catalog:", @@ -384,7 +384,7 @@ }, "packages/effect-drizzle-sqlite": { "name": "@opencode-ai/effect-drizzle-sqlite", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "drizzle-orm": "catalog:", "effect": "catalog:", @@ -398,7 +398,7 @@ }, "packages/effect-sqlite-node": { "name": "@opencode-ai/effect-sqlite-node", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "effect": "catalog:", }, @@ -410,7 +410,7 @@ }, "packages/enterprise": { "name": "@opencode-ai/enterprise", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@hono/standard-validator": "catalog:", "@opencode-ai/core": "workspace:*", @@ -441,7 +441,7 @@ }, "packages/function": { "name": "@opencode-ai/function", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@octokit/auth-app": "8.0.1", "@octokit/rest": "catalog:", @@ -457,7 +457,7 @@ }, "packages/http-recorder": { "name": "@opencode-ai/http-recorder", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@effect/platform-node": "4.0.0-beta.74", "@effect/platform-node-shared": "4.0.0-beta.74", @@ -476,7 +476,7 @@ }, "packages/llm": { "name": "@opencode-ai/llm", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@smithy/eventstream-codec": "4.2.14", "@smithy/util-utf8": "4.2.2", @@ -494,7 +494,7 @@ }, "packages/opencode": { "name": "opencode", - "version": "1.17.4", + "version": "1.17.5", "bin": { "opencode": "./bin/opencode", }, @@ -622,7 +622,7 @@ }, "packages/plugin": { "name": "@opencode-ai/plugin", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@opencode-ai/sdk": "workspace:*", "effect": "catalog:", @@ -660,7 +660,7 @@ }, "packages/sdk/js": { "name": "@opencode-ai/sdk", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "cross-spawn": "catalog:", }, @@ -675,7 +675,7 @@ }, "packages/server": { "name": "@opencode-ai/server", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@opencode-ai/core": "workspace:*", "drizzle-orm": "catalog:", @@ -689,7 +689,7 @@ }, "packages/slack": { "name": "@opencode-ai/slack", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@opencode-ai/sdk": "workspace:*", "@slack/bolt": "^3.17.1", @@ -702,7 +702,7 @@ }, "packages/stats/app": { "name": "@opencode-ai/stats-app", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@ibm/plex": "6.4.1", "@opencode-ai/stats-core": "workspace:*", @@ -735,7 +735,7 @@ }, "packages/stats/core": { "name": "@opencode-ai/stats-core", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@aws-sdk/client-athena": "3.933.0", "@planetscale/database": "1.19.0", @@ -754,7 +754,7 @@ }, "packages/stats/server": { "name": "@opencode-ai/stats-server", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@aws-sdk/client-firehose": "3.933.0", "@effect/platform-node": "catalog:", @@ -794,7 +794,7 @@ }, "packages/tui": { "name": "@opencode-ai/tui", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@opencode-ai/core": "workspace:*", "@opencode-ai/plugin": "workspace:*", @@ -821,7 +821,7 @@ }, "packages/ui": { "name": "@opencode-ai/ui", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@kobalte/core": "catalog:", "@opencode-ai/core": "workspace:*", @@ -870,7 +870,7 @@ }, "packages/web": { "name": "@opencode-ai/web", - "version": "1.17.4", + "version": "1.17.5", "dependencies": { "@astrojs/cloudflare": "12.6.3", "@astrojs/markdown-remark": "6.3.1", @@ -914,6 +914,7 @@ "patchedDependencies": { "solid-js@1.9.10": "patches/solid-js@1.9.10.patch", "virtua@0.49.1": "patches/virtua@0.49.1.patch", + "@modelcontextprotocol/sdk@1.29.0": "patches/@modelcontextprotocol%2Fsdk@1.29.0.patch", "gcp-metadata@8.1.2": "patches/gcp-metadata@8.1.2.patch", "@ai-sdk/google@3.0.73": "patches/@ai-sdk%2Fgoogle@3.0.73.patch", "@ai-sdk/xai@3.0.82": "patches/@ai-sdk%2Fxai@3.0.82.patch", diff --git a/nix/hashes.json b/nix/hashes.json index 0015eb44c3..876e798288 100644 --- a/nix/hashes.json +++ b/nix/hashes.json @@ -1,8 +1,8 @@ { "nodeModules": { - "x86_64-linux": "sha256-u3CBUflGrE1unVRTvvLKaDkvx5ZHXyRLd/SJOUUsRdc=", - "aarch64-linux": "sha256-hUu70IlOXXQ9apQe3IPOdQGf3ZSVCpvRuAWSKxipk/k=", - "aarch64-darwin": "sha256-N6Mqmo94q0rsskLcXoUGWCMJjQ9wCuuo0Lby3j6+Dps=", - "x86_64-darwin": "sha256-5691VKK2zWqAwe94CCjZuRjXEaswedevFtHxensVLfg=" + "x86_64-linux": "sha256-Y+8gz+NfFSb4dysjho4CCaQpx012vvajnptfd3cdh/k=", + "aarch64-linux": "sha256-dfkEJ57XvxCM4huM5Ij7tSy+JUPKYmBMZDGZKZ5xSXA=", + "aarch64-darwin": "sha256-CJ8dvzGzJp5sgaNJYHwxRc1xK9bWA8zyTmDFi4wTI3o=", + "x86_64-darwin": "sha256-7/kwFObujL4z4544Q0D2LN/SxT8sHnJyVrzmBXbJajA=" } } diff --git a/package.json b/package.json index cc3adc2701..c786a40a27 100644 --- a/package.json +++ b/package.json @@ -163,11 +163,12 @@ "gcp-metadata@8.1.2": "patches/gcp-metadata@8.1.2.patch", "pacote@21.5.0": "patches/pacote@21.5.0.patch", "@ai-sdk/google@3.0.73": "patches/@ai-sdk%2Fgoogle@3.0.73.patch", - "@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch", + "@modelcontextprotocol/sdk@1.29.0": "patches/@modelcontextprotocol%2Fsdk@1.29.0.patch", + "@ff-labs/fff-bun@0.9.4": "patches/@ff-labs%2Ffff-bun@0.9.4.patch", "@ai-sdk/xai@3.0.92": "patches/@ai-sdk%2Fxai@3.0.92.patch", "pacote@21.5.1": "patches/pacote@21.5.1.patch", "mammoth@1.12.0": "patches/mammoth@1.12.0.patch" }, - "version": "7.4.7", + "version": "7.4.11", "peerDependencies": {} } diff --git a/packages/core/migration/20260127222353_familiar_lady_ursula/migration.sql b/packages/core/migration/20260127222353_familiar_lady_ursula/migration.sql deleted file mode 100644 index 775c1a1173..0000000000 --- a/packages/core/migration/20260127222353_familiar_lady_ursula/migration.sql +++ /dev/null @@ -1,90 +0,0 @@ -CREATE TABLE `project` ( - `id` text PRIMARY KEY, - `worktree` text NOT NULL, - `vcs` text, - `name` text, - `icon_url` text, - `icon_color` text, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `time_initialized` integer, - `sandboxes` text NOT NULL -); ---> statement-breakpoint -CREATE TABLE `message` ( - `id` text PRIMARY KEY, - `session_id` text NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `data` text NOT NULL, - CONSTRAINT `fk_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE TABLE `part` ( - `id` text PRIMARY KEY, - `message_id` text NOT NULL, - `session_id` text NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `data` text NOT NULL, - CONSTRAINT `fk_part_message_id_message_id_fk` FOREIGN KEY (`message_id`) REFERENCES `message`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE TABLE `permission` ( - `project_id` text PRIMARY KEY, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `data` text NOT NULL, - CONSTRAINT `fk_permission_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE TABLE `session` ( - `id` text PRIMARY KEY, - `project_id` text NOT NULL, - `parent_id` text, - `slug` text NOT NULL, - `directory` text NOT NULL, - `title` text NOT NULL, - `version` text NOT NULL, - `share_url` text, - `summary_additions` integer, - `summary_deletions` integer, - `summary_files` integer, - `summary_diffs` text, - `revert` text, - `permission` text, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `time_compacting` integer, - `time_archived` integer, - CONSTRAINT `fk_session_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE TABLE `todo` ( - `session_id` text NOT NULL, - `content` text NOT NULL, - `status` text NOT NULL, - `priority` text NOT NULL, - `position` integer NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - CONSTRAINT `todo_pk` PRIMARY KEY(`session_id`, `position`), - CONSTRAINT `fk_todo_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE TABLE `session_share` ( - `session_id` text PRIMARY KEY, - `id` text NOT NULL, - `secret` text NOT NULL, - `url` text NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - CONSTRAINT `fk_session_share_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE INDEX `message_session_idx` ON `message` (`session_id`);--> statement-breakpoint -CREATE INDEX `part_message_idx` ON `part` (`message_id`);--> statement-breakpoint -CREATE INDEX `part_session_idx` ON `part` (`session_id`);--> statement-breakpoint -CREATE INDEX `session_project_idx` ON `session` (`project_id`);--> statement-breakpoint -CREATE INDEX `session_parent_idx` ON `session` (`parent_id`);--> statement-breakpoint -CREATE INDEX `todo_session_idx` ON `todo` (`session_id`); \ No newline at end of file diff --git a/packages/core/migration/20260127222353_familiar_lady_ursula/snapshot.json b/packages/core/migration/20260127222353_familiar_lady_ursula/snapshot.json deleted file mode 100644 index ff76ee209a..0000000000 --- a/packages/core/migration/20260127222353_familiar_lady_ursula/snapshot.json +++ /dev/null @@ -1,796 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "068758ed-a97a-46f6-8a59-6c639ae7c20c", - "prevIds": ["00000000-0000-0000-0000-000000000000"], - "ddl": [ - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260211171708_add_project_commands/migration.sql b/packages/core/migration/20260211171708_add_project_commands/migration.sql deleted file mode 100644 index b63f147a0b..0000000000 --- a/packages/core/migration/20260211171708_add_project_commands/migration.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `project` ADD `commands` text; \ No newline at end of file diff --git a/packages/core/migration/20260211171708_add_project_commands/snapshot.json b/packages/core/migration/20260211171708_add_project_commands/snapshot.json deleted file mode 100644 index 1182cc32de..0000000000 --- a/packages/core/migration/20260211171708_add_project_commands/snapshot.json +++ /dev/null @@ -1,806 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "8bc2d11d-97fa-4ba8-8bfa-6c5956c49aeb", - "prevIds": ["068758ed-a97a-46f6-8a59-6c639ae7c20c"], - "ddl": [ - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260213144116_wakeful_the_professor/migration.sql b/packages/core/migration/20260213144116_wakeful_the_professor/migration.sql deleted file mode 100644 index 3085fe280f..0000000000 --- a/packages/core/migration/20260213144116_wakeful_the_professor/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE `control_account` ( - `email` text NOT NULL, - `url` text NOT NULL, - `access_token` text NOT NULL, - `refresh_token` text NOT NULL, - `token_expiry` integer, - `active` integer NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - CONSTRAINT `control_account_pk` PRIMARY KEY(`email`, `url`) -); diff --git a/packages/core/migration/20260213144116_wakeful_the_professor/snapshot.json b/packages/core/migration/20260213144116_wakeful_the_professor/snapshot.json deleted file mode 100644 index 05c00a10cf..0000000000 --- a/packages/core/migration/20260213144116_wakeful_the_professor/snapshot.json +++ /dev/null @@ -1,897 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "d2736e43-700f-4e9e-8151-9f2f0d967bc8", - "prevIds": ["8bc2d11d-97fa-4ba8-8bfa-6c5956c49aeb"], - "ddl": [ - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260225215848_workspace/migration.sql b/packages/core/migration/20260225215848_workspace/migration.sql deleted file mode 100644 index 5b1b4e5a47..0000000000 --- a/packages/core/migration/20260225215848_workspace/migration.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `workspace` ( - `id` text PRIMARY KEY, - `branch` text, - `project_id` text NOT NULL, - `config` text NOT NULL, - CONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE -); diff --git a/packages/core/migration/20260225215848_workspace/snapshot.json b/packages/core/migration/20260225215848_workspace/snapshot.json deleted file mode 100644 index a75001d58f..0000000000 --- a/packages/core/migration/20260225215848_workspace/snapshot.json +++ /dev/null @@ -1,959 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "1f1dbf2d-bf66-4b25-8af4-4ba7633b7e40", - "prevIds": ["d2736e43-700f-4e9e-8151-9f2f0d967bc8"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "config", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260227213759_add_session_workspace_id/migration.sql b/packages/core/migration/20260227213759_add_session_workspace_id/migration.sql deleted file mode 100644 index f5488af218..0000000000 --- a/packages/core/migration/20260227213759_add_session_workspace_id/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `session` ADD `workspace_id` text;--> statement-breakpoint -CREATE INDEX `session_workspace_idx` ON `session` (`workspace_id`); \ No newline at end of file diff --git a/packages/core/migration/20260227213759_add_session_workspace_id/snapshot.json b/packages/core/migration/20260227213759_add_session_workspace_id/snapshot.json deleted file mode 100644 index 8cd94d0052..0000000000 --- a/packages/core/migration/20260227213759_add_session_workspace_id/snapshot.json +++ /dev/null @@ -1,983 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "572fb732-56f4-4b1e-b981-77152c9980dd", - "prevIds": ["1f1dbf2d-bf66-4b25-8af4-4ba7633b7e40"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "config", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260228203230_blue_harpoon/migration.sql b/packages/core/migration/20260228203230_blue_harpoon/migration.sql deleted file mode 100644 index 85be58c88d..0000000000 --- a/packages/core/migration/20260228203230_blue_harpoon/migration.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE `account` ( - `id` text PRIMARY KEY, - `email` text NOT NULL, - `url` text NOT NULL, - `access_token` text NOT NULL, - `refresh_token` text NOT NULL, - `token_expiry` integer, - `selected_org_id` text, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL -); ---> statement-breakpoint -CREATE TABLE `account_state` ( - `id` integer PRIMARY KEY NOT NULL, - `active_account_id` text, - FOREIGN KEY (`active_account_id`) REFERENCES `account`(`id`) ON UPDATE no action ON DELETE set null -); diff --git a/packages/core/migration/20260228203230_blue_harpoon/snapshot.json b/packages/core/migration/20260228203230_blue_harpoon/snapshot.json deleted file mode 100644 index 80d9451bae..0000000000 --- a/packages/core/migration/20260228203230_blue_harpoon/snapshot.json +++ /dev/null @@ -1,1102 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "325559b7-104f-4d2a-a02c-934cfad7cfcc", - "prevIds": ["1f1dbf2d-bf66-4b25-8af4-4ba7633b7e40"], - "ddl": [ - { - "name": "account", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "selected_org_id", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "config", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260303231226_add_workspace_fields/migration.sql b/packages/core/migration/20260303231226_add_workspace_fields/migration.sql deleted file mode 100644 index 185de59133..0000000000 --- a/packages/core/migration/20260303231226_add_workspace_fields/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE `workspace` ADD `type` text NOT NULL;--> statement-breakpoint -ALTER TABLE `workspace` ADD `name` text;--> statement-breakpoint -ALTER TABLE `workspace` ADD `directory` text;--> statement-breakpoint -ALTER TABLE `workspace` ADD `extra` text;--> statement-breakpoint -ALTER TABLE `workspace` DROP COLUMN `config`; \ No newline at end of file diff --git a/packages/core/migration/20260303231226_add_workspace_fields/snapshot.json b/packages/core/migration/20260303231226_add_workspace_fields/snapshot.json deleted file mode 100644 index 4fe320a2cc..0000000000 --- a/packages/core/migration/20260303231226_add_workspace_fields/snapshot.json +++ /dev/null @@ -1,1013 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "4ec9de62-88a7-4bec-91cc-0a759e84db21", - "prevIds": ["572fb732-56f4-4b1e-b981-77152c9980dd"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260309230000_move_org_to_state/migration.sql b/packages/core/migration/20260309230000_move_org_to_state/migration.sql deleted file mode 100644 index 4d1c7bccd0..0000000000 --- a/packages/core/migration/20260309230000_move_org_to_state/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE `account_state` ADD `active_org_id` text;--> statement-breakpoint -UPDATE `account_state` SET `active_org_id` = (SELECT `selected_org_id` FROM `account` WHERE `account`.`id` = `account_state`.`active_account_id`);--> statement-breakpoint -ALTER TABLE `account` DROP COLUMN `selected_org_id`; diff --git a/packages/core/migration/20260309230000_move_org_to_state/snapshot.json b/packages/core/migration/20260309230000_move_org_to_state/snapshot.json deleted file mode 100644 index 488ecefffb..0000000000 --- a/packages/core/migration/20260309230000_move_org_to_state/snapshot.json +++ /dev/null @@ -1,1156 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "fb311f30-9948-4131-b15c-7d308478a878", - "prevIds": ["325559b7-104f-4d2a-a02c-934cfad7cfcc", "4ec9de62-88a7-4bec-91cc-0a759e84db21"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260312043431_session_message_cursor/migration.sql b/packages/core/migration/20260312043431_session_message_cursor/migration.sql deleted file mode 100644 index e2bd08137c..0000000000 --- a/packages/core/migration/20260312043431_session_message_cursor/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP INDEX IF EXISTS `message_session_idx`;--> statement-breakpoint -DROP INDEX IF EXISTS `part_message_idx`;--> statement-breakpoint -CREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint -CREATE INDEX `part_message_id_id_idx` ON `part` (`message_id`,`id`); \ No newline at end of file diff --git a/packages/core/migration/20260312043431_session_message_cursor/snapshot.json b/packages/core/migration/20260312043431_session_message_cursor/snapshot.json deleted file mode 100644 index 48958804ab..0000000000 --- a/packages/core/migration/20260312043431_session_message_cursor/snapshot.json +++ /dev/null @@ -1,1168 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "37e1554d-af4c-43f2-aa7c-307fb49a315e", - "prevIds": ["fb311f30-9948-4131-b15c-7d308478a878"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260323234822_events/migration.sql b/packages/core/migration/20260323234822_events/migration.sql deleted file mode 100644 index b0fe7e4e6b..0000000000 --- a/packages/core/migration/20260323234822_events/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE `event_sequence` ( - `aggregate_id` text PRIMARY KEY, - `seq` integer NOT NULL -); ---> statement-breakpoint -CREATE TABLE `event` ( - `id` text PRIMARY KEY, - `aggregate_id` text NOT NULL, - `seq` integer NOT NULL, - `type` text NOT NULL, - `data` text NOT NULL, - CONSTRAINT `fk_event_aggregate_id_event_sequence_aggregate_id_fk` FOREIGN KEY (`aggregate_id`) REFERENCES `event_sequence`(`aggregate_id`) ON DELETE CASCADE -); diff --git a/packages/core/migration/20260323234822_events/snapshot.json b/packages/core/migration/20260323234822_events/snapshot.json deleted file mode 100644 index 07519aab71..0000000000 --- a/packages/core/migration/20260323234822_events/snapshot.json +++ /dev/null @@ -1,1271 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "f13dfa58-7fb4-47a2-8f6b-dc70258e14ed", - "prevIds": ["37e1554d-af4c-43f2-aa7c-307fb49a315e"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260410174513_workspace-name/migration.sql b/packages/core/migration/20260410174513_workspace-name/migration.sql deleted file mode 100644 index 2a27248e41..0000000000 --- a/packages/core/migration/20260410174513_workspace-name/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ -PRAGMA foreign_keys=OFF;--> statement-breakpoint -CREATE TABLE `__new_workspace` ( - `id` text PRIMARY KEY, - `type` text NOT NULL, - `name` text DEFAULT '' NOT NULL, - `branch` text, - `directory` text, - `extra` text, - `project_id` text NOT NULL, - CONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -INSERT INTO `__new_workspace`(`id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id`) SELECT `id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id` FROM `workspace`;--> statement-breakpoint -DROP TABLE `workspace`;--> statement-breakpoint -ALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint -PRAGMA foreign_keys=ON; \ No newline at end of file diff --git a/packages/core/migration/20260410174513_workspace-name/snapshot.json b/packages/core/migration/20260410174513_workspace-name/snapshot.json deleted file mode 100644 index 9adeeecbe8..0000000000 --- a/packages/core/migration/20260410174513_workspace-name/snapshot.json +++ /dev/null @@ -1,1271 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "b61476b8-3b92-49ae-9fa5-6eef586ed64b", - "prevIds": ["f13dfa58-7fb4-47a2-8f6b-dc70258e14ed"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260413175956_chief_energizer/migration.sql b/packages/core/migration/20260413175956_chief_energizer/migration.sql deleted file mode 100644 index e0c8589508..0000000000 --- a/packages/core/migration/20260413175956_chief_energizer/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE `session_entry` ( - `id` text PRIMARY KEY, - `session_id` text NOT NULL, - `type` text NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `data` text NOT NULL, - CONSTRAINT `fk_session_entry_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE INDEX `session_entry_session_idx` ON `session_entry` (`session_id`);--> statement-breakpoint -CREATE INDEX `session_entry_session_type_idx` ON `session_entry` (`session_id`,`type`);--> statement-breakpoint -CREATE INDEX `session_entry_time_created_idx` ON `session_entry` (`time_created`); \ No newline at end of file diff --git a/packages/core/migration/20260413175956_chief_energizer/snapshot.json b/packages/core/migration/20260413175956_chief_energizer/snapshot.json deleted file mode 100644 index ac54a30af2..0000000000 --- a/packages/core/migration/20260413175956_chief_energizer/snapshot.json +++ /dev/null @@ -1,1399 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "30b928c5-deef-472c-856d-b5b5064bf6d4", - "prevIds": ["b61476b8-3b92-49ae-9fa5-6eef586ed64b"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_entry", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_entry_session_id_session_id_fk", - "entityType": "fks", - "table": "session_entry" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_entry_pk", - "table": "session_entry", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_entry_session_idx", - "entityType": "indexes", - "table": "session_entry" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_entry_session_type_idx", - "entityType": "indexes", - "table": "session_entry" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_entry_time_created_idx", - "entityType": "indexes", - "table": "session_entry" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260423070820_add_icon_url_override/migration.sql b/packages/core/migration/20260423070820_add_icon_url_override/migration.sql deleted file mode 100644 index e28a1d4e98..0000000000 --- a/packages/core/migration/20260423070820_add_icon_url_override/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `project` ADD `icon_url_override` text; -UPDATE `project` SET `icon_url_override` = `icon_url` WHERE `icon_url` IS NOT NULL; diff --git a/packages/core/migration/20260423070820_add_icon_url_override/snapshot.json b/packages/core/migration/20260423070820_add_icon_url_override/snapshot.json deleted file mode 100644 index 06dae8e44b..0000000000 --- a/packages/core/migration/20260423070820_add_icon_url_override/snapshot.json +++ /dev/null @@ -1,1409 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "66cbe0d7-def0-451b-b88a-7608513a9b44", - "prevIds": ["30b928c5-deef-472c-856d-b5b5064bf6d4"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_entry", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_entry" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_entry_session_id_session_id_fk", - "entityType": "fks", - "table": "session_entry" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_entry_pk", - "table": "session_entry", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_entry_session_idx", - "entityType": "indexes", - "table": "session_entry" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_entry_session_type_idx", - "entityType": "indexes", - "table": "session_entry" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_entry_time_created_idx", - "entityType": "indexes", - "table": "session_entry" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260427172553_slow_nightmare/migration.sql b/packages/core/migration/20260427172553_slow_nightmare/migration.sql deleted file mode 100644 index d5efe5f9e8..0000000000 --- a/packages/core/migration/20260427172553_slow_nightmare/migration.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE `session_message` ( - `id` text PRIMARY KEY, - `session_id` text NOT NULL, - `type` text NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - `data` text NOT NULL, - CONSTRAINT `fk_session_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -DROP INDEX IF EXISTS `session_entry_session_idx`;--> statement-breakpoint -DROP INDEX IF EXISTS `session_entry_session_type_idx`;--> statement-breakpoint -DROP INDEX IF EXISTS `session_entry_time_created_idx`;--> statement-breakpoint -CREATE INDEX `session_message_session_idx` ON `session_message` (`session_id`);--> statement-breakpoint -CREATE INDEX `session_message_session_type_idx` ON `session_message` (`session_id`,`type`);--> statement-breakpoint -CREATE INDEX `session_message_time_created_idx` ON `session_message` (`time_created`);--> statement-breakpoint -DROP TABLE `session_entry`; \ No newline at end of file diff --git a/packages/core/migration/20260427172553_slow_nightmare/snapshot.json b/packages/core/migration/20260427172553_slow_nightmare/snapshot.json deleted file mode 100644 index a237b4156e..0000000000 --- a/packages/core/migration/20260427172553_slow_nightmare/snapshot.json +++ /dev/null @@ -1,1409 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "61f807f9-6398-4067-be05-804acc2561bc", - "prevIds": ["66cbe0d7-def0-451b-b88a-7608513a9b44"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260428004200_add_session_path/migration.sql b/packages/core/migration/20260428004200_add_session_path/migration.sql deleted file mode 100644 index e3ef6f9900..0000000000 --- a/packages/core/migration/20260428004200_add_session_path/migration.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `session` ADD `path` text; \ No newline at end of file diff --git a/packages/core/migration/20260428004200_add_session_path/snapshot.json b/packages/core/migration/20260428004200_add_session_path/snapshot.json deleted file mode 100644 index 740ba0e254..0000000000 --- a/packages/core/migration/20260428004200_add_session_path/snapshot.json +++ /dev/null @@ -1,1419 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "aaa2ebeb-caa4-478d-8365-4fc595d16856", - "prevIds": ["61f807f9-6398-4067-be05-804acc2561bc"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260501142318_next_venus/migration.sql b/packages/core/migration/20260501142318_next_venus/migration.sql deleted file mode 100644 index e0ffe7823c..0000000000 --- a/packages/core/migration/20260501142318_next_venus/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `session` ADD `agent` text;--> statement-breakpoint -ALTER TABLE `session` ADD `model` text; \ No newline at end of file diff --git a/packages/core/migration/20260501142318_next_venus/snapshot.json b/packages/core/migration/20260501142318_next_venus/snapshot.json deleted file mode 100644 index 1eb0cf0b07..0000000000 --- a/packages/core/migration/20260501142318_next_venus/snapshot.json +++ /dev/null @@ -1,1439 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "2ec89846-dcf1-4977-ab5e-244ddc9e3d67", - "prevIds": ["aaa2ebeb-caa4-478d-8365-4fc595d16856"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260504145000_add_sync_owner/migration.sql b/packages/core/migration/20260504145000_add_sync_owner/migration.sql deleted file mode 100644 index 3bdf2b85e9..0000000000 --- a/packages/core/migration/20260504145000_add_sync_owner/migration.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `event_sequence` ADD `owner_id` text; \ No newline at end of file diff --git a/packages/core/migration/20260504145000_add_sync_owner/snapshot.json b/packages/core/migration/20260504145000_add_sync_owner/snapshot.json deleted file mode 100644 index 7a0d10337d..0000000000 --- a/packages/core/migration/20260504145000_add_sync_owner/snapshot.json +++ /dev/null @@ -1,1449 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "27114226-085b-421a-9a40-29b88747e29a", - "prevIds": ["2ec89846-dcf1-4977-ab5e-244ddc9e3d67"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260507164347_add_workspace_time/migration.sql b/packages/core/migration/20260507164347_add_workspace_time/migration.sql deleted file mode 100644 index c865526a88..0000000000 --- a/packages/core/migration/20260507164347_add_workspace_time/migration.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `workspace` ADD `time_used` integer NOT NULL DEFAULT 0; diff --git a/packages/core/migration/20260507164347_add_workspace_time/snapshot.json b/packages/core/migration/20260507164347_add_workspace_time/snapshot.json deleted file mode 100644 index 57da763bb9..0000000000 --- a/packages/core/migration/20260507164347_add_workspace_time/snapshot.json +++ /dev/null @@ -1,1459 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "630a93f2-c6c6-4191-a351-868d8f3a05d4", - "prevIds": ["27114226-085b-421a-9a40-29b88747e29a"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260510033149_session_usage/migration.sql b/packages/core/migration/20260510033149_session_usage/migration.sql deleted file mode 100644 index 68e12aad09..0000000000 --- a/packages/core/migration/20260510033149_session_usage/migration.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE `session` ADD `cost` real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE `session` ADD `tokens_input` integer DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE `session` ADD `tokens_output` integer DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE `session` ADD `tokens_reasoning` integer DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE `session` ADD `tokens_cache_read` integer DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE `session` ADD `tokens_cache_write` integer DEFAULT 0 NOT NULL; diff --git a/packages/core/migration/20260510033149_session_usage/snapshot.json b/packages/core/migration/20260510033149_session_usage/snapshot.json deleted file mode 100644 index ce5e56f48c..0000000000 --- a/packages/core/migration/20260510033149_session_usage/snapshot.json +++ /dev/null @@ -1,1519 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "be5eae31-b7f8-4292-8827-c36a524abd1b", - "prevIds": ["630a93f2-c6c6-4191-a351-868d8f3a05d4"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260511000411_data_migration_state/migration.sql b/packages/core/migration/20260511000411_data_migration_state/migration.sql deleted file mode 100644 index ba36a7f078..0000000000 --- a/packages/core/migration/20260511000411_data_migration_state/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE `data_migration` ( - `name` text PRIMARY KEY, - `time_completed` integer NOT NULL -); diff --git a/packages/core/migration/20260511000411_data_migration_state/snapshot.json b/packages/core/migration/20260511000411_data_migration_state/snapshot.json deleted file mode 100644 index e84aa1a6a1..0000000000 --- a/packages/core/migration/20260511000411_data_migration_state/snapshot.json +++ /dev/null @@ -1,1490 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "fdfcccee-fb3a-481f-b801-b9835fa30d5d", - "prevIds": ["630a93f2-c6c6-4191-a351-868d8f3a05d4"], - "ddl": [ - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260511173437_session-metadata/migration.sql b/packages/core/migration/20260511173437_session-metadata/migration.sql deleted file mode 100644 index 1f8fcaf64a..0000000000 --- a/packages/core/migration/20260511173437_session-metadata/migration.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `session` ADD `metadata` text; diff --git a/packages/core/migration/20260511173437_session-metadata/snapshot.json b/packages/core/migration/20260511173437_session-metadata/snapshot.json deleted file mode 100644 index 8c979997ca..0000000000 --- a/packages/core/migration/20260511173437_session-metadata/snapshot.json +++ /dev/null @@ -1,1560 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "bf93c73b-5a48-4d63-9909-3c36a79b9788", - "prevIds": ["be5eae31-b7f8-4292-8827-c36a524abd1b", "fdfcccee-fb3a-481f-b801-b9835fa30d5d"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260601010001_normalize_storage_paths/migration.sql b/packages/core/migration/20260601010001_normalize_storage_paths/migration.sql deleted file mode 100644 index 7eede8fa2f..0000000000 --- a/packages/core/migration/20260601010001_normalize_storage_paths/migration.sql +++ /dev/null @@ -1,7 +0,0 @@ -UPDATE project SET worktree = REPLACE(worktree, char(92), '/') WHERE worktree GLOB '[A-Za-z]:' || char(92) || '*' OR worktree LIKE char(92) || char(92) || '%'; ---> statement-breakpoint -UPDATE project SET sandboxes = REPLACE(sandboxes, char(92) || char(92), '/') WHERE instr(sandboxes, char(92)) > 0 AND (worktree GLOB '[A-Za-z]:*' OR worktree LIKE '//%'); ---> statement-breakpoint -UPDATE session SET directory = REPLACE(directory, char(92), '/') WHERE directory GLOB '[A-Za-z]:' || char(92) || '*' OR directory LIKE char(92) || char(92) || '%'; ---> statement-breakpoint -UPDATE session SET path = REPLACE(path, char(92), '/') WHERE path IS NOT NULL AND instr(path, char(92)) > 0 AND (directory GLOB '[A-Za-z]:*' OR directory LIKE '//%'); diff --git a/packages/core/migration/20260601010001_normalize_storage_paths/snapshot.json b/packages/core/migration/20260601010001_normalize_storage_paths/snapshot.json deleted file mode 100644 index 0f0faf7eee..0000000000 --- a/packages/core/migration/20260601010001_normalize_storage_paths/snapshot.json +++ /dev/null @@ -1,1560 +0,0 @@ -{ - "id": "7f4866d3-a95b-4141-bb59-28e31c521605", - "prevIds": ["bf93c73b-5a48-4d63-9909-3c36a79b9788"], - "version": "7", - "dialect": "sqlite", - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["project_id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260601202201_amazing_prowler/migration.sql b/packages/core/migration/20260601202201_amazing_prowler/migration.sql deleted file mode 100644 index 92405490f6..0000000000 --- a/packages/core/migration/20260601202201_amazing_prowler/migration.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE `permission`; \ No newline at end of file diff --git a/packages/core/migration/20260601202201_amazing_prowler/snapshot.json b/packages/core/migration/20260601202201_amazing_prowler/snapshot.json deleted file mode 100644 index b506b5009d..0000000000 --- a/packages/core/migration/20260601202201_amazing_prowler/snapshot.json +++ /dev/null @@ -1,1498 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "226375f1-a19f-4c7b-8aa2-ccc5513d3b0d", - "prevIds": ["bf93c73b-5a48-4d63-9909-3c36a79b9788"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260602002951_lowly_union_jack/migration.sql b/packages/core/migration/20260602002951_lowly_union_jack/migration.sql deleted file mode 100644 index aea79762f3..0000000000 --- a/packages/core/migration/20260602002951_lowly_union_jack/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE `permission` ( - `id` text PRIMARY KEY, - `project_id` text NOT NULL, - `action` text NOT NULL, - `resource` text NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL, - CONSTRAINT `fk_permission_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE UNIQUE INDEX `permission_project_action_resource_idx` ON `permission` (`project_id`,`action`,`resource`); \ No newline at end of file diff --git a/packages/core/migration/20260602002951_lowly_union_jack/snapshot.json b/packages/core/migration/20260602002951_lowly_union_jack/snapshot.json deleted file mode 100644 index ca0be6da3e..0000000000 --- a/packages/core/migration/20260602002951_lowly_union_jack/snapshot.json +++ /dev/null @@ -1,1602 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "80d6efb8-93fd-4ce5-b320-45a05aaebdd7", - "prevIds": ["226375f1-a19f-4c7b-8aa2-ccc5513d3b0d"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260602182828_add_project_directories/migration.sql b/packages/core/migration/20260602182828_add_project_directories/migration.sql deleted file mode 100644 index 0ab297096a..0000000000 --- a/packages/core/migration/20260602182828_add_project_directories/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `project_directory` ( - `project_id` text NOT NULL, - `directory` text NOT NULL, - `type` text NOT NULL, - `time_created` integer NOT NULL, - CONSTRAINT `project_directory_pk` PRIMARY KEY(`project_id`, `directory`), - CONSTRAINT `fk_project_directory_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE -); diff --git a/packages/core/migration/20260602182828_add_project_directories/snapshot.json b/packages/core/migration/20260602182828_add_project_directories/snapshot.json deleted file mode 100644 index c96598c2ac..0000000000 --- a/packages/core/migration/20260602182828_add_project_directories/snapshot.json +++ /dev/null @@ -1,1664 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "80f2378a-ed35-45cb-9d3b-9f4837fac801", - "prevIds": ["7f4866d3-a95b-4141-bb59-28e31c521605", "80d6efb8-93fd-4ce5-b320-45a05aaebdd7"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project_directory", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_project_directory_project_id_project_id_fk", - "entityType": "fks", - "table": "project_directory" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["project_id", "directory"], - "nameExplicit": false, - "name": "project_directory_pk", - "entityType": "pks", - "table": "project_directory" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260603001617_session_message_projection_indexes/migration.sql b/packages/core/migration/20260603001617_session_message_projection_indexes/migration.sql deleted file mode 100644 index ed6b728a1f..0000000000 --- a/packages/core/migration/20260603001617_session_message_projection_indexes/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ -DROP INDEX IF EXISTS `session_message_session_idx`;--> statement-breakpoint -DROP INDEX IF EXISTS `session_message_session_type_idx`;--> statement-breakpoint -CREATE INDEX `event_aggregate_seq_idx` ON `event` (`aggregate_id`,`seq`);--> statement-breakpoint -CREATE INDEX `session_message_session_time_created_id_idx` ON `session_message` (`session_id`,`time_created`,`id`);--> statement-breakpoint -CREATE INDEX `session_message_session_type_time_created_id_idx` ON `session_message` (`session_id`,`type`,`time_created`,`id`); \ No newline at end of file diff --git a/packages/core/migration/20260603001617_session_message_projection_indexes/snapshot.json b/packages/core/migration/20260603001617_session_message_projection_indexes/snapshot.json deleted file mode 100644 index e89ee64555..0000000000 --- a/packages/core/migration/20260603001617_session_message_projection_indexes/snapshot.json +++ /dev/null @@ -1,1636 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "6a0e33d0-4866-402f-b287-de400200b05e", - "prevIds": ["80f2378a-ed35-45cb-9d3b-9f4837fac801"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_time_created_id_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_time_created_id_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260603040000_session_message_projection_order/migration.sql b/packages/core/migration/20260603040000_session_message_projection_order/migration.sql deleted file mode 100644 index dbec67f277..0000000000 --- a/packages/core/migration/20260603040000_session_message_projection_order/migration.sql +++ /dev/null @@ -1,6 +0,0 @@ -DELETE FROM `session_message`;--> statement-breakpoint -ALTER TABLE `session_message` ADD `seq` integer NOT NULL;--> statement-breakpoint -DROP INDEX IF EXISTS `session_message_session_time_created_id_idx`;--> statement-breakpoint -DROP INDEX IF EXISTS `session_message_session_type_time_created_id_idx`;--> statement-breakpoint -CREATE INDEX `session_message_session_seq_idx` ON `session_message` (`session_id`,`seq`);--> statement-breakpoint -CREATE INDEX `session_message_session_type_seq_idx` ON `session_message` (`session_id`,`type`,`seq`); diff --git a/packages/core/migration/20260603040000_session_message_projection_order/snapshot.json b/packages/core/migration/20260603040000_session_message_projection_order/snapshot.json deleted file mode 100644 index 35aac3f7b8..0000000000 --- a/packages/core/migration/20260603040000_session_message_projection_order/snapshot.json +++ /dev/null @@ -1,1638 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "127d5585-9d6d-4b89-b126-15a36980392c", - "prevIds": ["6a0e33d0-4866-402f-b287-de400200b05e"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260603141458_session_input_inbox/migration.sql b/packages/core/migration/20260603141458_session_input_inbox/migration.sql deleted file mode 100644 index c721ba897d..0000000000 --- a/packages/core/migration/20260603141458_session_input_inbox/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE `session_input` ( - `seq` integer PRIMARY KEY AUTOINCREMENT, - `id` text NOT NULL UNIQUE, - `session_id` text NOT NULL, - `prompt` text NOT NULL, - `delivery` text NOT NULL, - `promoted_seq` integer, - `time_created` integer NOT NULL, - CONSTRAINT `fk_session_input_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -CREATE INDEX `session_input_session_pending_seq_idx` ON `session_input` (`session_id`,`promoted_seq`,`seq`); \ No newline at end of file diff --git a/packages/core/migration/20260603141458_session_input_inbox/snapshot.json b/packages/core/migration/20260603141458_session_input_inbox/snapshot.json deleted file mode 100644 index 7e51b1dfcf..0000000000 --- a/packages/core/migration/20260603141458_session_input_inbox/snapshot.json +++ /dev/null @@ -1,1759 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "442462d9-4f4f-409f-ab00-0f8fb585f1a4", - "prevIds": ["127d5585-9d6d-4b89-b126-15a36980392c"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_input", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": true, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "prompt", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "delivery", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "promoted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_input_session_id_session_id_fk", - "entityType": "fks", - "table": "session_input" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["seq"], - "nameExplicit": false, - "name": "session_input_pk", - "table": "session_input", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_input_session_pending_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_input_id_unique", - "entityType": "uniques", - "table": "session_input" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260603160727_jittery_ezekiel_stane/migration.sql b/packages/core/migration/20260603160727_jittery_ezekiel_stane/migration.sql deleted file mode 100644 index 9a6909a48b..0000000000 --- a/packages/core/migration/20260603160727_jittery_ezekiel_stane/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP INDEX IF EXISTS `session_input_session_pending_seq_idx`;--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `event_aggregate_type_seq_idx` ON `event` (`aggregate_id`,`type`,`seq`);--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `session_input_session_pending_delivery_seq_idx` ON `session_input` (`session_id`,`promoted_seq`,`delivery`,`seq`);--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `session_message_session_time_created_id_idx` ON `session_message` (`session_id`,`time_created`,`id`); diff --git a/packages/core/migration/20260603160727_jittery_ezekiel_stane/snapshot.json b/packages/core/migration/20260603160727_jittery_ezekiel_stane/snapshot.json deleted file mode 100644 index a2ec834e77..0000000000 --- a/packages/core/migration/20260603160727_jittery_ezekiel_stane/snapshot.json +++ /dev/null @@ -1,1869 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "fc92fa34-8074-44c3-88f0-a5417f7fd92d", - "prevIds": ["442462d9-4f4f-409f-ab00-0f8fb585f1a4"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project_directory", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_input", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": true, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "prompt", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "delivery", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "promoted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_project_directory_project_id_project_id_fk", - "entityType": "fks", - "table": "project_directory" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_input_session_id_session_id_fk", - "entityType": "fks", - "table": "session_input" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["project_id", "directory"], - "nameExplicit": false, - "name": "project_directory_pk", - "entityType": "pks", - "table": "project_directory" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["seq"], - "nameExplicit": false, - "name": "session_input_pk", - "table": "session_input", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_type_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - }, - { - "value": "delivery", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_input_session_pending_delivery_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_time_created_id_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_input_id_unique", - "entityType": "uniques", - "table": "session_input" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260604172448_event_sourced_session_input/migration.sql b/packages/core/migration/20260604172448_event_sourced_session_input/migration.sql deleted file mode 100644 index 0c89cc8036..0000000000 --- a/packages/core/migration/20260604172448_event_sourced_session_input/migration.sql +++ /dev/null @@ -1,28 +0,0 @@ -DELETE FROM `session_input`;--> statement-breakpoint -DELETE FROM `session_message`;--> statement-breakpoint -DELETE FROM `event`;--> statement-breakpoint -DELETE FROM `event_sequence`;--> statement-breakpoint -UPDATE `session` SET `workspace_id` = NULL;--> statement-breakpoint -DELETE FROM `workspace`;--> statement-breakpoint -DROP INDEX IF EXISTS `event_aggregate_seq_idx`;--> statement-breakpoint -CREATE UNIQUE INDEX `event_aggregate_seq_idx` ON `event` (`aggregate_id`,`seq`);--> statement-breakpoint -DROP INDEX IF EXISTS `session_message_session_seq_idx`;--> statement-breakpoint -CREATE UNIQUE INDEX `session_message_session_seq_idx` ON `session_message` (`session_id`,`seq`);--> statement-breakpoint -PRAGMA foreign_keys=OFF;--> statement-breakpoint -CREATE TABLE `__new_session_input` ( - `id` text PRIMARY KEY, - `session_id` text NOT NULL, - `prompt` text NOT NULL, - `delivery` text NOT NULL, - `admitted_seq` integer NOT NULL, - `promoted_seq` integer, - `time_created` integer NOT NULL, - CONSTRAINT `fk_session_input_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); ---> statement-breakpoint -DROP TABLE `session_input`;--> statement-breakpoint -ALTER TABLE `__new_session_input` RENAME TO `session_input`;--> statement-breakpoint -PRAGMA foreign_keys=ON;--> statement-breakpoint -CREATE INDEX `session_input_session_pending_delivery_seq_idx` ON `session_input` (`session_id`,`promoted_seq`,`delivery`,`admitted_seq`);--> statement-breakpoint -CREATE UNIQUE INDEX `session_input_session_admitted_seq_idx` ON `session_input` (`session_id`,`admitted_seq`);--> statement-breakpoint -CREATE UNIQUE INDEX `session_input_session_promoted_seq_idx` ON `session_input` (`session_id`,`promoted_seq`); diff --git a/packages/core/migration/20260604172448_event_sourced_session_input/snapshot.json b/packages/core/migration/20260604172448_event_sourced_session_input/snapshot.json deleted file mode 100644 index 4e916637ba..0000000000 --- a/packages/core/migration/20260604172448_event_sourced_session_input/snapshot.json +++ /dev/null @@ -1,1898 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "84c6ad6c-6116-48e1-b973-6fee4593496b", - "prevIds": ["fc92fa34-8074-44c3-88f0-a5417f7fd92d"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project_directory", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_input", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "prompt", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "delivery", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "admitted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "promoted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_project_directory_project_id_project_id_fk", - "entityType": "fks", - "table": "project_directory" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_input_session_id_session_id_fk", - "entityType": "fks", - "table": "session_input" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["project_id", "directory"], - "nameExplicit": false, - "name": "project_directory_pk", - "entityType": "pks", - "table": "project_directory" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_input_pk", - "table": "session_input", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_type_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - }, - { - "value": "delivery", - "isExpression": false - }, - { - "value": "admitted_seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_input_session_pending_delivery_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "admitted_seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_input_session_admitted_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_input_session_promoted_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_message_session_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_time_created_id_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260605003541_add_session_context_snapshot/migration.sql b/packages/core/migration/20260605003541_add_session_context_snapshot/migration.sql deleted file mode 100644 index ec98751154..0000000000 --- a/packages/core/migration/20260605003541_add_session_context_snapshot/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE `session_context_epoch` ( - `session_id` text PRIMARY KEY, - `baseline` text NOT NULL, - `snapshot` text NOT NULL, - `baseline_seq` integer NOT NULL, - `replacement_seq` integer, - `revision` integer DEFAULT 0 NOT NULL, - CONSTRAINT `fk_session_context_epoch_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE -); diff --git a/packages/core/migration/20260605003541_add_session_context_snapshot/snapshot.json b/packages/core/migration/20260605003541_add_session_context_snapshot/snapshot.json deleted file mode 100644 index 6e1cce1361..0000000000 --- a/packages/core/migration/20260605003541_add_session_context_snapshot/snapshot.json +++ /dev/null @@ -1,1980 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "40f7b9b8-83b4-4ea0-a59f-76a489679d88", - "prevIds": ["84c6ad6c-6116-48e1-b973-6fee4593496b"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project_directory", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_context_epoch", - "entityType": "tables" - }, - { - "name": "session_input", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "baseline", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "snapshot", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "baseline_seq", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "replacement_seq", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "revision", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "prompt", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "delivery", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "admitted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "promoted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_project_directory_project_id_project_id_fk", - "entityType": "fks", - "table": "project_directory" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_context_epoch_session_id_session_id_fk", - "entityType": "fks", - "table": "session_context_epoch" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_input_session_id_session_id_fk", - "entityType": "fks", - "table": "session_input" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["project_id", "directory"], - "nameExplicit": false, - "name": "project_directory_pk", - "entityType": "pks", - "table": "project_directory" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_context_epoch_pk", - "table": "session_context_epoch", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_input_pk", - "table": "session_input", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_type_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - }, - { - "value": "delivery", - "isExpression": false - }, - { - "value": "admitted_seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_input_session_pending_delivery_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "admitted_seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_input_session_admitted_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_input_session_promoted_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_message_session_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_time_created_id_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260605042240_add_context_epoch_agent/migration.sql b/packages/core/migration/20260605042240_add_context_epoch_agent/migration.sql deleted file mode 100644 index a9534b9b08..0000000000 --- a/packages/core/migration/20260605042240_add_context_epoch_agent/migration.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `session_context_epoch` ADD `agent` text DEFAULT 'build' NOT NULL; \ No newline at end of file diff --git a/packages/core/migration/20260605042240_add_context_epoch_agent/snapshot.json b/packages/core/migration/20260605042240_add_context_epoch_agent/snapshot.json deleted file mode 100644 index 6b893feb30..0000000000 --- a/packages/core/migration/20260605042240_add_context_epoch_agent/snapshot.json +++ /dev/null @@ -1,1990 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "d1bfa125-b81e-4c61-9b6e-e74abf6e488f", - "prevIds": ["40f7b9b8-83b4-4ea0-a59f-76a489679d88"], - "ddl": [ - { - "name": "workspace", - "entityType": "tables" - }, - { - "name": "data_migration", - "entityType": "tables" - }, - { - "name": "account_state", - "entityType": "tables" - }, - { - "name": "account", - "entityType": "tables" - }, - { - "name": "control_account", - "entityType": "tables" - }, - { - "name": "event_sequence", - "entityType": "tables" - }, - { - "name": "event", - "entityType": "tables" - }, - { - "name": "permission", - "entityType": "tables" - }, - { - "name": "project_directory", - "entityType": "tables" - }, - { - "name": "project", - "entityType": "tables" - }, - { - "name": "message", - "entityType": "tables" - }, - { - "name": "part", - "entityType": "tables" - }, - { - "name": "session_context_epoch", - "entityType": "tables" - }, - { - "name": "session_input", - "entityType": "tables" - }, - { - "name": "session_message", - "entityType": "tables" - }, - { - "name": "session", - "entityType": "tables" - }, - { - "name": "todo", - "entityType": "tables" - }, - { - "name": "session_share", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "''", - "generated": null, - "name": "name", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "branch", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "extra", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_used", - "entityType": "columns", - "table": "workspace" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_completed", - "entityType": "columns", - "table": "data_migration" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_account_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_org_id", - "entityType": "columns", - "table": "account_state" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token_expiry", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "control_account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "owner_id", - "entityType": "columns", - "table": "event_sequence" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "aggregate_id", - "entityType": "columns", - "table": "event" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "event" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "action", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "resource", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "permission" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "permission" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project_directory" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "worktree", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "vcs", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_url_override", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "icon_color", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "project" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_initialized", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "sandboxes", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "commands", - "entityType": "columns", - "table": "project" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "message_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "part" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "part" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "baseline", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'build'", - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "snapshot", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "baseline_seq", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "replacement_seq", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "revision", - "entityType": "columns", - "table": "session_context_epoch" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "prompt", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "delivery", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "admitted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "promoted_seq", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_input" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "seq", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "data", - "entityType": "columns", - "table": "session_message" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "project_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "workspace_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "parent_id", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "directory", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "path", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "title", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "version", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "share_url", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_additions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_deletions", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_files", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "summary_diffs", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "session" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "cost", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_input", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_output", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_reasoning", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_read", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "tokens_cache_write", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "revert", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "permission", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "agent", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "model", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_compacting", - "entityType": "columns", - "table": "session" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_archived", - "entityType": "columns", - "table": "session" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "content", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "status", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "priority", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "position", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "todo" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "todo" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "session_id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "url", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_created", - "entityType": "columns", - "table": "session_share" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "time_updated", - "entityType": "columns", - "table": "session_share" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_workspace_project_id_project_id_fk", - "entityType": "fks", - "table": "workspace" - }, - { - "columns": ["active_account_id"], - "tableTo": "account", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "SET NULL", - "nameExplicit": false, - "name": "fk_account_state_active_account_id_account_id_fk", - "entityType": "fks", - "table": "account_state" - }, - { - "columns": ["aggregate_id"], - "tableTo": "event_sequence", - "columnsTo": ["aggregate_id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_event_aggregate_id_event_sequence_aggregate_id_fk", - "entityType": "fks", - "table": "event" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_permission_project_id_project_id_fk", - "entityType": "fks", - "table": "permission" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_project_directory_project_id_project_id_fk", - "entityType": "fks", - "table": "project_directory" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_message_session_id_session_id_fk", - "entityType": "fks", - "table": "message" - }, - { - "columns": ["message_id"], - "tableTo": "message", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_part_message_id_message_id_fk", - "entityType": "fks", - "table": "part" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_context_epoch_session_id_session_id_fk", - "entityType": "fks", - "table": "session_context_epoch" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_input_session_id_session_id_fk", - "entityType": "fks", - "table": "session_input" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_message_session_id_session_id_fk", - "entityType": "fks", - "table": "session_message" - }, - { - "columns": ["project_id"], - "tableTo": "project", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_project_id_project_id_fk", - "entityType": "fks", - "table": "session" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_todo_session_id_session_id_fk", - "entityType": "fks", - "table": "todo" - }, - { - "columns": ["session_id"], - "tableTo": "session", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_session_share_session_id_session_id_fk", - "entityType": "fks", - "table": "session_share" - }, - { - "columns": ["email", "url"], - "nameExplicit": false, - "name": "control_account_pk", - "entityType": "pks", - "table": "control_account" - }, - { - "columns": ["project_id", "directory"], - "nameExplicit": false, - "name": "project_directory_pk", - "entityType": "pks", - "table": "project_directory" - }, - { - "columns": ["session_id", "position"], - "nameExplicit": false, - "name": "todo_pk", - "entityType": "pks", - "table": "todo" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "workspace_pk", - "table": "workspace", - "entityType": "pks" - }, - { - "columns": ["name"], - "nameExplicit": false, - "name": "data_migration_pk", - "table": "data_migration", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_state_pk", - "table": "account_state", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["aggregate_id"], - "nameExplicit": false, - "name": "event_sequence_pk", - "table": "event_sequence", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "event_pk", - "table": "event", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "permission_pk", - "table": "permission", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "project_pk", - "table": "project", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "message_pk", - "table": "message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "part_pk", - "table": "part", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_context_epoch_pk", - "table": "session_context_epoch", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_input_pk", - "table": "session_input", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_message_pk", - "table": "session_message", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "session_pk", - "table": "session", - "entityType": "pks" - }, - { - "columns": ["session_id"], - "nameExplicit": false, - "name": "session_share_pk", - "table": "session_share", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "event_aggregate_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "aggregate_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "event_aggregate_type_seq_idx", - "entityType": "indexes", - "table": "event" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - }, - { - "value": "action", - "isExpression": false - }, - { - "value": "resource", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "permission_project_action_resource_idx", - "entityType": "indexes", - "table": "permission" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "message_session_time_created_id_idx", - "entityType": "indexes", - "table": "message" - }, - { - "columns": [ - { - "value": "message_id", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_message_id_id_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "part_session_idx", - "entityType": "indexes", - "table": "part" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - }, - { - "value": "delivery", - "isExpression": false - }, - { - "value": "admitted_seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_input_session_pending_delivery_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "admitted_seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_input_session_admitted_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "promoted_seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_input_session_promoted_seq_idx", - "entityType": "indexes", - "table": "session_input" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "session_message_session_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "type", - "isExpression": false - }, - { - "value": "seq", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_type_seq_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - }, - { - "value": "time_created", - "isExpression": false - }, - { - "value": "id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_session_time_created_id_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "time_created", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_message_time_created_idx", - "entityType": "indexes", - "table": "session_message" - }, - { - "columns": [ - { - "value": "project_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_project_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "workspace_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_workspace_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "parent_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "session_parent_idx", - "entityType": "indexes", - "table": "session" - }, - { - "columns": [ - { - "value": "session_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "todo_session_idx", - "entityType": "indexes", - "table": "todo" - } - ], - "renames": [] -} diff --git a/packages/core/migration/20260611035744_credential/migration.sql b/packages/core/migration/20260611035744_credential/migration.sql deleted file mode 100644 index c950306e46..0000000000 --- a/packages/core/migration/20260611035744_credential/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE `credential` ( - `id` text PRIMARY KEY, - `connector_id` text NOT NULL, - `method_id` text NOT NULL, - `label` text NOT NULL, - `value` text NOT NULL, - `active` integer DEFAULT false NOT NULL, - `time_created` integer NOT NULL, - `time_updated` integer NOT NULL -); ---> statement-breakpoint -CREATE UNIQUE INDEX `credential_connector_active_idx` ON `credential` (`connector_id`) WHERE "credential"."active" = 1; diff --git a/packages/core/package.json b/packages/core/package.json index 92113caaa0..d56b01c466 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "7.4.7", + "version": "7.4.11", "name": "@opencode-ai/core", "type": "module", "license": "MIT", diff --git a/packages/core/migration/20260611035744_credential/snapshot.json b/packages/core/schema.json similarity index 98% rename from packages/core/migration/20260611035744_credential/snapshot.json rename to packages/core/schema.json index 6a18732d95..c041a4e011 100644 --- a/packages/core/migration/20260611035744_credential/snapshot.json +++ b/packages/core/schema.json @@ -1,8 +1,8 @@ { "version": "7", "dialect": "sqlite", - "id": "f25f9126-c7dc-4882-9ff4-af27e11d2da1", - "prevIds": ["d1bfa125-b81e-4c61-9b6e-e74abf6e488f"], + "id": "169a0f0f-d58f-479f-b024-fa1c7b9a09db", + "prevIds": ["abd2f920-b822-49af-b8a7-2e48367d424f"], "ddl": [ { "name": "workspace", @@ -382,21 +382,11 @@ }, { "type": "text", - "notNull": true, + "notNull": false, "autoincrement": false, "default": null, "generated": null, - "name": "connector_id", - "entityType": "columns", - "table": "credential" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "method_id", + "name": "integration_id", "entityType": "columns", "table": "credential" }, @@ -421,10 +411,30 @@ "table": "credential" }, { - "type": "integer", - "notNull": true, + "type": "text", + "notNull": false, "autoincrement": false, - "default": "false", + "default": null, + "generated": null, + "name": "connector_id", + "entityType": "columns", + "table": "credential" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "method_id", + "entityType": "columns", + "table": "credential" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, "generated": null, "name": "active", "entityType": "columns", @@ -612,7 +622,7 @@ }, { "type": "text", - "notNull": true, + "notNull": false, "autoincrement": false, "default": null, "generated": null, @@ -620,6 +630,16 @@ "entityType": "columns", "table": "project_directory" }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "strategy", + "entityType": "columns", + "table": "project_directory" + }, { "type": "integer", "notNull": true, @@ -1766,20 +1786,6 @@ "table": "session_share", "entityType": "pks" }, - { - "columns": [ - { - "value": "connector_id", - "isExpression": false - } - ], - "isUnique": true, - "where": "\"credential\".\"active\" = 1", - "origin": "manual", - "name": "credential_connector_active_idx", - "entityType": "indexes", - "table": "credential" - }, { "columns": [ { diff --git a/packages/core/script/migration.ts b/packages/core/script/migration.ts index d8d0f65e89..48b555b593 100644 --- a/packages/core/script/migration.ts +++ b/packages/core/script/migration.ts @@ -8,9 +8,10 @@ import { pathToFileURL } from "url" import { parseArgs } from "util" const root = path.resolve(import.meta.dirname, "../../..") -const sqlDir = path.join(root, "packages/core/migration") +const snapshot = path.join(root, "packages/core/schema.json") const tsDir = path.join(root, "packages/core/src/database/migration") const registry = path.join(root, "packages/core/src/database/migration.gen.ts") +const schema = path.join(root, "packages/core/src/database/schema.gen.ts") const args = parseArgs({ args: process.argv.slice(2), options: { @@ -24,57 +25,62 @@ if (args.values.check) { process.exit(0) } -await $`bun drizzle-kit generate ${args.values.name ? ["--name", args.values.name] : []}`.cwd( - path.join(root, "packages/core"), -) +await generate() -const sqlMigrations = (await Array.fromAsync(new Bun.Glob("*/migration.sql").scan({ cwd: sqlDir }))) - .map((file) => file.split("/")[0]) - .filter((name) => name !== undefined) - .sort() +async function generate() { + const temporary = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-core-migration-")) + const incremental = path.join(temporary, "incremental") + const full = path.join(temporary, "full") + try { + await fs.mkdir(incremental) + await fs.mkdir(path.join(incremental, "baseline")) + await fs.copyFile(snapshot, path.join(incremental, "baseline/snapshot.json")) + await drizzle(temporary, incremental, args.values.name) -for (const name of sqlMigrations) { - if (await Bun.file(path.join(tsDir, `${name}.ts`)).exists()) continue - await Bun.write( - path.join(tsDir, `${name}.ts`), - renderMigration(name, await Bun.file(path.join(sqlDir, name, "migration.sql")).text()), - ) + const generated = await generatedMigrations(incremental) + if (generated.length > 1) throw new Error(`Expected one generated migration, found ${generated.length}.`) + const name = generated[0] + if (name) { + const target = path.join(tsDir, `${name}.ts`) + if (await Bun.file(target).exists()) throw new Error(`Database migration already exists: ${name}`) + await Bun.write( + target, + renderMigration(name, await Bun.file(path.join(incremental, name, "migration.sql")).text()), + ) + await fs.copyFile(path.join(incremental, name, "snapshot.json"), snapshot) + } + + await fs.mkdir(full) + await drizzle(temporary, full, "schema") + await Bun.write(schema, renderSchema(await generatedSql(full))) + await Bun.write(registry, renderRegistry(await typescriptMigrations())) + } finally { + await fs.rm(temporary, { recursive: true, force: true }) + } } -await Bun.write(registry, renderRegistry(sqlMigrations)) - async function check() { const temporary = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-core-migration-check-")) - const output = path.join(temporary, "migration") + const incremental = path.join(temporary, "incremental") + const full = path.join(temporary, "full") try { - await fs.cp(sqlDir, output, { recursive: true }) - const config = path.join(temporary, "drizzle.config.ts") - await Bun.write( - config, - `import config from ${JSON.stringify(pathToFileURL(path.join(root, "packages/core/drizzle.config.ts")).href)} - -export default { ...config, out: ${JSON.stringify(output)} } -`, - ) - const before = await snapshot(output) - await $`bun drizzle-kit generate --config ${config}`.cwd(path.join(root, "packages/core")) - const after = await snapshot(output) - if (JSON.stringify(after) !== JSON.stringify(before)) { + await fs.mkdir(incremental) + await fs.mkdir(path.join(incremental, "baseline")) + await fs.copyFile(snapshot, path.join(incremental, "baseline/snapshot.json")) + await drizzle(temporary, incremental) + if ((await generatedMigrations(incremental)).length > 0) { throw new Error( "Core schema has ungenerated database migrations. Run `bun script/migration.ts` from packages/core.", ) } - const migrations = before - .map((entry) => entry.path.split("/")[0]) - .filter((name, index, all) => name !== undefined && all.indexOf(name) === index) - .sort() - for (const name of migrations) { - if (await Bun.file(path.join(tsDir, `${name}.ts`)).exists()) continue - throw new Error( - `Database migration TypeScript wrapper is missing for ${name}. Run \`bun script/migration.ts\` from packages/core.`, - ) + await fs.mkdir(full) + await drizzle(temporary, full, "schema") + if ((await Bun.file(schema).text()) !== renderSchema(await generatedSql(full))) { + throw new Error("Current database schema is stale. Run `bun script/migration.ts` from packages/core.") } + + const migrations = await typescriptMigrations() if ((await Bun.file(registry).text()) !== renderRegistry(migrations)) { throw new Error("Database migration registry is stale. Run `bun script/migration.ts` from packages/core.") } @@ -83,11 +89,37 @@ export default { ...config, out: ${JSON.stringify(output)} } } } -async function snapshot(directory: string) { - const files = await Array.fromAsync(new Bun.Glob("**/*").scan({ cwd: directory, onlyFiles: true })) - return Promise.all( - files.sort().map(async (file) => ({ path: file, contents: await Bun.file(path.join(directory, file)).text() })), +async function drizzle(temporary: string, output: string, name?: string) { + const config = path.join(temporary, `${path.basename(output)}.config.ts`) + await Bun.write( + config, + `import config from ${JSON.stringify(pathToFileURL(path.join(root, "packages/core/drizzle.config.ts")).href)} + +export default { ...config, out: ${JSON.stringify(output)} } +`, ) + await $`bun drizzle-kit generate --config ${config} ${name ? ["--name", name] : []}`.cwd( + path.join(root, "packages/core"), + ) +} + +async function generatedMigrations(directory: string) { + return (await Array.fromAsync(new Bun.Glob("*/migration.sql").scan({ cwd: directory }))) + .map((file) => file.split("/")[0]) + .filter((name): name is string => name !== undefined) + .sort() +} + +async function generatedSql(directory: string) { + const generated = await generatedMigrations(directory) + if (generated.length !== 1) throw new Error(`Expected one full schema migration, found ${generated.length}.`) + return Bun.file(path.join(directory, generated[0]!, "migration.sql")).text() +} + +async function typescriptMigrations() { + return (await Array.fromAsync(new Bun.Glob("*.ts").scan({ cwd: tsDir }))) + .map((file) => path.basename(file, ".ts")) + .sort() } function renderMigration(name: string, sql: string) { @@ -98,18 +130,36 @@ export default { id: ${JSON.stringify(name)}, up(tx) { return Effect.gen(function* () { -${sql - .split("--> statement-breakpoint") - .map((statement) => statement.trim()) - .filter((statement) => statement.length > 0) - .map(renderRun) - .join("\n")} +${renderStatements(sql)} }) }, } satisfies DatabaseMigration.Migration ` } +function renderSchema(sql: string) { + return `import { Effect } from "effect" +import type { DatabaseMigration } from "./migration" + +export default { + up(tx) { + return Effect.gen(function* () { +${renderStatements(sql)} + }) + }, +} satisfies Omit +` +} + +function renderStatements(sql: string) { + return sql + .split("--> statement-breakpoint") + .map((statement) => statement.trim()) + .filter((statement) => statement.length > 0) + .map(renderRun) + .join("\n") +} + function renderRun(statement: string) { const lines = statement.replaceAll("\t", " ").split("\n") if (lines.length === 1) return ` yield* tx.run(\`${escapeTemplate(lines[0])}\`)` diff --git a/packages/core/src/catalog.ts b/packages/core/src/catalog.ts index 7df56e75ba..0799f8fb00 100644 --- a/packages/core/src/catalog.ts +++ b/packages/core/src/catalog.ts @@ -1,6 +1,6 @@ export * as Catalog from "./catalog" -import { Context, Effect, Layer, Option, Order, pipe, Schema, Array, Scope, Stream } from "effect" +import { Array, Context, Effect, Layer, Option, Order, pipe, Schema, Scope, Stream } from "effect" import { castDraft, enableMapSet, type Draft } from "immer" import { ModelV2 } from "./model" import { ModelRequest } from "./model-request" @@ -11,7 +11,7 @@ import { EventV2 } from "./event" import { Policy } from "./policy" import { State } from "./state" import { Credential } from "./credential" -import { ConnectorSchema } from "./connector/schema" +import { IntegrationSchema } from "./integration/schema" export type ProviderRecord = { provider: ProviderV2.Info @@ -99,8 +99,8 @@ export const layer = Layer.effect( const credentials = yield* Credential.Service const scope = yield* Scope.Scope - const project = (provider: ProviderV2.Info, active: Map) => { - const credential = active.get(ConnectorSchema.ID.make(provider.id)) + const project = (provider: ProviderV2.Info, active: Map) => { + const credential = active.get(IntegrationSchema.ID.make(provider.id)) if (!credential) return provider const body = { ...provider.request.body } if (credential.value.type === "key") { @@ -211,7 +211,9 @@ export const layer = Layer.effect( } }), }) - const active = () => credentials.activeAll().pipe(Effect.orDie) + const active = Effect.fn("CatalogV2.active")(function* () { + return new Map((yield* credentials.all()).map((credential) => [credential.integrationID, credential])) + }) yield* events.subscribe(PluginV2.Event.Added).pipe( // Plugin registries are location scoped even though the event bus is process scoped. diff --git a/packages/core/src/connector.ts b/packages/core/src/connector.ts deleted file mode 100644 index 141c374f12..0000000000 --- a/packages/core/src/connector.ts +++ /dev/null @@ -1,492 +0,0 @@ -export * as Connector from "./connector" - -import { Cause, Clock, Context, Duration, Effect, Exit, Layer, Schedule, Schema, Scope, SynchronizedRef } from "effect" -import { castDraft, enableMapSet, type Draft } from "immer" -import { Credential } from "./credential" -import { ConnectorSchema } from "./connector/schema" -import { withStatics } from "./schema" -import { State } from "./state" -import { Identifier } from "./util/identifier" -import { KeyedMutex } from "./effect/keyed-mutex" -import { EventV2 } from "./event" - -export const ID = ConnectorSchema.ID -export type ID = ConnectorSchema.ID - -export const MethodID = ConnectorSchema.MethodID -export type MethodID = ConnectorSchema.MethodID - -export const AttemptID = Schema.String.pipe( - Schema.brand("Connector.AttemptID"), - withStatics((schema) => ({ create: () => schema.make("con_" + Identifier.ascending()) })), -) -export type AttemptID = typeof AttemptID.Type - -export const When = Schema.Struct({ - key: Schema.String, - op: Schema.Literals(["eq", "neq"]), - value: Schema.String, -}).annotate({ identifier: "Connector.When" }) -export type When = typeof When.Type - -export class TextPrompt extends Schema.Class("Connector.TextPrompt")({ - type: Schema.Literal("text"), - key: Schema.String, - message: Schema.String, - placeholder: Schema.optional(Schema.String), - when: Schema.optional(When), -}) {} - -export class SelectPrompt extends Schema.Class("Connector.SelectPrompt")({ - type: Schema.Literal("select"), - key: Schema.String, - message: Schema.String, - options: Schema.Array( - Schema.Struct({ - label: Schema.String, - value: Schema.String, - hint: Schema.optional(Schema.String), - }), - ), - when: Schema.optional(When), -}) {} - -export const Prompt = Schema.Union([TextPrompt, SelectPrompt]).pipe(Schema.toTaggedUnion("type")) -export type Prompt = typeof Prompt.Type - -export class OAuthMethod extends Schema.Class("Connector.OAuthMethod")({ - id: MethodID, - type: Schema.Literal("oauth"), - label: Schema.String, - prompts: Schema.optional(Schema.Array(Prompt)), -}) {} - -export class KeyMethod extends Schema.Class("Connector.KeyMethod")({ - id: MethodID, - type: Schema.Literal("key"), - label: Schema.String, - prompts: Schema.optional(Schema.Array(Prompt)), -}) {} - -export const Method = Schema.Union([OAuthMethod, KeyMethod]).pipe(Schema.toTaggedUnion("type")) -export type Method = typeof Method.Type - -export class Info extends Schema.Class("Connector.Info")({ - id: ID, - name: Schema.String, - methods: Schema.Array(Method), -}) {} - -export type Inputs = Readonly<{ [key: string]: string }> - -export type OAuthAuthorization = { - readonly url: string - readonly instructions: string -} & ( - | { - readonly mode: "auto" - readonly callback: Effect.Effect - } - | { - readonly mode: "code" - readonly callback: (code: string) => Effect.Effect - } -) - -export interface OAuthImplementation { - readonly connectorID: ID - readonly method: OAuthMethod - readonly authorize: (inputs: Inputs) => Effect.Effect - readonly refresh?: (credential: Credential.OAuth) => Effect.Effect -} - -export interface KeyImplementation { - readonly connectorID: ID - readonly method: KeyMethod - readonly authorize: (key: string, inputs: Inputs) => Effect.Effect -} - -export type Implementation = OAuthImplementation | KeyImplementation - -function isKeyImplementation(implementation: Implementation): implementation is KeyImplementation { - return implementation.method.type === "key" -} - -function isOAuthImplementation(implementation: Implementation): implementation is OAuthImplementation { - return implementation.method.type === "oauth" -} - -export class Attempt extends Schema.Class("Connector.Attempt")({ - attemptID: AttemptID, - url: Schema.String, - instructions: Schema.String, - mode: Schema.Literals(["auto", "code"]), - time: Schema.Struct({ - created: Schema.Number, - expires: Schema.Number, - }), -}) {} - -const Time = Schema.Struct({ - created: Schema.Number, - expires: Schema.Number, -}) - -export const AttemptStatus = Schema.Union([ - Schema.Struct({ status: Schema.Literal("pending"), time: Time }), - Schema.Struct({ status: Schema.Literal("complete"), time: Time }), - Schema.Struct({ status: Schema.Literal("failed"), message: Schema.String, time: Time }), - Schema.Struct({ status: Schema.Literal("expired"), time: Time }), -]).pipe(Schema.toTaggedUnion("status")) -export type AttemptStatus = typeof AttemptStatus.Type - -export class CodeRequiredError extends Schema.TaggedErrorClass()("Connector.CodeRequired", { - attemptID: AttemptID, -}) {} - -export class AuthorizationError extends Schema.TaggedErrorClass()("Connector.Authorization", { - cause: Schema.Defect, -}) {} - -export type Error = CodeRequiredError | AuthorizationError - -export const Event = { - Updated: EventV2.define({ - type: "connector.updated", - schema: {}, - }), -} - -type Entry = { - connector: Info - implementations: Map -} - -type Data = { - connectors: Map -} - -export type Editor = { - list: () => readonly Info[] - get: (id: ID) => Info | undefined - update: (id: ID, update: (connector: Draft>) => void) => void - remove: (id: ID) => void - method: { - update: (implementation: Implementation) => void - remove: (connectorID: ID, methodID: MethodID) => void - } -} - -export interface Interface { - /** Registers a scoped transform over the connector registry. */ - readonly transform: State.Interface["transform"] - /** Registers and immediately applies a scoped connector registry update. */ - readonly update: State.Interface["update"] - /** Returns one connector with its serializable login methods. */ - readonly get: (id: ID) => Effect.Effect - /** Returns all connectors with their serializable login methods. */ - readonly list: () => Effect.Effect - /** Refreshes an OAuth credential with its originating method. */ - readonly refresh: (credentialID: Credential.ID) => Effect.Effect - readonly connect: { - /** Runs a key method and stores the resulting credential. */ - readonly key: (input: { - /** Connector receiving the credential. */ - readonly connectorID: ID - /** Key method selected by the caller. */ - readonly methodID: MethodID - /** Secret entered by the user. */ - readonly key: string - /** Answers to the method's optional prompts. */ - readonly inputs: Inputs - /** User-facing label for the stored credential. */ - readonly label?: string - }) => Effect.Effect - readonly oauth: { - /** Starts a stateful OAuth attempt. */ - readonly begin: (input: { - /** Connector being authenticated. */ - readonly connectorID: ID - /** OAuth method selected by the caller. */ - readonly methodID: MethodID - /** Answers to the method's optional prompts. */ - readonly inputs: Inputs - /** User-facing label for the credential created on completion. */ - readonly label?: string - }) => Effect.Effect - /** Returns the current state of an OAuth attempt. */ - readonly status: (attemptID: AttemptID) => Effect.Effect - /** Completes the attempt and stores its credential. */ - readonly complete: (input: { - /** Opaque handle returned by `begin`. */ - readonly attemptID: AttemptID - /** Authorization code required by attempts in code mode. */ - readonly code?: string - }) => Effect.Effect - /** Cancels an attempt and releases its resources. */ - readonly cancel: (attemptID: AttemptID) => Effect.Effect - } - } -} - -export class Service extends Context.Service()("@opencode/v2/Connector") {} - -enableMapSet() - -const attemptLifetime = Duration.toMillis(Duration.minutes(10)) -const terminalRetention = Duration.toMillis(Duration.minutes(1)) -const scrubInterval = Duration.seconds(30) - -type AttemptTime = { created: number; expires: number } -type PendingAttempt = { - status: "pending" - completing: boolean - authorization: OAuthAuthorization - connectorID: ID - methodID: MethodID - label?: string - scope: Scope.Closeable - time: AttemptTime -} -type TerminalAttempt = { - status: "complete" | "failed" | "expired" - message?: string - removeAt: number - time: AttemptTime -} -type AttemptEntry = PendingAttempt | TerminalAttempt - -export const locationLayer = Layer.effect( - Service, - Effect.gen(function* () { - const credentials = yield* Credential.Service - const events = yield* EventV2.Service - const scope = yield* Scope.Scope - const attempts = SynchronizedRef.makeUnsafe(new Map()) - const refreshLocks = KeyedMutex.makeUnsafe() - const state = State.create({ - initial: () => ({ connectors: new Map() }), - editor: (draft) => ({ - list: () => Array.from(draft.connectors.values(), (entry) => entry.connector) as Info[], - get: (id) => draft.connectors.get(id)?.connector as Info | undefined, - update: (id, update) => { - const current = - draft.connectors.get(id) ?? - castDraft({ connector: new Info({ id, name: id, methods: [] }), implementations: new Map() }) - if (!draft.connectors.has(id)) draft.connectors.set(id, current) - update(current.connector) - current.connector.id = id - }, - remove: (id) => draft.connectors.delete(id), - method: { - update: (implementation) => { - const current = - draft.connectors.get(implementation.connectorID) ?? - castDraft({ - connector: new Info({ id: implementation.connectorID, name: implementation.connectorID, methods: [] }), - implementations: new Map(), - }) - if (!draft.connectors.has(implementation.connectorID)) { - draft.connectors.set(implementation.connectorID, current) - } - const index = current.connector.methods.findIndex((method) => method.id === implementation.method.id) - if (index === -1) current.connector.methods.push(castDraft(implementation.method)) - else current.connector.methods[index] = castDraft(implementation.method) - current.implementations.set(implementation.method.id, castDraft(implementation)) - }, - remove: (connectorID, methodID) => { - const current = draft.connectors.get(connectorID) - if (!current) return - const index = current.connector.methods.findIndex((method) => method.id === methodID) - if (index !== -1) current.connector.methods.splice(index, 1) - current.implementations.delete(methodID) - }, - }, - }), - finalize: () => events.publish(Event.Updated, {}).pipe(Effect.asVoid), - }) - - const authorize = (effect: Effect.Effect) => - effect.pipe(Effect.mapError((cause) => new AuthorizationError({ cause }))) - - const close = (attemptScope: Scope.Closeable) => - Scope.close(attemptScope, Exit.void).pipe(Effect.forkIn(scope, { startImmediately: true }), Effect.asVoid) - - const message = (cause: Cause.Cause) => { - const error = Cause.squash(cause) - return error instanceof Error ? error.message : String(error) - } - - const settle = Effect.fnUntraced(function* (attemptID: AttemptID, exit: Exit.Exit) { - const now = yield* Clock.currentTimeMillis - const result = yield* SynchronizedRef.modify(attempts, (current) => { - const attempt = current.get(attemptID) - if (!attempt || attempt.status !== "pending") return [undefined, current] - const terminal: TerminalAttempt = Exit.isSuccess(exit) - ? { status: "complete", time: attempt.time, removeAt: now + terminalRetention } - : { status: "failed", message: message(exit.cause), time: attempt.time, removeAt: now + terminalRetention } - return [attempt, new Map(current).set(attemptID, terminal)] - }) - if (!result) return - if (Exit.isSuccess(exit)) { - yield* credentials.create({ - connectorID: result.connectorID, - methodID: result.methodID, - label: result.label, - value: exit.value, - }) - } - yield* close(result.scope) - }) - - const scrub = Effect.fnUntraced(function* () { - const now = yield* Clock.currentTimeMillis - const expired = yield* SynchronizedRef.modify(attempts, (current) => { - const next = new Map(current) - const scopes: Scope.Closeable[] = [] - for (const [id, attempt] of current) { - if (attempt.status === "pending" && attempt.time.expires <= now) { - scopes.push(attempt.scope) - next.set(id, { status: "expired", time: attempt.time, removeAt: now + terminalRetention }) - continue - } - if (attempt.status !== "pending" && attempt.removeAt <= now) next.delete(id) - } - return [scopes, next] - }) - yield* Effect.forEach(expired, close, { discard: true }) - }) - - yield* scrub().pipe(Effect.repeat(Schedule.spaced(scrubInterval)), Effect.forkIn(scope)) - - return Service.of({ - transform: state.transform, - update: state.update, - get: Effect.fn("Connector.get")(function* (id) { - return state.get().connectors.get(id)?.connector - }), - list: Effect.fn("Connector.list")(function* () { - return Array.from(state.get().connectors.values(), (record) => record.connector).toSorted((a, b) => - a.name.localeCompare(b.name), - ) - }), - refresh: Effect.fn("Connector.refresh")(function* (credentialID) { - yield* refreshLocks.withLock(credentialID)( - Effect.gen(function* () { - const credential = yield* credentials.get(credentialID) - if (!credential || credential.value.type !== "oauth") { - return yield* Effect.die(`OAuth credential not found: ${credentialID}`) - } - const implementation = state - .get() - .connectors.get(credential.connectorID) - ?.implementations.get(credential.methodID) - if (!implementation || !isOAuthImplementation(implementation) || !implementation.refresh) { - return yield* Effect.die( - `OAuth refresh method not found: ${credential.connectorID}/${credential.methodID}`, - ) - } - const value = yield* authorize(implementation.refresh(credential.value)) - yield* credentials.update(credential.id, { value }) - }), - ) - }), - connect: { - key: Effect.fn("Connector.connect.key")(function* (input) { - const method = state.get().connectors.get(input.connectorID)?.implementations.get(input.methodID) - if (!method || !isKeyImplementation(method)) { - return yield* Effect.die(`Key method not found: ${input.connectorID}/${input.methodID}`) - } - const value = yield* authorize(method.authorize(input.key, input.inputs)) - yield* credentials.create({ - connectorID: input.connectorID, - methodID: input.methodID, - label: input.label, - value, - }) - }), - oauth: { - begin: Effect.fn("Connector.connect.oauth.begin")(function* (input) { - const method = state.get().connectors.get(input.connectorID)?.implementations.get(input.methodID) - if (!method || !isOAuthImplementation(method)) { - return yield* Effect.die(`OAuth method not found: ${input.connectorID}/${input.methodID}`) - } - const attemptScope = yield* Scope.fork(scope) - const authorization = yield* authorize(method.authorize(input.inputs)).pipe( - Scope.provide(attemptScope), - Effect.onExit((exit) => (Exit.isFailure(exit) ? Scope.close(attemptScope, exit) : Effect.void)), - ) - const id = AttemptID.create() - const created = yield* Clock.currentTimeMillis - const time = { created, expires: created + attemptLifetime } - yield* SynchronizedRef.update(attempts, (current) => - new Map(current).set(id, { - status: "pending", - completing: authorization.mode === "auto", - authorization, - connectorID: input.connectorID, - methodID: input.methodID, - label: input.label, - scope: attemptScope, - time, - }), - ) - if (authorization.mode === "auto") { - yield* authorization.callback.pipe( - Effect.exit, - Effect.flatMap((exit) => settle(id, exit)), - Effect.forkIn(attemptScope, { startImmediately: true }), - ) - } - return new Attempt({ - attemptID: id, - url: authorization.url, - instructions: authorization.instructions, - mode: authorization.mode, - time, - }) - }), - status: Effect.fn("Connector.connect.oauth.status")(function* (attemptID) { - const attempt = (yield* SynchronizedRef.get(attempts)).get(attemptID) - if (!attempt) return yield* Effect.die(`OAuth attempt not found: ${attemptID}`) - if (attempt.status === "failed") { - return { status: attempt.status, message: attempt.message ?? "Authorization failed", time: attempt.time } - } - return { status: attempt.status, time: attempt.time } - }), - complete: Effect.fn("Connector.connect.oauth.complete")(function* (input) { - const attempt = yield* SynchronizedRef.modify(attempts, (current) => { - const match = current.get(input.attemptID) - if (!match || match.status !== "pending" || match.completing) return [match, current] - if (match.authorization.mode === "code" && input.code === undefined) return [match, current] - return [match, new Map(current).set(input.attemptID, { ...match, completing: true })] - }) - if (!attempt) return yield* Effect.die(`OAuth attempt not found: ${input.attemptID}`) - if (attempt.status !== "pending") return - if (attempt.authorization.mode === "code" && input.code === undefined) { - return yield* new CodeRequiredError({ attemptID: input.attemptID }) - } - if (attempt.completing) return yield* Effect.die(`OAuth attempt already completing: ${input.attemptID}`) - const callback = - attempt.authorization.mode === "auto" - ? attempt.authorization.callback - : attempt.authorization.callback(input.code as string) - const exit = yield* authorize(callback).pipe(Effect.exit) - yield* settle(input.attemptID, exit) - if (Exit.isFailure(exit)) return yield* exit - }), - cancel: Effect.fn("Connector.connect.oauth.cancel")(function* (attemptID) { - const attempt = yield* SynchronizedRef.modify(attempts, (current) => { - const match = current.get(attemptID) - if (!match || match.status !== "pending") return [undefined, current] - const next = new Map(current) - next.delete(attemptID) - return [match, next] - }) - if (attempt) yield* Scope.close(attempt.scope, Exit.void) - }), - }, - }, - }) - }), -) diff --git a/packages/core/src/connector/schema.ts b/packages/core/src/connector/schema.ts deleted file mode 100644 index 40c43faab8..0000000000 --- a/packages/core/src/connector/schema.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * as ConnectorSchema from "./schema" - -import { Schema } from "effect" - -export const ID = Schema.String.pipe(Schema.brand("Connector.ID")) -export type ID = typeof ID.Type - -export const MethodID = Schema.String.pipe(Schema.brand("Connector.MethodID")) -export type MethodID = typeof MethodID.Type diff --git a/packages/core/src/credential.ts b/packages/core/src/credential.ts index 1a64284202..77bece2776 100644 --- a/packages/core/src/credential.ts +++ b/packages/core/src/credential.ts @@ -1,17 +1,12 @@ export * as Credential from "./credential" -import { and, asc, eq, ne } from "drizzle-orm" -import { Context, Effect, Layer, Option, Schema } from "effect" +import { asc, eq } from "drizzle-orm" +import { Context, Effect, Layer, Schema } from "effect" import { Database } from "./database/database" -import { ConnectorSchema } from "./connector/schema" -import { EventV2 } from "./event" +import { IntegrationSchema } from "./integration/schema" import { NonNegativeInt, withStatics } from "./schema" -import { CredentialTable } from "./credential/sql" import { Identifier } from "./util/identifier" -import { FSUtil } from "./fs-util" -import { Global } from "./global" -import { DataMigrationTable } from "./data-migration.sql" -import path from "path" +import { CredentialTable } from "./credential/sql" export const ID = Schema.String.pipe( Schema.brand("Credential.ID"), @@ -21,6 +16,7 @@ export type ID = typeof ID.Type export class OAuth extends Schema.Class("Credential.OAuth")({ type: Schema.Literal("oauth"), + methodID: IntegrationSchema.MethodID, refresh: Schema.String, access: Schema.String, expires: NonNegativeInt, @@ -33,255 +29,102 @@ export class Key extends Schema.Class("Credential.Key")({ metadata: Schema.optional(Schema.Record(Schema.String, Schema.String)), }) {} -export const Value = Schema.Union([OAuth, Key]) +export const Info = Schema.Union([OAuth, Key]) .pipe(Schema.toTaggedUnion("type")) - .annotate({ identifier: "Credential.Value" }) -export type Value = Schema.Schema.Type + .annotate({ identifier: "Credential.Info" }) +export type Info = Schema.Schema.Type -const LegacyOAuth = Schema.Struct({ - type: Schema.Literal("oauth"), - refresh: Schema.String, - access: Schema.String, - expires: NonNegativeInt, - accountId: Schema.optional(Schema.String), - enterpriseUrl: Schema.optional(Schema.String), -}) - -const LegacyKey = Schema.Struct({ - type: Schema.Literal("api"), - key: Schema.String, - metadata: Schema.optional(Schema.Record(Schema.String, Schema.String)), -}) - -const LegacyValue = Schema.Union([LegacyOAuth, LegacyKey]) - -export class Info extends Schema.Class("Credential.Info")({ +export class Stored extends Schema.Class("Credential.Stored")({ id: ID, - connectorID: ConnectorSchema.ID, - methodID: ConnectorSchema.MethodID, + integrationID: IntegrationSchema.ID, label: Schema.String, - value: Value, + value: Info, }) {} -export const Event = { - Added: EventV2.define({ - type: "credential.added", - schema: { credential: Info }, - }), - Removed: EventV2.define({ - type: "credential.removed", - schema: { credential: Info }, - }), - Switched: EventV2.define({ - type: "credential.switched", - schema: { - connectorID: ConnectorSchema.ID, - from: Schema.optional(ID), - to: Schema.optional(ID), - }, - }), -} - export interface Interface { - readonly get: (id: ID) => Effect.Effect - readonly all: () => Effect.Effect + /** Returns every stored credential. */ + readonly all: () => Effect.Effect + /** Returns stored credentials belonging to one integration. */ + readonly list: (integrationID: IntegrationSchema.ID) => Effect.Effect + /** Replaces any credential for an integration and returns the new record. */ readonly create: (input: { - connectorID: ConnectorSchema.ID - methodID: ConnectorSchema.MethodID - value: Value - label?: string - }) => Effect.Effect - readonly update: (id: ID, updates: Partial>) => Effect.Effect + readonly integrationID: IntegrationSchema.ID + readonly value: Info + readonly label?: string + }) => Effect.Effect + /** Updates the label or secret value of a stored credential. */ + readonly update: (id: ID, updates: Partial>) => Effect.Effect + /** Removes a stored credential. */ readonly remove: (id: ID) => Effect.Effect - readonly activate: (id: ID) => Effect.Effect - readonly active: (connectorID: ConnectorSchema.ID) => Effect.Effect - readonly activeAll: () => Effect.Effect> - readonly forConnector: (connectorID: ConnectorSchema.ID) => Effect.Effect } export class Service extends Context.Service()("@opencode/v2/Credential") {} -export const legacyImportLayer = Layer.effectDiscard( - Effect.gen(function* () { - const { db } = yield* Database.Service - const fs = yield* FSUtil.Service - const global = yield* Global.Service - const name = "credential.auth-json" - if (yield* db.select().from(DataMigrationTable).where(eq(DataMigrationTable.name, name)).get()) return - const raw = yield* fs.readJson(path.join(global.data, "auth.json")).pipe(Effect.option) - if (Option.isNone(raw) || typeof raw.value !== "object" || raw.value === null || Array.isArray(raw.value)) return - const decode = Schema.decodeUnknownOption(LegacyValue) - const values = Object.entries(raw.value).flatMap(([connectorID, value]) => { - const decoded = decode(value) - if (Option.isNone(decoded)) return [] - const credential = decoded.value - const id = ID.create() - const connector = ConnectorSchema.ID.make(connectorID.replace(/\/+$/, "")) - const methodID = ConnectorSchema.MethodID.make( - credential.type === "api" - ? "api-key" - : connector === ConnectorSchema.ID.make("openai") - ? "chatgpt-browser" - : "oauth", - ) - const next: Value = - credential.type === "api" - ? new Key({ type: "key", key: credential.key, metadata: credential.metadata }) - : new OAuth({ - type: "oauth", - refresh: credential.refresh, - access: credential.access, - expires: credential.expires, - metadata: { - ...(credential.accountId ? { accountID: credential.accountId } : {}), - ...(credential.enterpriseUrl ? { enterpriseURL: credential.enterpriseUrl } : {}), - }, - }) - return [{ id, connectorID: connector, methodID, value: next }] - }) - yield* db.transaction((tx) => - Effect.gen(function* () { - for (const item of values) { - if ( - yield* tx - .select({ id: CredentialTable.id }) - .from(CredentialTable) - .where(eq(CredentialTable.connector_id, item.connectorID)) - .get() - ) - continue - yield* tx.insert(CredentialTable).values({ - id: item.id, - connector_id: item.connectorID, - method_id: item.methodID, - label: "Imported", - value: item.value, - active: true, - }) - } - yield* tx.insert(DataMigrationTable).values({ name, time_completed: Date.now() }).onConflictDoNothing().run() - }), - ) - }).pipe(Effect.orDie), -) - export const layer = Layer.effect( Service, Effect.gen(function* () { const { db } = yield* Database.Service - const events = yield* EventV2.Service - const decodeValue = Schema.decodeUnknownSync(Value) - const info = (row: typeof CredentialTable.$inferSelect) => - new Info({ + const decode = Schema.decodeUnknownSync(Info) + const stored = (row: typeof CredentialTable.$inferSelect) => { + if (!row.integration_id) return + return new Stored({ id: row.id, - connectorID: row.connector_id, - methodID: row.method_id, + integrationID: row.integration_id, label: row.label, - value: decodeValue(row.value), + value: decode(row.value), }) - - const activate = Effect.fn("Credential.activate")(function* (id: ID) { - const switched = yield* db - .transaction((tx) => - Effect.gen(function* () { - const credential = yield* tx.select().from(CredentialTable).where(eq(CredentialTable.id, id)).get() - if (!credential || credential.active) return - const current = yield* tx - .select({ id: CredentialTable.id }) - .from(CredentialTable) - .where(and(eq(CredentialTable.connector_id, credential.connector_id), eq(CredentialTable.active, true))) - .get() - yield* tx - .update(CredentialTable) - .set({ active: false }) - .where(eq(CredentialTable.connector_id, credential.connector_id)) - .run() - yield* tx.update(CredentialTable).set({ active: true }).where(eq(CredentialTable.id, id)).run() - return { connectorID: credential.connector_id, from: current?.id, to: id } - }), - ) - .pipe(Effect.orDie) - if (switched) yield* events.publish(Event.Switched, switched) - }) + } return Service.of({ - get: Effect.fn("Credential.get")(function* (id) { - const row = yield* db.select().from(CredentialTable).where(eq(CredentialTable.id, id)).get().pipe(Effect.orDie) - return row ? info(row) : undefined - }), all: Effect.fn("Credential.all")(function* () { return (yield* db .select() .from(CredentialTable) .orderBy(asc(CredentialTable.time_created)) .all() - .pipe(Effect.orDie)).map(info) + .pipe(Effect.orDie)).flatMap((row) => { + const credential = stored(row) + return credential ? [credential] : [] + }) }), - active: Effect.fn("Credential.active")(function* (connectorID) { - const row = yield* db - .select() - .from(CredentialTable) - .where(and(eq(CredentialTable.connector_id, connectorID), eq(CredentialTable.active, true))) - .get() - .pipe(Effect.orDie) - return row ? info(row) : undefined - }), - activeAll: Effect.fn("Credential.activeAll")(function* () { - const rows = yield* db - .select() - .from(CredentialTable) - .where(eq(CredentialTable.active, true)) - .all() - .pipe(Effect.orDie) - return new Map(rows.map((row) => [row.connector_id, info(row)])) - }), - forConnector: Effect.fn("Credential.forConnector")(function* (connectorID) { + list: Effect.fn("Credential.list")(function* (integrationID) { return (yield* db .select() .from(CredentialTable) - .where(eq(CredentialTable.connector_id, connectorID)) + .where(eq(CredentialTable.integration_id, integrationID)) .orderBy(asc(CredentialTable.time_created)) .all() - .pipe(Effect.orDie)).map(info) + .pipe(Effect.orDie)).flatMap((row) => { + const credential = stored(row) + return credential ? [credential] : [] + }) }), create: Effect.fn("Credential.create")(function* (input) { - const credential = new Info({ + const credential = new Stored({ id: ID.create(), - connectorID: input.connectorID, - methodID: input.methodID, + integrationID: input.integrationID, label: input.label ?? "default", value: input.value, }) - const from = yield* db + yield* db .transaction((tx) => Effect.gen(function* () { - const current = yield* tx - .select({ id: CredentialTable.id }) - .from(CredentialTable) - .where(and(eq(CredentialTable.connector_id, input.connectorID), eq(CredentialTable.active, true))) - .get() yield* tx - .update(CredentialTable) - .set({ active: false }) - .where(eq(CredentialTable.connector_id, input.connectorID)) + .delete(CredentialTable) + .where(eq(CredentialTable.integration_id, credential.integrationID)) .run() yield* tx .insert(CredentialTable) .values({ id: credential.id, - connector_id: credential.connectorID, - method_id: credential.methodID, + integration_id: credential.integrationID, label: credential.label, value: credential.value, - active: true, }) .run() - return current?.id }), ) .pipe(Effect.orDie) - yield* events.publish(Event.Added, { credential }) - yield* events.publish(Event.Switched, { connectorID: credential.connectorID, from, to: credential.id }) return credential }), update: Effect.fn("Credential.update")(function* (id, updates) { @@ -294,50 +137,10 @@ export const layer = Layer.effect( .pipe(Effect.orDie) }), remove: Effect.fn("Credential.remove")(function* (id) { - const removed = yield* db - .transaction((tx) => - Effect.gen(function* () { - const row = yield* tx.select().from(CredentialTable).where(eq(CredentialTable.id, id)).get() - if (!row) return - yield* tx.delete(CredentialTable).where(eq(CredentialTable.id, id)).run() - if (!row.active) return { credential: info(row) } - const replacement = yield* tx - .select() - .from(CredentialTable) - .where(and(eq(CredentialTable.connector_id, row.connector_id), ne(CredentialTable.id, id))) - .orderBy(asc(CredentialTable.time_created)) - .get() - if (replacement) { - yield* tx - .update(CredentialTable) - .set({ active: true }) - .where(eq(CredentialTable.id, replacement.id)) - .run() - } - return { - credential: info(row), - switched: { connectorID: row.connector_id, from: id, to: replacement?.id }, - } - }), - ) - .pipe(Effect.orDie) - if (!removed) return - yield* events.publish(Event.Removed, { credential: removed.credential }) - if (removed.switched) yield* events.publish(Event.Switched, removed.switched) + yield* db.delete(CredentialTable).where(eq(CredentialTable.id, id)).run().pipe(Effect.orDie) }), - activate, }) }), ) -export const defaultLayer = layer.pipe( - Layer.provide(Database.defaultLayer), - Layer.provide(EventV2.defaultLayer), - Layer.provideMerge( - legacyImportLayer.pipe( - Layer.provide(Database.defaultLayer), - Layer.provide(FSUtil.defaultLayer), - Layer.provide(Global.defaultLayer), - ), - ), -) +export const defaultLayer = layer.pipe(Layer.provide(Database.defaultLayer)) diff --git a/packages/core/src/credential/sql.ts b/packages/core/src/credential/sql.ts index ff2c50fb08..a849092ea0 100644 --- a/packages/core/src/credential/sql.ts +++ b/packages/core/src/credential/sql.ts @@ -1,23 +1,15 @@ -import { sql } from "drizzle-orm" -import { integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core" +import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core" import { Timestamps } from "../database/schema.sql" -import type { ConnectorSchema } from "../connector/schema" +import type { IntegrationSchema } from "../integration/schema" import type { Credential } from "../credential" -export const CredentialTable = sqliteTable( - "credential", - { - id: text().$type().primaryKey(), - connector_id: text().$type().notNull(), - method_id: text().$type().notNull(), - label: text().notNull(), - value: text({ mode: "json" }).$type().notNull(), - active: integer({ mode: "boolean" }).notNull().default(false), - ...Timestamps, - }, - (table) => [ - uniqueIndex("credential_connector_active_idx") - .on(table.connector_id) - .where(sql`${table.active} = 1`), - ], -) +export const CredentialTable = sqliteTable("credential", { + id: text().$type().primaryKey(), + integration_id: text().$type(), + label: text().notNull(), + value: text({ mode: "json" }).$type().notNull(), + connector_id: text(), + method_id: text(), + active: integer({ mode: "boolean" }), + ...Timestamps, +}) diff --git a/packages/core/src/database/migration.gen.ts b/packages/core/src/database/migration.gen.ts index 29dd8bfabe..1e915bb3cf 100644 --- a/packages/core/src/database/migration.gen.ts +++ b/packages/core/src/database/migration.gen.ts @@ -35,5 +35,7 @@ export const migrations = ( import("./migration/20260605003541_add_session_context_snapshot"), import("./migration/20260605042240_add_context_epoch_agent"), import("./migration/20260611035744_credential"), + import("./migration/20260611192811_lush_chimera"), + import("./migration/20260612174303_project_dir_strategy"), ]) ).map((module) => module.default) satisfies DatabaseMigration.Migration[] diff --git a/packages/core/src/database/migration.ts b/packages/core/src/database/migration.ts index dfc445e3eb..90dee8acbf 100644 --- a/packages/core/src/database/migration.ts +++ b/packages/core/src/database/migration.ts @@ -4,6 +4,7 @@ import { sql } from "drizzle-orm" import { Effect, Semaphore } from "effect" import type { EffectDrizzleSqlite } from "@opencode-ai/effect-drizzle-sqlite" import { migrations } from "./migration.gen" +import schema from "./schema.gen" type Database = EffectDrizzleSqlite.EffectSQLiteDatabase type Transaction = Parameters[0]>[0] @@ -15,7 +16,28 @@ export type Migration = { } export function apply(db: Database) { - return lock.withPermit(applyOnly(db, migrations)) + return lock.withPermit( + Effect.gen(function* () { + const tables = yield* db.all<{ name: string }>( + sql`SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%'`, + ) + if (tables.some((table) => table.name === "session")) return yield* applyOnly(db, migrations) + if (tables.length > 0) return yield* Effect.die("Database is not empty and has no session table") + yield* db.transaction((tx) => + Effect.gen(function* () { + yield* schema.up(tx) + yield* tx.run( + sql`CREATE TABLE ${sql.identifier("migration")} (id TEXT PRIMARY KEY, time_completed INTEGER NOT NULL)`, + ) + yield* Effect.forEach(migrations, (migration) => + tx.run( + sql`INSERT INTO ${sql.identifier("migration")} (id, time_completed) VALUES (${migration.id}, ${Date.now()})`, + ), + ) + }), + ) + }), + ) } export function applyOnly(db: Database, input: Migration[]) { @@ -48,7 +70,7 @@ export function applyOnly(db: Database, input: Migration[]) { if (completed.has(migration.id)) continue yield* db.transaction((tx) => Effect.gen(function* () { - if (!process.env.KILO_SKIP_MIGRATIONS) yield* migration.up(tx) + yield* migration.up(tx) yield* tx.run( sql`INSERT INTO ${sql.identifier("migration")} (id, time_completed) VALUES (${migration.id}, ${Date.now()})`, ) diff --git a/packages/core/src/database/migration/20260611192811_lush_chimera.ts b/packages/core/src/database/migration/20260611192811_lush_chimera.ts new file mode 100644 index 0000000000..306b10d532 --- /dev/null +++ b/packages/core/src/database/migration/20260611192811_lush_chimera.ts @@ -0,0 +1,25 @@ +import { Effect } from "effect" +import type { DatabaseMigration } from "../migration" + +export default { + id: "20260611192811_lush_chimera", + up(tx) { + return Effect.gen(function* () { + yield* tx.run(`DROP INDEX IF EXISTS \`credential_connector_active_idx\`;`) + yield* tx.run(`DROP TABLE \`credential\`;`) + yield* tx.run(` + CREATE TABLE \`credential\` ( + \`id\` text PRIMARY KEY, + \`integration_id\` text, + \`label\` text NOT NULL, + \`value\` text NOT NULL, + \`connector_id\` text, + \`method_id\` text, + \`active\` integer, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL + ); + `) + }) + }, +} satisfies DatabaseMigration.Migration diff --git a/packages/core/src/database/migration/20260612174303_project_dir_strategy.ts b/packages/core/src/database/migration/20260612174303_project_dir_strategy.ts new file mode 100644 index 0000000000..1f09c40a70 --- /dev/null +++ b/packages/core/src/database/migration/20260612174303_project_dir_strategy.ts @@ -0,0 +1,29 @@ +import { Effect } from "effect" +import type { DatabaseMigration } from "../migration" + +export default { + id: "20260612174303_project_dir_strategy", + up(tx) { + return Effect.gen(function* () { + yield* tx.run(`ALTER TABLE \`project_directory\` ADD \`strategy\` text;`) + yield* tx.run(`PRAGMA foreign_keys=OFF;`) + yield* tx.run(` + CREATE TABLE \`__new_project_directory\` ( + \`project_id\` text NOT NULL, + \`directory\` text NOT NULL, + \`type\` text, + \`strategy\` text, + \`time_created\` integer NOT NULL, + CONSTRAINT \`project_directory_pk\` PRIMARY KEY(\`project_id\`, \`directory\`), + CONSTRAINT \`fk_project_directory_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run( + `INSERT INTO \`__new_project_directory\`(\`project_id\`, \`directory\`, \`type\`, \`time_created\`) SELECT \`project_id\`, \`directory\`, \`type\`, \`time_created\` FROM \`project_directory\`;`, + ) + yield* tx.run(`DROP TABLE \`project_directory\`;`) + yield* tx.run(`ALTER TABLE \`__new_project_directory\` RENAME TO \`project_directory\`;`) + yield* tx.run(`PRAGMA foreign_keys=ON;`) + }) + }, +} satisfies DatabaseMigration.Migration diff --git a/packages/core/src/database/schema.gen.ts b/packages/core/src/database/schema.gen.ts new file mode 100644 index 0000000000..5c044ec60f --- /dev/null +++ b/packages/core/src/database/schema.gen.ts @@ -0,0 +1,277 @@ +import { Effect } from "effect" +import type { DatabaseMigration } from "./migration" + +export default { + up(tx) { + return Effect.gen(function* () { + yield* tx.run(` + CREATE TABLE \`workspace\` ( + \`id\` text PRIMARY KEY, + \`type\` text NOT NULL, + \`name\` text DEFAULT '' NOT NULL, + \`branch\` text, + \`directory\` text, + \`extra\` text, + \`project_id\` text NOT NULL, + \`time_used\` integer NOT NULL, + CONSTRAINT \`fk_workspace_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`data_migration\` ( + \`name\` text PRIMARY KEY, + \`time_completed\` integer NOT NULL + ); + `) + yield* tx.run(` + CREATE TABLE \`account_state\` ( + \`id\` integer PRIMARY KEY, + \`active_account_id\` text, + \`active_org_id\` text, + CONSTRAINT \`fk_account_state_active_account_id_account_id_fk\` FOREIGN KEY (\`active_account_id\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL + ); + `) + yield* tx.run(` + CREATE TABLE \`account\` ( + \`id\` text PRIMARY KEY, + \`email\` text NOT NULL, + \`url\` text NOT NULL, + \`access_token\` text NOT NULL, + \`refresh_token\` text NOT NULL, + \`token_expiry\` integer, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL + ); + `) + yield* tx.run(` + CREATE TABLE \`control_account\` ( + \`email\` text NOT NULL, + \`url\` text NOT NULL, + \`access_token\` text NOT NULL, + \`refresh_token\` text NOT NULL, + \`token_expiry\` integer, + \`active\` integer NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + CONSTRAINT \`control_account_pk\` PRIMARY KEY(\`email\`, \`url\`) + ); + `) + yield* tx.run(` + CREATE TABLE \`credential\` ( + \`id\` text PRIMARY KEY, + \`integration_id\` text, + \`label\` text NOT NULL, + \`value\` text NOT NULL, + \`connector_id\` text, + \`method_id\` text, + \`active\` integer, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL + ); + `) + yield* tx.run(` + CREATE TABLE \`event_sequence\` ( + \`aggregate_id\` text PRIMARY KEY, + \`seq\` integer NOT NULL, + \`owner_id\` text + ); + `) + yield* tx.run(` + CREATE TABLE \`event\` ( + \`id\` text PRIMARY KEY, + \`aggregate_id\` text NOT NULL, + \`seq\` integer NOT NULL, + \`type\` text NOT NULL, + \`data\` text NOT NULL, + CONSTRAINT \`fk_event_aggregate_id_event_sequence_aggregate_id_fk\` FOREIGN KEY (\`aggregate_id\`) REFERENCES \`event_sequence\`(\`aggregate_id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`permission\` ( + \`id\` text PRIMARY KEY, + \`project_id\` text NOT NULL, + \`action\` text NOT NULL, + \`resource\` text NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + CONSTRAINT \`fk_permission_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`project_directory\` ( + \`project_id\` text NOT NULL, + \`directory\` text NOT NULL, + \`type\` text, + \`strategy\` text, + \`time_created\` integer NOT NULL, + CONSTRAINT \`project_directory_pk\` PRIMARY KEY(\`project_id\`, \`directory\`), + CONSTRAINT \`fk_project_directory_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`project\` ( + \`id\` text PRIMARY KEY, + \`worktree\` text NOT NULL, + \`vcs\` text, + \`name\` text, + \`icon_url\` text, + \`icon_url_override\` text, + \`icon_color\` text, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + \`time_initialized\` integer, + \`sandboxes\` text NOT NULL, + \`commands\` text + ); + `) + yield* tx.run(` + CREATE TABLE \`message\` ( + \`id\` text PRIMARY KEY, + \`session_id\` text NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + \`data\` text NOT NULL, + CONSTRAINT \`fk_message_session_id_session_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`part\` ( + \`id\` text PRIMARY KEY, + \`message_id\` text NOT NULL, + \`session_id\` text NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + \`data\` text NOT NULL, + CONSTRAINT \`fk_part_message_id_message_id_fk\` FOREIGN KEY (\`message_id\`) REFERENCES \`message\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`session_context_epoch\` ( + \`session_id\` text PRIMARY KEY, + \`baseline\` text NOT NULL, + \`agent\` text DEFAULT 'build' NOT NULL, + \`snapshot\` text NOT NULL, + \`baseline_seq\` integer NOT NULL, + \`replacement_seq\` integer, + \`revision\` integer DEFAULT 0 NOT NULL, + CONSTRAINT \`fk_session_context_epoch_session_id_session_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`session_input\` ( + \`id\` text PRIMARY KEY, + \`session_id\` text NOT NULL, + \`prompt\` text NOT NULL, + \`delivery\` text NOT NULL, + \`admitted_seq\` integer NOT NULL, + \`promoted_seq\` integer, + \`time_created\` integer NOT NULL, + CONSTRAINT \`fk_session_input_session_id_session_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`session_message\` ( + \`id\` text PRIMARY KEY, + \`session_id\` text NOT NULL, + \`type\` text NOT NULL, + \`seq\` integer NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + \`data\` text NOT NULL, + CONSTRAINT \`fk_session_message_session_id_session_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`session\` ( + \`id\` text PRIMARY KEY, + \`project_id\` text NOT NULL, + \`workspace_id\` text, + \`parent_id\` text, + \`slug\` text NOT NULL, + \`directory\` text NOT NULL, + \`path\` text, + \`title\` text NOT NULL, + \`version\` text NOT NULL, + \`share_url\` text, + \`summary_additions\` integer, + \`summary_deletions\` integer, + \`summary_files\` integer, + \`summary_diffs\` text, + \`metadata\` text, + \`cost\` real DEFAULT 0 NOT NULL, + \`tokens_input\` integer DEFAULT 0 NOT NULL, + \`tokens_output\` integer DEFAULT 0 NOT NULL, + \`tokens_reasoning\` integer DEFAULT 0 NOT NULL, + \`tokens_cache_read\` integer DEFAULT 0 NOT NULL, + \`tokens_cache_write\` integer DEFAULT 0 NOT NULL, + \`revert\` text, + \`permission\` text, + \`agent\` text, + \`model\` text, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + \`time_compacting\` integer, + \`time_archived\` integer, + CONSTRAINT \`fk_session_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`todo\` ( + \`session_id\` text NOT NULL, + \`content\` text NOT NULL, + \`status\` text NOT NULL, + \`priority\` text NOT NULL, + \`position\` integer NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + CONSTRAINT \`todo_pk\` PRIMARY KEY(\`session_id\`, \`position\`), + CONSTRAINT \`fk_todo_session_id_session_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(` + CREATE TABLE \`session_share\` ( + \`session_id\` text PRIMARY KEY, + \`id\` text NOT NULL, + \`secret\` text NOT NULL, + \`url\` text NOT NULL, + \`time_created\` integer NOT NULL, + \`time_updated\` integer NOT NULL, + CONSTRAINT \`fk_session_share_session_id_session_id_fk\` FOREIGN KEY (\`session_id\`) REFERENCES \`session\`(\`id\`) ON DELETE CASCADE + ); + `) + yield* tx.run(`CREATE UNIQUE INDEX \`event_aggregate_seq_idx\` ON \`event\` (\`aggregate_id\`,\`seq\`);`) + yield* tx.run(`CREATE INDEX \`event_aggregate_type_seq_idx\` ON \`event\` (\`aggregate_id\`,\`type\`,\`seq\`);`) + yield* tx.run( + `CREATE UNIQUE INDEX \`permission_project_action_resource_idx\` ON \`permission\` (\`project_id\`,\`action\`,\`resource\`);`, + ) + yield* tx.run( + `CREATE INDEX \`message_session_time_created_id_idx\` ON \`message\` (\`session_id\`,\`time_created\`,\`id\`);`, + ) + yield* tx.run(`CREATE INDEX \`part_message_id_id_idx\` ON \`part\` (\`message_id\`,\`id\`);`) + yield* tx.run(`CREATE INDEX \`part_session_idx\` ON \`part\` (\`session_id\`);`) + yield* tx.run( + `CREATE INDEX \`session_input_session_pending_delivery_seq_idx\` ON \`session_input\` (\`session_id\`,\`promoted_seq\`,\`delivery\`,\`admitted_seq\`);`, + ) + yield* tx.run( + `CREATE UNIQUE INDEX \`session_input_session_admitted_seq_idx\` ON \`session_input\` (\`session_id\`,\`admitted_seq\`);`, + ) + yield* tx.run( + `CREATE UNIQUE INDEX \`session_input_session_promoted_seq_idx\` ON \`session_input\` (\`session_id\`,\`promoted_seq\`);`, + ) + yield* tx.run( + `CREATE UNIQUE INDEX \`session_message_session_seq_idx\` ON \`session_message\` (\`session_id\`,\`seq\`);`, + ) + yield* tx.run( + `CREATE INDEX \`session_message_session_type_seq_idx\` ON \`session_message\` (\`session_id\`,\`type\`,\`seq\`);`, + ) + yield* tx.run( + `CREATE INDEX \`session_message_session_time_created_id_idx\` ON \`session_message\` (\`session_id\`,\`time_created\`,\`id\`);`, + ) + yield* tx.run(`CREATE INDEX \`session_message_time_created_idx\` ON \`session_message\` (\`time_created\`);`) + yield* tx.run(`CREATE INDEX \`session_project_idx\` ON \`session\` (\`project_id\`);`) + yield* tx.run(`CREATE INDEX \`session_workspace_idx\` ON \`session\` (\`workspace_id\`);`) + yield* tx.run(`CREATE INDEX \`session_parent_idx\` ON \`session\` (\`parent_id\`);`) + yield* tx.run(`CREATE INDEX \`todo_session_idx\` ON \`todo\` (\`session_id\`);`) + }) + }, +} satisfies Omit diff --git a/packages/core/src/integration.ts b/packages/core/src/integration.ts new file mode 100644 index 0000000000..a4bb3fd58e --- /dev/null +++ b/packages/core/src/integration.ts @@ -0,0 +1,521 @@ +export * as Integration from "./integration" + +import { Cause, Clock, Context, Duration, Effect, Exit, Layer, Schedule, Schema, Scope, SynchronizedRef } from "effect" +import { castDraft, enableMapSet, type Draft } from "immer" +import { Credential } from "./credential" +import { IntegrationSchema } from "./integration/schema" +import { withStatics } from "./schema" +import { State } from "./state" +import { Identifier } from "./util/identifier" +import { EventV2 } from "./event" +import { IntegrationConnection } from "./integration/connection" + +export const ID = IntegrationSchema.ID +export type ID = IntegrationSchema.ID + +export const MethodID = IntegrationSchema.MethodID +export type MethodID = IntegrationSchema.MethodID + +export const AttemptID = Schema.String.pipe( + Schema.brand("Integration.AttemptID"), + withStatics((schema) => ({ create: () => schema.make("con_" + Identifier.ascending()) })), +) +export type AttemptID = typeof AttemptID.Type + +export const When = Schema.Struct({ + key: Schema.String, + op: Schema.Literals(["eq", "neq"]), + value: Schema.String, +}).annotate({ identifier: "Integration.When" }) +export type When = typeof When.Type + +export class TextPrompt extends Schema.Class("Integration.TextPrompt")({ + type: Schema.Literal("text"), + key: Schema.String, + message: Schema.String, + placeholder: Schema.optional(Schema.String), + when: Schema.optional(When), +}) {} + +export class SelectPrompt extends Schema.Class("Integration.SelectPrompt")({ + type: Schema.Literal("select"), + key: Schema.String, + message: Schema.String, + options: Schema.Array( + Schema.Struct({ + label: Schema.String, + value: Schema.String, + hint: Schema.optional(Schema.String), + }), + ), + when: Schema.optional(When), +}) {} + +export const Prompt = Schema.Union([TextPrompt, SelectPrompt]).pipe(Schema.toTaggedUnion("type")) +export type Prompt = typeof Prompt.Type + +export class OAuthMethod extends Schema.Class("Integration.OAuthMethod")({ + id: MethodID, + type: Schema.Literal("oauth"), + label: Schema.String, + prompts: Schema.optional(Schema.Array(Prompt)), +}) {} + +export class KeyMethod extends Schema.Class("Integration.KeyMethod")({ + type: Schema.Literal("key"), + label: Schema.optional(Schema.String), +}) {} + +export class EnvMethod extends Schema.Class("Integration.EnvMethod")({ + type: Schema.Literal("env"), + names: Schema.Array(Schema.String), +}) {} + +export const Method = Schema.Union([OAuthMethod, KeyMethod, EnvMethod]).pipe(Schema.toTaggedUnion("type")) +export type Method = typeof Method.Type + +export class Info extends Schema.Class("Integration.Info")({ + id: ID, + name: Schema.String, + methods: Schema.Array(Method), + connections: Schema.Array(IntegrationConnection.Info), +}) {} + +export type Inputs = Readonly<{ [key: string]: string }> + +export type OAuthAuthorization = { + readonly url: string + readonly instructions: string +} & ( + | { + readonly mode: "auto" + readonly callback: Effect.Effect + } + | { + readonly mode: "code" + readonly callback: (code: string) => Effect.Effect + } +) + +export interface OAuthImplementation { + readonly integrationID: ID + readonly method: OAuthMethod + readonly authorize: (inputs: Inputs) => Effect.Effect + readonly refresh?: (credential: Credential.OAuth) => Effect.Effect +} + +export interface KeyImplementation { + readonly integrationID: ID + readonly method: KeyMethod +} + +export interface EnvImplementation { + readonly integrationID: ID + readonly method: EnvMethod +} + +export type Implementation = OAuthImplementation | KeyImplementation | EnvImplementation + +function isOAuthImplementation(implementation: Implementation): implementation is OAuthImplementation { + return implementation.method.type === "oauth" +} + +export class Attempt extends Schema.Class("Integration.Attempt")({ + attemptID: AttemptID, + url: Schema.String, + instructions: Schema.String, + mode: Schema.Literals(["auto", "code"]), + time: Schema.Struct({ + created: Schema.Number, + expires: Schema.Number, + }), +}) {} + +const Time = Schema.Struct({ + created: Schema.Number, + expires: Schema.Number, +}) + +export const AttemptStatus = Schema.Union([ + Schema.Struct({ status: Schema.Literal("pending"), time: Time }), + Schema.Struct({ status: Schema.Literal("complete"), time: Time }), + Schema.Struct({ status: Schema.Literal("failed"), message: Schema.String, time: Time }), + Schema.Struct({ status: Schema.Literal("expired"), time: Time }), +]).pipe(Schema.toTaggedUnion("status")) +export type AttemptStatus = typeof AttemptStatus.Type + +export class CodeRequiredError extends Schema.TaggedErrorClass()("Integration.CodeRequired", { + attemptID: AttemptID, +}) {} + +export class AuthorizationError extends Schema.TaggedErrorClass()("Integration.Authorization", { + cause: Schema.Defect, +}) {} + +export type Error = CodeRequiredError | AuthorizationError + +export const Event = { + Updated: EventV2.define({ + type: "integration.updated", + schema: {}, + }), +} + +export type Ref = { + id: ID + name: string +} + +type Entry = { + ref: Ref + methods: Method[] + implementations: Map +} + +type Data = { + integrations: Map +} + +export type Editor = { + list: () => readonly Ref[] + get: (id: ID) => Ref | undefined + update: (id: ID, update: (integration: Draft) => void) => void + remove: (id: ID) => void + method: { + list: (integrationID: ID) => readonly Method[] + update: (implementation: Implementation) => void + remove: (integrationID: ID, method: Method) => void + } +} + +export interface Interface { + /** Registers a scoped transform over the integration registry. */ + readonly transform: State.Interface["transform"] + /** Registers and immediately applies a scoped integration registry update. */ + readonly update: State.Interface["update"] + /** Returns one integration with its methods and current connections. */ + readonly get: (id: ID) => Effect.Effect + /** Returns all integrations with their methods and current connections. */ + readonly list: () => Effect.Effect + readonly connect: { + /** Runs a key method and stores the resulting credential. */ + readonly key: (input: { + /** Integration receiving the credential. */ + readonly integrationID: ID + /** Secret entered by the user. */ + readonly key: string + /** User-facing label for the stored credential. */ + readonly label?: string + }) => Effect.Effect + /** Starts a stateful OAuth attempt. */ + readonly oauth: (input: { + /** Integration being authenticated. */ + readonly integrationID: ID + /** OAuth method selected by the caller. */ + readonly methodID: MethodID + /** Answers to the method's optional prompts. */ + readonly inputs: Inputs + /** User-facing label for the credential created on completion. */ + readonly label?: string + }) => Effect.Effect + } + readonly attempt: { + /** Returns the current state of an OAuth attempt. */ + readonly status: (attemptID: AttemptID) => Effect.Effect + /** Completes the attempt and stores its credential. */ + readonly complete: (input: { + /** Opaque handle returned by `oauth`. */ + readonly attemptID: AttemptID + /** Authorization code required by attempts in code mode. */ + readonly code?: string + }) => Effect.Effect + /** Cancels an attempt and releases its resources. */ + readonly cancel: (attemptID: AttemptID) => Effect.Effect + } +} + +export class Service extends Context.Service()("@opencode/v2/Integration") {} + +enableMapSet() + +const attemptLifetime = Duration.toMillis(Duration.minutes(10)) +const terminalRetention = Duration.toMillis(Duration.minutes(1)) +const scrubInterval = Duration.seconds(30) + +type AttemptTime = { created: number; expires: number } +type PendingAttempt = { + status: "pending" + completing: boolean + authorization: OAuthAuthorization + integrationID: ID + methodID: MethodID + label?: string + scope: Scope.Closeable + time: AttemptTime +} +type TerminalAttempt = { + status: "complete" | "failed" | "expired" + message?: string + removeAt: number + time: AttemptTime +} +type AttemptEntry = PendingAttempt | TerminalAttempt + +export const locationLayer = Layer.effect( + Service, + Effect.gen(function* () { + const credentials = yield* Credential.Service + const events = yield* EventV2.Service + const scope = yield* Scope.Scope + const attempts = SynchronizedRef.makeUnsafe(new Map()) + const state = State.create({ + initial: () => ({ integrations: new Map() }), + editor: (draft) => ({ + list: () => Array.from(draft.integrations.values(), (entry) => entry.ref) as Ref[], + get: (id) => draft.integrations.get(id)?.ref as Ref | undefined, + update: (id, update) => { + const current = + draft.integrations.get(id) ?? + castDraft({ ref: { id, name: id } as Ref, methods: [], implementations: new Map() }) + if (!draft.integrations.has(id)) draft.integrations.set(id, current) + update(current.ref) + current.ref.id = id + }, + remove: (id) => draft.integrations.delete(id), + method: { + list: (integrationID) => (draft.integrations.get(integrationID)?.methods as Method[] | undefined) ?? [], + update: (implementation) => { + const current = + draft.integrations.get(implementation.integrationID) ?? + castDraft({ + ref: { + id: implementation.integrationID, + name: implementation.integrationID, + } as Ref, + methods: [], + implementations: new Map(), + }) + if (!draft.integrations.has(implementation.integrationID)) { + draft.integrations.set(implementation.integrationID, current) + } + const index = current.methods.findIndex((method) => { + if (method.type !== implementation.method.type) return false + if (method.type !== "oauth" || implementation.method.type !== "oauth") return true + return method.id === implementation.method.id + }) + if (index === -1) current.methods.push(castDraft(implementation.method)) + else current.methods[index] = castDraft(implementation.method) + if (isOAuthImplementation(implementation)) { + current.implementations.set(implementation.method.id, castDraft(implementation)) + } + }, + remove: (integrationID, method) => { + const current = draft.integrations.get(integrationID) + if (!current) return + const index = current.methods.findIndex((candidate) => { + if (candidate.type !== method.type) return false + if (candidate.type !== "oauth" || method.type !== "oauth") return true + return candidate.id === method.id + }) + if (index !== -1) current.methods.splice(index, 1) + if (method.type === "oauth") current.implementations.delete(method.id) + }, + }, + }), + finalize: () => events.publish(Event.Updated, {}).pipe(Effect.asVoid), + }) + + const connections = (entry: Entry, saved: readonly Credential.Stored[]): IntegrationConnection.Info[] => { + const connected = saved.map( + (credential) => + new IntegrationConnection.CredentialInfo({ type: "credential", id: credential.id, label: credential.label }), + ) + const detected = entry.methods + .filter((method) => method.type === "env") + .flatMap((method) => method.names.filter((name) => process.env[name])) + .map( + (name, index) => + new IntegrationConnection.EnvInfo({ + type: "env", + name, + }), + ) + return [...connected, ...detected] + } + + const project = (entry: Entry, saved: readonly Credential.Stored[]) => + new Info({ + id: entry.ref.id, + name: entry.ref.name, + methods: entry.methods, + connections: connections(entry, saved), + }) + + const authorize = (effect: Effect.Effect) => + effect.pipe(Effect.mapError((cause) => new AuthorizationError({ cause }))) + + const close = (attemptScope: Scope.Closeable) => + Scope.close(attemptScope, Exit.void).pipe(Effect.forkIn(scope, { startImmediately: true }), Effect.asVoid) + + const message = (cause: Cause.Cause) => { + const error = Cause.squash(cause) + return error instanceof Error ? error.message : String(error) + } + + const settle = Effect.fnUntraced(function* (attemptID: AttemptID, exit: Exit.Exit) { + const now = yield* Clock.currentTimeMillis + const result = yield* SynchronizedRef.modify(attempts, (current) => { + const attempt = current.get(attemptID) + if (!attempt || attempt.status !== "pending") return [undefined, current] + const terminal: TerminalAttempt = Exit.isSuccess(exit) + ? { status: "complete", time: attempt.time, removeAt: now + terminalRetention } + : { status: "failed", message: message(exit.cause), time: attempt.time, removeAt: now + terminalRetention } + return [attempt, new Map(current).set(attemptID, terminal)] + }) + if (!result) return + if (Exit.isSuccess(exit)) { + yield* credentials.create({ + integrationID: result.integrationID, + label: result.label, + value: + exit.value.type === "oauth" + ? new Credential.OAuth({ ...exit.value, methodID: result.methodID }) + : exit.value, + }) + } + yield* close(result.scope) + }) + + const scrub = Effect.fnUntraced(function* () { + const now = yield* Clock.currentTimeMillis + const expired = yield* SynchronizedRef.modify(attempts, (current) => { + const next = new Map(current) + const scopes: Scope.Closeable[] = [] + for (const [id, attempt] of current) { + if (attempt.status === "pending" && attempt.time.expires <= now) { + scopes.push(attempt.scope) + next.set(id, { status: "expired", time: attempt.time, removeAt: now + terminalRetention }) + continue + } + if (attempt.status !== "pending" && attempt.removeAt <= now) next.delete(id) + } + return [scopes, next] + }) + yield* Effect.forEach(expired, close, { discard: true }) + }) + + yield* scrub().pipe(Effect.repeat(Schedule.spaced(scrubInterval)), Effect.forkIn(scope)) + + return Service.of({ + transform: state.transform, + update: state.update, + get: Effect.fn("Integration.get")(function* (id) { + const entry = state.get().integrations.get(id) + if (!entry) return undefined + return project(entry, yield* credentials.list(id)) + }), + list: Effect.fn("Integration.list")(function* () { + return (yield* Effect.forEach(state.get().integrations.values(), (entry) => + Effect.gen(function* () { + return project(entry, yield* credentials.list(entry.ref.id)) + }), + )).toSorted((a, b) => a.name.localeCompare(b.name)) + }), + connect: { + key: Effect.fn("Integration.connect.key")(function* (input) { + const method = state + .get() + .integrations.get(input.integrationID) + ?.methods.some((method) => method.type === "key") + if (!method) return yield* Effect.die(`Key method not found: ${input.integrationID}`) + yield* credentials.create({ + integrationID: input.integrationID, + label: input.label, + value: new Credential.Key({ type: "key", key: input.key }), + }) + }), + oauth: Effect.fn("Integration.connect.oauth")(function* (input) { + const method = state.get().integrations.get(input.integrationID)?.implementations.get(input.methodID) + if (!method) { + return yield* Effect.die(`OAuth method not found: ${input.integrationID}/${input.methodID}`) + } + const attemptScope = yield* Scope.fork(scope) + const authorization = yield* authorize(method.authorize(input.inputs)).pipe( + Scope.provide(attemptScope), + Effect.onExit((exit) => (Exit.isFailure(exit) ? Scope.close(attemptScope, exit) : Effect.void)), + ) + const id = AttemptID.create() + const created = yield* Clock.currentTimeMillis + const time = { created, expires: created + attemptLifetime } + yield* SynchronizedRef.update(attempts, (current) => + new Map(current).set(id, { + status: "pending", + completing: authorization.mode === "auto", + authorization, + integrationID: input.integrationID, + methodID: input.methodID, + label: input.label, + scope: attemptScope, + time, + }), + ) + if (authorization.mode === "auto") { + yield* authorization.callback.pipe( + Effect.exit, + Effect.flatMap((exit) => settle(id, exit)), + Effect.forkIn(attemptScope, { startImmediately: true }), + ) + } + return new Attempt({ + attemptID: id, + url: authorization.url, + instructions: authorization.instructions, + mode: authorization.mode, + time, + }) + }), + }, + attempt: { + status: Effect.fn("Integration.attempt.status")(function* (attemptID) { + const attempt = (yield* SynchronizedRef.get(attempts)).get(attemptID) + if (!attempt) return yield* Effect.die(`OAuth attempt not found: ${attemptID}`) + if (attempt.status === "failed") { + return { status: attempt.status, message: attempt.message ?? "Authorization failed", time: attempt.time } + } + return { status: attempt.status, time: attempt.time } + }), + complete: Effect.fn("Integration.attempt.complete")(function* (input) { + const attempt = yield* SynchronizedRef.modify(attempts, (current) => { + const match = current.get(input.attemptID) + if (!match || match.status !== "pending" || match.completing) return [match, current] + if (match.authorization.mode === "code" && input.code === undefined) return [match, current] + return [match, new Map(current).set(input.attemptID, { ...match, completing: true })] + }) + if (!attempt) return yield* Effect.die(`OAuth attempt not found: ${input.attemptID}`) + if (attempt.status !== "pending") return + if (attempt.authorization.mode === "code" && input.code === undefined) { + return yield* new CodeRequiredError({ attemptID: input.attemptID }) + } + if (attempt.completing) return yield* Effect.die(`OAuth attempt already completing: ${input.attemptID}`) + const callback = + attempt.authorization.mode === "auto" + ? attempt.authorization.callback + : attempt.authorization.callback(input.code as string) + const exit = yield* authorize(callback).pipe(Effect.exit) + yield* settle(input.attemptID, exit) + if (Exit.isFailure(exit)) return yield* exit + }), + cancel: Effect.fn("Integration.attempt.cancel")(function* (attemptID) { + const attempt = yield* SynchronizedRef.modify(attempts, (current) => { + const match = current.get(attemptID) + if (!match || match.status !== "pending") return [undefined, current] + const next = new Map(current) + next.delete(attemptID) + return [match, next] + }) + if (attempt) yield* Scope.close(attempt.scope, Exit.void) + }), + }, + }) + }), +) diff --git a/packages/core/src/integration/connection.ts b/packages/core/src/integration/connection.ts new file mode 100644 index 0000000000..a190ebf78c --- /dev/null +++ b/packages/core/src/integration/connection.ts @@ -0,0 +1,20 @@ +export * as IntegrationConnection from "./connection" + +import { Schema } from "effect" +import { Credential } from "../credential" + +export class CredentialInfo extends Schema.Class("Connection.CredentialInfo")({ + type: Schema.Literal("credential"), + id: Credential.ID, + label: Schema.String, +}) {} + +export class EnvInfo extends Schema.Class("Connection.EnvInfo")({ + type: Schema.Literal("env"), + name: Schema.String, +}) {} + +export const Info = Schema.Union([CredentialInfo, EnvInfo]) + .pipe(Schema.toTaggedUnion("type")) + .annotate({ identifier: "Connection.Info" }) +export type Info = typeof Info.Type diff --git a/packages/core/src/integration/schema.ts b/packages/core/src/integration/schema.ts new file mode 100644 index 0000000000..472f4e0609 --- /dev/null +++ b/packages/core/src/integration/schema.ts @@ -0,0 +1,9 @@ +export * as IntegrationSchema from "./schema" + +import { Schema } from "effect" + +export const ID = Schema.String.pipe(Schema.brand("Integration.ID")) +export type ID = typeof ID.Type + +export const MethodID = Schema.String.pipe(Schema.brand("Integration.MethodID")) +export type MethodID = typeof MethodID.Type diff --git a/packages/core/src/location-layer.ts b/packages/core/src/location-layer.ts index 39a3948a59..cdaefe2cff 100644 --- a/packages/core/src/location-layer.ts +++ b/packages/core/src/location-layer.ts @@ -4,16 +4,19 @@ import { Policy } from "./policy" import { Config } from "./config" import { PluginV2 } from "./plugin" import { Catalog } from "./catalog" -import { Connector } from "./connector" +import { Integration } from "./integration" import { CommandV2 } from "./command" import { AgentV2 } from "./agent" import { PluginBoot } from "./plugin/boot" import { Project } from "./project" +import { ProjectCopy } from "./project/copy" +import { ProjectDirectories } from "./project/directories" import { EventV2 } from "./event" import { Credential } from "./credential" import { Npm } from "./npm" import { ModelsDev } from "./models-dev" import { FSUtil } from "./fs-util" +import { Git } from "./git" import { Global } from "./global" import { Database } from "./database/database" import { PermissionV2 } from "./permission" @@ -59,10 +62,11 @@ export class LocationServiceMap extends LayerMap.Service()(" Reference.locationLayer, PluginV2.locationLayer, Catalog.locationLayer, - Connector.locationLayer, + Integration.locationLayer, CommandV2.locationLayer, AgentV2.locationLayer, PluginBoot.locationLayer, + ProjectCopy.locationLayer, FileSystem.locationLayer, Watcher.locationLayer, Pty.locationLayer, @@ -98,6 +102,11 @@ export class LocationServiceMap extends LayerMap.Service()(" Layer.provide(skillGuidance), Layer.provide(referenceGuidance), ) + + // Kick off a background project copy refresh to update locations now that we + // have a location + const projectCopyRefresh = Layer.effectDiscard(ProjectCopy.refreshAfterBoot).pipe(Layer.provide(services)) + return Layer.mergeAll( boot, services, @@ -110,6 +119,7 @@ export class LocationServiceMap extends LayerMap.Service()(" runner, builtInTools, referenceGuidance, + projectCopyRefresh, ).pipe(Layer.fresh) }, idleTimeToLive: "60 minutes", @@ -120,10 +130,12 @@ export class LocationServiceMap extends LayerMap.Service()(" Npm.defaultLayer, ModelsDev.defaultLayer, FSUtil.defaultLayer, + Git.defaultLayer, AppProcess.defaultLayer, Global.defaultLayer, Ripgrep.defaultLayer, Database.defaultLayer, + ProjectDirectories.defaultLayer, SessionStore.layer.pipe(Layer.provide(Database.defaultLayer)), PermissionSaved.defaultLayer, RepositoryCache.defaultLayer, diff --git a/packages/core/src/plugin/boot.ts b/packages/core/src/plugin/boot.ts index 89b6a5c2bf..dac25a2489 100644 --- a/packages/core/src/plugin/boot.ts +++ b/packages/core/src/plugin/boot.ts @@ -2,7 +2,7 @@ export * as PluginBoot from "./boot" import { Context, Deferred, Effect, Layer } from "effect" import { Credential } from "../credential" -import { Connector } from "../connector" +import { Integration } from "../integration" import { AgentV2 } from "../agent" import { Catalog } from "../catalog" import { CommandV2 } from "../command" @@ -34,7 +34,7 @@ type Plugin = { | Catalog.Service | CommandV2.Service | Credential.Service - | Connector.Service + | Integration.Service | AgentV2.Service | Npm.Service | EventV2.Service @@ -62,7 +62,7 @@ export const layer = Layer.effect( const commands = yield* CommandV2.Service const plugin = yield* PluginV2.Service const credentials = yield* Credential.Service - const connectors = yield* Connector.Service + const integrations = yield* Integration.Service const agents = yield* AgentV2.Service const config = yield* Config.Service const location = yield* Location.Service @@ -82,7 +82,7 @@ export const layer = Layer.effect( Effect.provideService(Catalog.Service, catalog), Effect.provideService(CommandV2.Service, commands), Effect.provideService(Credential.Service, credentials), - Effect.provideService(Connector.Service, connectors), + Effect.provideService(Integration.Service, integrations), Effect.provideService(AgentV2.Service, agents), Effect.provideService(Config.Service, config), Effect.provideService(Location.Service, location), @@ -127,7 +127,7 @@ export const layer = Layer.effect( ) export const locationLayer = layer.pipe( - Layer.provideMerge(Connector.locationLayer), + Layer.provideMerge(Integration.locationLayer), Layer.provideMerge(Catalog.locationLayer), Layer.provideMerge(CommandV2.locationLayer), Layer.provideMerge(Config.locationLayer), diff --git a/packages/core/src/plugin/models-dev.ts b/packages/core/src/plugin/models-dev.ts index b406a1aaf0..e34c11f788 100644 --- a/packages/core/src/plugin/models-dev.ts +++ b/packages/core/src/plugin/models-dev.ts @@ -1,7 +1,6 @@ import { DateTime, Effect, Scope, Stream } from "effect" import { Catalog } from "../catalog" -import { Connector } from "../connector" -import { Credential } from "../credential" +import { Integration } from "../integration" import { EventV2 } from "../event" import { ModelV2 } from "../model" import { ModelRequest } from "../model-request" @@ -56,27 +55,31 @@ export const ModelsDevPlugin = PluginV2.define({ id: PluginV2.ID.make("models-dev"), effect: Effect.gen(function* () { const catalog = yield* Catalog.Service - const connectors = yield* Connector.Service + const integrations = yield* Integration.Service const modelsDev = yield* ModelsDev.Service const events = yield* EventV2.Service const scope = yield* Scope.Scope const transform = yield* catalog.transform() - const connectorTransform = yield* connectors.transform() + const integrationTransform = yield* integrations.transform() const refresh = Effect.fn("ModelsDevPlugin.refresh")(function* () { const data = yield* modelsDev.get() - yield* connectorTransform((connectors) => { + yield* integrationTransform((integrations) => { for (const item of Object.values(data)) { if (item.env.length === 0) continue - const connectorID = Connector.ID.make(item.id) - connectors.update(connectorID, (connector) => (connector.name = item.name)) - connectors.method.update({ - connectorID, - method: new Connector.KeyMethod({ - id: Connector.MethodID.make("api-key"), + const integrationID = Integration.ID.make(item.id) + integrations.update(integrationID, (integration) => (integration.name = item.name)) + integrations.method.update({ + integrationID, + method: new Integration.KeyMethod({ type: "key", - label: "API Key", }), - authorize: (key: string) => Effect.succeed(new Credential.Key({ type: "key", key })), + }) + integrations.method.update({ + integrationID, + method: new Integration.EnvMethod({ + type: "env", + names: [...item.env], + }), }) } }) diff --git a/packages/core/src/plugin/provider/openai-auth.ts b/packages/core/src/plugin/provider/openai-auth.ts index c760664bc1..787e33194a 100644 --- a/packages/core/src/plugin/provider/openai-auth.ts +++ b/packages/core/src/plugin/provider/openai-auth.ts @@ -1,6 +1,6 @@ import { createServer } from "node:http" import { Deferred, Effect } from "effect" -import { Connector } from "../../connector" +import { Integration } from "../../integration" import { Credential } from "../../credential" import { InstallationVersion } from "../../installation/version" @@ -27,10 +27,13 @@ type Claims = { "https://api.openai.com/auth"?: { chatgpt_account_id?: string } } +const browserMethodID = Integration.MethodID.make("chatgpt-browser") +const headlessMethodID = Integration.MethodID.make("chatgpt-headless") + export const browser = { - connectorID: Connector.ID.make("openai"), - method: new Connector.OAuthMethod({ - id: Connector.MethodID.make("chatgpt-browser"), + integrationID: Integration.ID.make("openai"), + method: new Integration.OAuthMethod({ + id: browserMethodID, type: "oauth", label: "ChatGPT Pro/Plus (browser)", }), @@ -77,17 +80,17 @@ export const browser = { instructions: "Complete authorization in your browser. This window will close automatically.", callback: Deferred.await(code).pipe( Effect.flatMap((value) => exchange(value, redirect, pkce)), - Effect.map(credential), + Effect.map((tokens) => credential(browserMethodID, tokens)), ), } }), refresh: (value) => refresh(value), -} satisfies Connector.OAuthImplementation +} satisfies Integration.OAuthImplementation export const headless = { - connectorID: Connector.ID.make("openai"), - method: new Connector.OAuthMethod({ - id: Connector.MethodID.make("chatgpt-headless"), + integrationID: Integration.ID.make("openai"), + method: new Integration.OAuthMethod({ + id: headlessMethodID, type: "oauth", label: "ChatGPT Pro/Plus (headless)", }), @@ -124,6 +127,7 @@ export const headless = { code_verifier: string } return credential( + headlessMethodID, yield* exchange(data.authorization_code, `${issuer}/deviceauth/callback`, { verifier: data.code_verifier, challenge: "", @@ -139,7 +143,7 @@ export const headless = { } }), refresh: (value) => refresh(value), -} satisfies Connector.OAuthImplementation +} satisfies Integration.OAuthImplementation function headers(contentType: string) { return { "Content-Type": contentType, "User-Agent": `opencode/${InstallationVersion}` } @@ -170,7 +174,7 @@ function refresh(value: Credential.OAuth) { }).toString(), }).pipe( Effect.map((tokens) => { - const next = credential(tokens) + const next = credential(value.methodID, tokens) return new Credential.OAuth({ ...next, metadata: next.metadata ?? value.metadata, @@ -190,10 +194,11 @@ function request(url: string, init: RequestInit) { }) } -function credential(tokens: TokenResponse) { +function credential(methodID: Integration.MethodID, tokens: TokenResponse) { const accountID = extractAccountID(tokens) return new Credential.OAuth({ type: "oauth", + methodID, refresh: tokens.refresh_token, access: tokens.access_token, expires: Date.now() + (tokens.expires_in ?? 3600) * 1000, diff --git a/packages/core/src/plugin/provider/openai.ts b/packages/core/src/plugin/provider/openai.ts index 1142a39b4f..d58bd784f5 100644 --- a/packages/core/src/plugin/provider/openai.ts +++ b/packages/core/src/plugin/provider/openai.ts @@ -2,14 +2,14 @@ import { Effect } from "effect" import { ModelV2 } from "../../model" import { PluginV2 } from "../../plugin" import { ProviderV2 } from "../../provider" -import { Connector } from "../../connector" +import { Integration } from "../../integration" import { browser, headless } from "./openai-auth" export const OpenAIPlugin = PluginV2.define({ id: PluginV2.ID.make("openai"), effect: Effect.gen(function* () { - const connectors = yield* Connector.Service - yield* connectors.update((editor) => { + const integrations = yield* Integration.Service + yield* integrations.update((editor) => { editor.method.update(browser) editor.method.update(headless) }) diff --git a/packages/core/src/plugin/provider/snowflake-cortex.ts b/packages/core/src/plugin/provider/snowflake-cortex.ts index 8dcabf26b1..0971f3518d 100644 --- a/packages/core/src/plugin/provider/snowflake-cortex.ts +++ b/packages/core/src/plugin/provider/snowflake-cortex.ts @@ -70,14 +70,17 @@ export const SnowflakeCortexPlugin = PluginV2.define({ return { "aisdk.sdk": Effect.fn(function* (evt) { if (evt.model.providerID !== ProviderV2.ID.make("snowflake-cortex")) return - const pat = - process.env.SNOWFLAKE_CORTEX_PAT ?? (typeof evt.options.apiKey === "string" ? evt.options.apiKey : undefined) + const token = + process.env.SNOWFLAKE_CORTEX_TOKEN ?? + process.env.SNOWFLAKE_CORTEX_PAT ?? + (typeof evt.options.token === "string" ? evt.options.token : undefined) ?? + (typeof evt.options.apiKey === "string" ? evt.options.apiKey : undefined) const upstream = typeof evt.options.fetch === "function" ? (evt.options.fetch as FetchLike) : undefined if (evt.options.includeUsage !== false) evt.options.includeUsage = true const mod = yield* Effect.promise(() => import("@ai-sdk/openai-compatible")) evt.sdk = mod.createOpenAICompatible({ ...evt.options, - ...(pat ? { apiKey: pat } : {}), + ...(token ? { apiKey: token } : {}), fetch: cortexFetch(upstream) as typeof fetch, } as any) }), diff --git a/packages/core/src/project.ts b/packages/core/src/project.ts index a7589c1219..c439da0fdb 100644 --- a/packages/core/src/project.ts +++ b/packages/core/src/project.ts @@ -2,60 +2,41 @@ export * as ProjectV2 from "./project" export * as Project from "./project" import { Context, Effect, Layer, Schema } from "effect" -import { asc, desc, eq } from "drizzle-orm" import path from "path" -import { AbsolutePath, withStatics } from "./schema" +import { AbsolutePath } from "./schema" import { FSUtil } from "./fs-util" -import { Database } from "./database/database" import { Git } from "./git" import { LayerNode } from "./effect/layer-node" import { Hash } from "./util/hash" -import { ProjectDirectoryTable } from "./project/sql" +import { ProjectDirectories } from "./project/directories" +import { ProjectSchema } from "./project/schema" -export const ID = Schema.String.pipe( - Schema.brand("Project.ID"), - withStatics((schema) => ({ - global: schema.make("global"), - })), -) -export type ID = typeof ID.Type +export const ID = ProjectSchema.ID +export type ID = ProjectSchema.ID -export const Vcs = Schema.Union([ - Schema.Struct({ - type: Schema.Literal("git"), - store: AbsolutePath, - }), -]) -export type Vcs = typeof Vcs.Type +export const Vcs = ProjectSchema.Vcs +export type Vcs = ProjectSchema.Vcs export class Info extends Schema.Class("Project.Info")({ id: ID, }) {} -export const DirectoriesInput = Schema.Struct({ - projectID: ID, -}).annotate({ identifier: "Project.DirectoriesInput" }) +export const DirectoriesInput = ProjectDirectories.ListInput export type DirectoriesInput = typeof DirectoriesInput.Type -export const Directories = Schema.Array( - Schema.Struct({ - directory: AbsolutePath, - type: Schema.Literals(["main", "root", "git_worktree"]), - }), -).annotate({ identifier: "Project.Directories" }) +export const Directories = ProjectDirectories.ListOutput export type Directories = typeof Directories.Type +export interface Resolved { + readonly previous?: ID + readonly id: ID + readonly directory: AbsolutePath + readonly vcs?: Vcs +} + export interface Interface { readonly directories: (input: DirectoriesInput) => Effect.Effect - readonly resolve: (input: AbsolutePath) => Effect.Effect< - { - previous?: ID - id: ID - directory: AbsolutePath - vcs?: Vcs - }, - never - > + readonly resolve: (input: AbsolutePath) => Effect.Effect /** * Temporary bridge method for writing the resolved project ID to the repo-local cache. * @@ -73,19 +54,12 @@ export class Service extends Context.Service()("@opencode/Pr export const layer = Layer.effect( Service, Effect.gen(function* () { - const db = (yield* Database.Service).db const fs = yield* FSUtil.Service const git = yield* Git.Service + const projectDirectories = yield* ProjectDirectories.Service const directories = Effect.fn("Project.directories")(function* (input: DirectoriesInput) { - const rows = yield* db - .select({ directory: ProjectDirectoryTable.directory, type: ProjectDirectoryTable.type }) - .from(ProjectDirectoryTable) - .where(eq(ProjectDirectoryTable.project_id, input.projectID)) - .orderBy(desc(ProjectDirectoryTable.time_created), asc(ProjectDirectoryTable.directory)) - .all() - .pipe(Effect.orDie) - return rows.map((row) => ({ directory: AbsolutePath.make(row.directory), type: row.type })) + return yield* projectDirectories.list(input.projectID) }) const cached = Effect.fnUntraced(function* (dir: string) { @@ -156,8 +130,8 @@ export const layer = Layer.effect( ) export const defaultLayer = layer.pipe( - Layer.provide(Database.defaultLayer), Layer.provide(FSUtil.defaultLayer), Layer.provide(Git.defaultLayer), + Layer.provideMerge(ProjectDirectories.defaultLayer), ) -export const node = LayerNode.make(layer, [Database.node, FSUtil.node, Git.node]) +export const node = LayerNode.make(layer, [FSUtil.node, Git.node, ProjectDirectories.node]) diff --git a/packages/core/src/project/copy-strategies.ts b/packages/core/src/project/copy-strategies.ts index 3e67ea66d3..1199964f6c 100644 --- a/packages/core/src/project/copy-strategies.ts +++ b/packages/core/src/project/copy-strategies.ts @@ -1,20 +1,18 @@ import path from "path" import { Effect } from "effect" import { AbsolutePath } from "../schema" -import { FSUtil } from "../fs-util" import { Git } from "../git" -import { DirectoryUnavailableError, type Copy, type Strategy, type StrategyID } from "./copy" +import { DirectoryUnavailableError, StrategyID, type ListEntry, type Strategy } from "./copy" -export function makeStrategies(input: { +export function makeGitWorktreeStrategy(input: { git: Git.Interface - fs: FSUtil.Interface canonical: (directory: AbsolutePath) => Effect.Effect }) { const repo = (sourceDirectory: AbsolutePath) => ({ directory: sourceDirectory, store: sourceDirectory }) satisfies Git.Repo - const gitWorktree: Strategy = { - id: "git_worktree", + return { + id: StrategyID.make("git_worktree"), create: Effect.fn("ProjectCopy.GitWorktree.create")(function* (options) { yield* input.git.worktreeCreate({ repo: repo(options.sourceDirectory), directory: options.directory }) return { directory: yield* input.canonical(options.directory) } @@ -30,18 +28,11 @@ export function makeStrategies(input: { const core = path.basename(found.store) === ".git" ? path.dirname(found.store) : found.store const entries = yield* input.git.worktreeList(found) return yield* Effect.forEach(entries, (entry) => - entry === core - ? Effect.succeed(undefined) - : input.canonical(entry).pipe( - Effect.map((directory) => ({ directory })), - Effect.catchTag("ProjectCopy.DirectoryUnavailableError", () => Effect.succeed(undefined)), - ), - ).pipe(Effect.map((items) => items.filter((item): item is Copy => item !== undefined))) + input.canonical(entry).pipe( + Effect.map((directory) => ({ directory, type: entry === core ? "root" : "copy" }) as const), + Effect.catchTag("ProjectCopy.DirectoryUnavailableError", () => Effect.succeed(undefined)), + ), + ).pipe(Effect.map((items) => items.filter((item): item is ListEntry => item !== undefined))) }), - detect: Effect.fn("ProjectCopy.GitWorktree.detect")(function* (inputDirectory) { - return yield* input.fs.isFile(path.join(inputDirectory, ".git")) - }), - } - - return new Map([[gitWorktree.id, gitWorktree]]) + } satisfies Strategy } diff --git a/packages/core/src/project/copy.ts b/packages/core/src/project/copy.ts index de2beda981..670b0d2dcb 100644 --- a/packages/core/src/project/copy.ts +++ b/packages/core/src/project/copy.ts @@ -1,34 +1,29 @@ export * as ProjectCopy from "./copy" -import { and, eq, inArray } from "drizzle-orm" import { Context, Effect, Layer, Schema } from "effect" import path from "path" import { AbsolutePath } from "../schema" import { FSUtil } from "../fs-util" import { Git } from "../git" -import { Database } from "../database/database" -import { EventV2 } from "../event" import { LayerNode } from "../effect/layer-node" import { Project } from "../project" -import { ProjectDirectoryTable } from "./sql" -import { makeStrategies } from "./copy-strategies" +import { ProjectDirectories } from "./directories" +import { makeGitWorktreeStrategy } from "./copy-strategies" import { Slug } from "../util/slug" +import { EventV2 } from "../event" +import { Database } from "../database/database" +import { Location } from "../location" +import { PluginBoot } from "../plugin/boot" -export const StrategyID = Schema.Literal("git_worktree") +export const StrategyID = Schema.Trim.pipe(Schema.check(Schema.isNonEmpty()), Schema.brand("ProjectCopy.StrategyID")) export type StrategyID = typeof StrategyID.Type -export const DetectInput = Schema.Struct({ - directory: AbsolutePath, -}).annotate({ identifier: "ProjectCopy.DetectInput" }) -export type DetectInput = typeof DetectInput.Type - export const CreateInput = Schema.Struct({ projectID: Project.ID, strategy: StrategyID, sourceDirectory: AbsolutePath, directory: AbsolutePath, name: Schema.optional(Schema.String), - context: Schema.optional(Schema.String), }).annotate({ identifier: "ProjectCopy.CreateInput" }) export type CreateInput = typeof CreateInput.Type @@ -44,12 +39,22 @@ export const RefreshInput = Schema.Struct({ }).annotate({ identifier: "ProjectCopy.RefreshInput" }) export type RefreshInput = typeof RefreshInput.Type +export const RefreshResult = Schema.Struct({ + updated: Schema.Array(AbsolutePath), + removed: Schema.Array(AbsolutePath), +}).annotate({ identifier: "ProjectCopy.RefreshResult" }) +export type RefreshResult = typeof RefreshResult.Type + export const Copy = Schema.Struct({ directory: AbsolutePath, }).annotate({ identifier: "ProjectCopy.Copy" }) export type Copy = typeof Copy.Type -export type DirectoryType = "main" | "root" | StrategyID +export const ListEntry = Schema.Struct({ + directory: AbsolutePath, + type: Schema.Literals(["root", "copy"]), +}).annotate({ identifier: "ProjectCopy.ListEntry" }) +export type ListEntry = typeof ListEntry.Type export class SourceDirectoryNotFoundError extends Schema.TaggedErrorClass()( "ProjectCopy.SourceDirectoryNotFoundError", @@ -66,16 +71,27 @@ export class DirectoryUnavailableError extends Schema.TaggedErrorClass()( - "ProjectCopy.StrategyNotFoundError", +export class InvalidDirectoryError extends Schema.TaggedErrorClass()( + "ProjectCopy.InvalidDirectoryError", { directory: AbsolutePath }, ) {} +export class StrategyUnavailableError extends Schema.TaggedErrorClass()( + "ProjectCopy.StrategyUnavailableError", + { strategy: StrategyID }, +) {} + +export class DuplicateStrategyError extends Schema.TaggedErrorClass()( + "ProjectCopy.DuplicateStrategyError", + { strategy: StrategyID }, +) {} + export type Error = | SourceDirectoryNotFoundError | DestinationExistsError | DirectoryUnavailableError - | StrategyNotFoundError + | InvalidDirectoryError + | StrategyUnavailableError | Git.WorktreeError export interface Strategy { @@ -88,8 +104,7 @@ export interface Strategy { directory: AbsolutePath force: boolean }) => Effect.Effect - readonly list: (directory: AbsolutePath) => Effect.Effect - readonly detect: (directory: AbsolutePath) => Effect.Effect + readonly list: (directory: AbsolutePath) => Effect.Effect } export const Event = { @@ -100,21 +115,46 @@ export const Event = { } export interface Interface { - readonly detect: (input: DetectInput) => Effect.Effect + readonly register: (strategy: Strategy) => Effect.Effect readonly create: (input: CreateInput) => Effect.Effect readonly remove: (input: RemoveInput) => Effect.Effect - readonly refresh: (input: RefreshInput) => Effect.Effect + readonly refresh: (input: RefreshInput) => Effect.Effect } export class Service extends Context.Service()("@opencode/ProjectCopy") {} +export const refreshAfterBoot = Effect.gen(function* () { + const location = yield* Location.Service + const boot = yield* PluginBoot.Service + const copies = yield* Service + yield* Effect.gen(function* () { + yield* boot.wait() + yield* Effect.logInfo("project copy refresh started", { projectID: location.project.id }) + const result = yield* copies.refresh({ projectID: location.project.id }) + yield* Effect.logInfo("project copy refresh done", { + projectID: location.project.id, + updated: result.updated, + removed: result.removed, + }) + }).pipe( + Effect.catchCause((cause) => Effect.logWarning("project copy refresh failed", { cause })), + Effect.forkScoped, + Effect.asVoid, + ) +}) + export const layer = Layer.effect( Service, Effect.gen(function* () { const fs = yield* FSUtil.Service const git = yield* Git.Service - const events = yield* EventV2.Service + const directories = yield* ProjectDirectories.Service const db = (yield* Database.Service).db + const events = yield* EventV2.Service + + const changed = Effect.fnUntraced(function* (projectID: Project.ID, update: boolean) { + if (update) yield* events.publish(Event.Updated, { projectID }) + }) const canonical = Effect.fnUntraced(function* (input: AbsolutePath) { const resolved = AbsolutePath.make(FSUtil.resolve(input)) @@ -122,76 +162,34 @@ export const layer = Layer.effect( return resolved }) - const registry = makeStrategies({ git, fs, canonical }) + const registry = new Map() + + const register = Effect.fn("ProjectCopy.register")(function* (strategy: Strategy) { + if (registry.has(strategy.id)) return yield* new DuplicateStrategyError({ strategy: strategy.id }) + registry.set(strategy.id, strategy) + }) + + // Register default strategies + yield* register(makeGitWorktreeStrategy({ git, canonical })).pipe(Effect.orDie) + + const strategies = () => Array.from(registry.values()) const source = Effect.fnUntraced(function* (input: AbsolutePath, projectID: Project.ID) { const sourceDirectory = yield* canonical(input) - const row = yield* db - .select({ directory: ProjectDirectoryTable.directory }) - .from(ProjectDirectoryTable) - .where( - and(eq(ProjectDirectoryTable.project_id, projectID), eq(ProjectDirectoryTable.directory, sourceDirectory)), - ) - .get() - .pipe(Effect.orDie) - if (!row) return yield* new SourceDirectoryNotFoundError({ directory: sourceDirectory }) + if (!(yield* directories.contains({ projectID, directory: sourceDirectory }))) + return yield* new SourceDirectoryNotFoundError({ directory: sourceDirectory }) return sourceDirectory }) - const insert = Effect.fnUntraced(function* (projectID: Project.ID, copyDirectory: AbsolutePath, type: StrategyID) { - return yield* db - .transaction( - (tx) => - Effect.gen(function* () { - const row = yield* tx - .select({ directory: ProjectDirectoryTable.directory }) - .from(ProjectDirectoryTable) - .where( - and( - eq(ProjectDirectoryTable.project_id, projectID), - eq(ProjectDirectoryTable.directory, copyDirectory), - ), - ) - .get() - if (row) return false - yield* tx - .insert(ProjectDirectoryTable) - .values({ project_id: projectID, directory: copyDirectory, type }) - .run() - return true - }), - { behavior: "immediate" }, - ) - .pipe(Effect.orDie) - }) - - const removeStored = Effect.fnUntraced(function* (projectID: Project.ID, copyDirectory: AbsolutePath) { - return ( - (yield* db - .delete(ProjectDirectoryTable) - .where( - and(eq(ProjectDirectoryTable.project_id, projectID), eq(ProjectDirectoryTable.directory, copyDirectory)), - ) - .returning({ directory: ProjectDirectoryTable.directory }) - .get() - .pipe(Effect.orDie)) !== undefined - ) - }) - - const changed = Effect.fnUntraced(function* (projectID: Project.ID, update: boolean) { - if (update) yield* events.publish(Event.Updated, { projectID }) - }) - - const strategy = (id: StrategyID) => registry.get(id) as Strategy - - const detect = Effect.fn("ProjectCopy.detect")(function* (input: DetectInput) { - for (const strategy of registry.values()) { - if (yield* strategy.detect(input.directory)) return strategy.id - } - return undefined + const getStrategy = Effect.fnUntraced(function* (id: StrategyID) { + const found = registry.get(id) + if (!found) return yield* new StrategyUnavailableError({ strategy: id }) + return found }) const create = Effect.fn("ProjectCopy.create")(function* (input: CreateInput) { + const selected = yield* getStrategy(input.strategy) + const sourceDirectory = yield* source(input.sourceDirectory, input.projectID) yield* fs.makeDirectory(input.directory, { recursive: true }).pipe(Effect.orDie) const name = input.name ?? Slug.create() let suffix = 1 @@ -202,78 +200,100 @@ export const layer = Layer.effect( copyDirectory = AbsolutePath.make(path.join(input.directory, `${name}-${suffix}`)) } - const result = yield* strategy(input.strategy).create({ + const result = yield* selected.create({ directory: copyDirectory, - sourceDirectory: yield* source(input.sourceDirectory, input.projectID), + sourceDirectory, }) - yield* changed(input.projectID, yield* insert(input.projectID, result.directory, input.strategy)) + yield* changed( + input.projectID, + yield* directories.create({ + projectID: input.projectID, + directory: result.directory, + strategy: input.strategy, + behavior: "replace", + }), + ) return result }) const remove = Effect.fn("ProjectCopy.remove")(function* (input: RemoveInput) { const copyDirectory = yield* canonical(input.directory) - const id = yield* detect({ directory: copyDirectory }) - if (!id) return yield* new StrategyNotFoundError({ directory: copyDirectory }) - yield* strategy(id).remove({ directory: copyDirectory, force: input.force }) - yield* changed(input.projectID, yield* removeStored(input.projectID, copyDirectory)) + const stored = yield* directories.get({ projectID: input.projectID, directory: copyDirectory }) + if (!stored?.strategy) return yield* new InvalidDirectoryError({ directory: copyDirectory }) + yield* (yield* getStrategy(StrategyID.make(stored.strategy))).remove({ + directory: copyDirectory, + force: input.force, + }) + yield* changed( + input.projectID, + yield* directories.remove({ projectID: input.projectID, directory: copyDirectory }), + ) }) const refresh = Effect.fn("ProjectCopy.refresh")(function* (input: RefreshInput) { - const roots = yield* db - .select({ directory: ProjectDirectoryTable.directory }) - .from(ProjectDirectoryTable) - .where( - and( - eq(ProjectDirectoryTable.project_id, input.projectID), - inArray(ProjectDirectoryTable.type, ["main", "root"]), - ), - ) - .all() - .pipe(Effect.orDie) - const sourceDirectories = yield* Effect.forEach(roots, (item) => canonical(AbsolutePath.make(item.directory)), { - concurrency: "unbounded", - }) + const stored = yield* directories.list(input.projectID) + const checked = yield* Effect.forEach( + stored, + (item) => fs.isDir(item.directory).pipe(Effect.map((exists) => ({ ...item, exists }))), + { concurrency: "unbounded" }, + ) + const sourceDirectories = checked + .filter((item) => item.strategy === undefined && item.exists) + .map((item) => item.directory) const discovered = yield* Effect.forEach( sourceDirectories, (sourceDirectory) => - Effect.forEach(registry.values(), (strategy) => - strategy - .list(sourceDirectory) - .pipe(Effect.map((items) => items.map((item) => ({ ...item, type: strategy.id })))), + Effect.forEach(strategies(), (strategy) => + strategy.list(sourceDirectory).pipe( + Effect.map((items) => + items.map((item) => ({ + directory: item.directory, + strategy: item.type === "copy" ? strategy.id : undefined, + })), + ), + ), ), { concurrency: "unbounded" }, ).pipe( Effect.map((sets) => new Map(sets.flat(2).map((item) => [item.directory, item] as const)).values().toArray()), ) - const stored = yield* db - .select({ directory: ProjectDirectoryTable.directory }) - .from(ProjectDirectoryTable) - .where(eq(ProjectDirectoryTable.project_id, input.projectID)) - .all() - .pipe(Effect.orDie) - const inserted = yield* Effect.forEach(discovered, (item) => - insert(input.projectID, item.directory, item.type), - ).pipe(Effect.map((items) => items.some(Boolean))) - const removed = yield* Effect.forEach(stored, (item) => - fs - .isDir(item.directory) - .pipe( - Effect.flatMap((exists) => - exists ? Effect.succeed(false) : removeStored(input.projectID, AbsolutePath.make(item.directory)), + const removed = checked.filter((item) => !item.exists).map((item) => item.directory) + const result = yield* db + .transaction((tx) => + Effect.all({ + updated: Effect.forEach(discovered, (item) => + directories.create( + { + projectID: input.projectID, + directory: item.directory, + strategy: item.strategy, + behavior: "replace", + }, + tx, + ), ), - ), - ).pipe(Effect.map((items) => items.some(Boolean))) - yield* changed(input.projectID, inserted || removed) + removed: Effect.forEach(removed, (directory) => + directories.remove({ projectID: input.projectID, directory }, tx), + ), + }), + ) + .pipe(Effect.orDie) + const changes = { + updated: discovered.filter((_, index) => result.updated[index]).map((item) => item.directory), + removed: removed.filter((_, index) => result.removed[index]), + } + yield* changed(input.projectID, changes.updated.length > 0 || changes.removed.length > 0) + return changes }) - return Service.of({ detect, create, remove, refresh }) + return Service.of({ + register, + create, + remove, + refresh, + }) }), ) -export const defaultLayer = layer.pipe( - Layer.provide(Database.defaultLayer), - Layer.provide(FSUtil.defaultLayer), - Layer.provide(Git.defaultLayer), - Layer.provide(EventV2.defaultLayer), -) -export const node = LayerNode.make(layer, [FSUtil.node, Git.node, EventV2.node, Database.node]) +export const locationLayer = layer +export const node = LayerNode.make(layer, [FSUtil.node, Git.node, ProjectDirectories.node, EventV2.node, Database.node]) diff --git a/packages/core/src/project/directories.ts b/packages/core/src/project/directories.ts new file mode 100644 index 0000000000..7c0522107a --- /dev/null +++ b/packages/core/src/project/directories.ts @@ -0,0 +1,159 @@ +export * as ProjectDirectories from "./directories" + +import { and, asc, desc, eq, isNotNull, isNull, ne, or } from "drizzle-orm" +import { Context, Effect, Layer, Schema } from "effect" +import { Database } from "../database/database" +import { LayerNode } from "../effect/layer-node" +import { AbsolutePath, optionalOmitUndefined } from "../schema" +import { ProjectSchema } from "./schema" +import { ProjectDirectoryTable } from "./sql" +import type { EffectDrizzleSqlite } from "@opencode-ai/effect-drizzle-sqlite" + +export interface Directory { + readonly directory: AbsolutePath + readonly strategy?: string +} + +export const CreateInput = Schema.Struct({ + projectID: ProjectSchema.ID, + directory: AbsolutePath, + strategy: Schema.optional(Schema.String), + behavior: Schema.Literals(["ignore", "replace"]).pipe(Schema.optional), +}) +export type CreateInput = typeof CreateInput.Type + +export const RemoveInput = Schema.Struct({ + projectID: ProjectSchema.ID, + directory: AbsolutePath, +}) +export type RemoveInput = typeof RemoveInput.Type + +type DatabaseClient = EffectDrizzleSqlite.EffectSQLiteDatabase +export type Transaction = Parameters[0]>[0] + +export const ListInput = Schema.Struct({ + projectID: ProjectSchema.ID, +}).annotate({ identifier: "Project.DirectoriesInput" }) +export type ListInput = typeof ListInput.Type + +export const ListOutput = Schema.Array( + Schema.Struct({ + directory: AbsolutePath, + strategy: optionalOmitUndefined(Schema.String), + }), +).annotate({ identifier: "Project.Directories" }) +export type ListOutput = typeof ListOutput.Type + +export interface Interface { + readonly list: (projectID: ProjectSchema.ID) => Effect.Effect> + readonly get: (input: { + projectID: ProjectSchema.ID + directory: AbsolutePath + }) => Effect.Effect + readonly contains: (input: { projectID: ProjectSchema.ID; directory: AbsolutePath }) => Effect.Effect + readonly create: (input: CreateInput, tx?: Transaction) => Effect.Effect + readonly remove: (input: RemoveInput, tx?: Transaction) => Effect.Effect +} + +export class Service extends Context.Service()("@opencode/ProjectDirectories") {} + +export const layer = Layer.effect( + Service, + Effect.gen(function* () { + const db = (yield* Database.Service).db + + const create = Effect.fn("ProjectDirectories.create")(function* (input: CreateInput, tx?: Transaction) { + const insert = (tx ?? db) + .insert(ProjectDirectoryTable) + .values({ project_id: input.projectID, directory: input.directory, strategy: input.strategy }) + const query = + input.behavior === "replace" + ? insert.onConflictDoUpdate({ + target: [ProjectDirectoryTable.project_id, ProjectDirectoryTable.directory], + set: { strategy: input.strategy ?? null }, + setWhere: input.strategy + ? or(isNull(ProjectDirectoryTable.strategy), ne(ProjectDirectoryTable.strategy, input.strategy)) + : isNotNull(ProjectDirectoryTable.strategy), + }) + : insert.onConflictDoNothing() + return ( + (yield* query.returning({ directory: ProjectDirectoryTable.directory }).get().pipe(Effect.orDie)) !== undefined + ) + }) + + const remove = Effect.fn("ProjectDirectories.remove")(function* (input: RemoveInput, tx?: Transaction) { + return ( + (yield* (tx ?? db) + .delete(ProjectDirectoryTable) + .where( + and( + eq(ProjectDirectoryTable.project_id, input.projectID), + eq(ProjectDirectoryTable.directory, input.directory), + ), + ) + .returning({ directory: ProjectDirectoryTable.directory }) + .get() + .pipe(Effect.orDie)) !== undefined + ) + }) + + const list = Effect.fn("ProjectDirectories.list")(function* (projectID: ProjectSchema.ID) { + const rows = yield* db + .select({ directory: ProjectDirectoryTable.directory, strategy: ProjectDirectoryTable.strategy }) + .from(ProjectDirectoryTable) + .where(eq(ProjectDirectoryTable.project_id, projectID)) + .orderBy(desc(ProjectDirectoryTable.time_created), asc(ProjectDirectoryTable.directory)) + .all() + .pipe(Effect.orDie) + return rows.map((row) => ({ directory: row.directory, strategy: row.strategy ?? undefined })) + }) + + const contains = Effect.fn("ProjectDirectories.contains")(function* (input: { + projectID: ProjectSchema.ID + directory: AbsolutePath + }) { + return ( + (yield* db + .select({ directory: ProjectDirectoryTable.directory }) + .from(ProjectDirectoryTable) + .where( + and( + eq(ProjectDirectoryTable.project_id, input.projectID), + eq(ProjectDirectoryTable.directory, input.directory), + ), + ) + .get() + .pipe(Effect.orDie)) !== undefined + ) + }) + + const get = Effect.fn("ProjectDirectories.get")(function* (input: { + projectID: ProjectSchema.ID + directory: AbsolutePath + }) { + const row = yield* db + .select({ directory: ProjectDirectoryTable.directory, strategy: ProjectDirectoryTable.strategy }) + .from(ProjectDirectoryTable) + .where( + and( + eq(ProjectDirectoryTable.project_id, input.projectID), + eq(ProjectDirectoryTable.directory, input.directory), + ), + ) + .get() + .pipe(Effect.orDie) + return row ? { directory: row.directory, strategy: row.strategy ?? undefined } : undefined + }) + + return Service.of({ + list, + get, + contains, + create, + remove, + }) + }), +) + +export const defaultLayer = layer.pipe(Layer.provide(Database.defaultLayer)) +export const node = LayerNode.make(layer, [Database.node]) diff --git a/packages/core/src/project/schema.ts b/packages/core/src/project/schema.ts new file mode 100644 index 0000000000..51d9581cc6 --- /dev/null +++ b/packages/core/src/project/schema.ts @@ -0,0 +1,20 @@ +export * as ProjectSchema from "./schema" + +import { Schema } from "effect" +import { AbsolutePath, withStatics } from "../schema" + +export const ID = Schema.String.pipe( + Schema.brand("Project.ID"), + withStatics((schema) => ({ + global: schema.make("global"), + })), +) +export type ID = typeof ID.Type + +export const Vcs = Schema.Union([ + Schema.Struct({ + type: Schema.Literal("git"), + store: AbsolutePath, + }), +]) +export type Vcs = typeof Vcs.Type diff --git a/packages/core/src/project/sql.ts b/packages/core/src/project/sql.ts index c3954b771e..ab05fdac4a 100644 --- a/packages/core/src/project/sql.ts +++ b/packages/core/src/project/sql.ts @@ -1,10 +1,10 @@ import { sqliteTable, text, integer, primaryKey } from "drizzle-orm/sqlite-core" import * as DatabasePath from "../database/path" import { Timestamps } from "../database/schema.sql" -import { ProjectV2 } from "../project" +import { ProjectSchema } from "./schema" export const ProjectTable = sqliteTable("project", { - id: text().$type().primaryKey(), + id: text().$type().primaryKey(), worktree: DatabasePath.absoluteColumn().notNull(), vcs: text(), name: text(), @@ -21,11 +21,12 @@ export const ProjectDirectoryTable = sqliteTable( "project_directory", { project_id: text() - .$type() + .$type() .notNull() .references(() => ProjectTable.id, { onDelete: "cascade" }), - directory: text().notNull(), - type: text().$type<"main" | "root" | "git_worktree">().notNull(), + directory: DatabasePath.absoluteColumn().notNull(), + type: text().$type<"main" | "root" | "git_worktree">(), + strategy: text(), time_created: integer() .notNull() .$default(() => Date.now()), diff --git a/packages/core/src/ripgrep.ts b/packages/core/src/ripgrep.ts index 822c80458c..5a8a94f337 100644 --- a/packages/core/src/ripgrep.ts +++ b/packages/core/src/ripgrep.ts @@ -3,6 +3,7 @@ export * as Ripgrep from "./ripgrep" import { Context, Effect, Fiber, Layer, Schema, Stream } from "effect" import { ChildProcess } from "effect/unstable/process" import path from "path" +import { LayerNode } from "./effect/layer-node" import { Entry, Match } from "./filesystem/schema" import { FSUtil } from "./fs-util" import { AppProcess, collectStream, waitForAbort } from "./process" @@ -285,3 +286,4 @@ export const layer = Layer.effect( ) export const defaultLayer = layer.pipe(Layer.provide(Layer.merge(RipgrepBinary.defaultLayer, AppProcess.defaultLayer))) +export const node = LayerNode.make(layer, [RipgrepBinary.node, AppProcess.node]) diff --git a/packages/core/src/ripgrep/binary.ts b/packages/core/src/ripgrep/binary.ts index 013e9fc910..99fa8a2fd0 100644 --- a/packages/core/src/ripgrep/binary.ts +++ b/packages/core/src/ripgrep/binary.ts @@ -4,6 +4,8 @@ import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/ import { ChildProcess } from "effect/unstable/process" import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner" import { CrossSpawnSpawner } from "../cross-spawn-spawner" +import { LayerNode } from "../effect/layer-node" +import { httpClient } from "../effect/layer-node-platform" import { FSUtil } from "../fs-util" import { Global } from "../global" import { which } from "../util/which" @@ -127,4 +129,6 @@ export namespace RipgrepBinary { Layer.provide(FSUtil.defaultLayer), Layer.provide(CrossSpawnSpawner.defaultLayer), ) + + export const node = LayerNode.make(layer, [FSUtil.node, httpClient, CrossSpawnSpawner.node]) } diff --git a/packages/core/test/catalog.test.ts b/packages/core/test/catalog.test.ts index bbb959abec..585ebed933 100644 --- a/packages/core/test/catalog.test.ts +++ b/packages/core/test/catalog.test.ts @@ -1,7 +1,7 @@ import { describe, expect } from "bun:test" import { DateTime, Effect, Layer, Option } from "effect" import { Catalog } from "@opencode-ai/core/catalog" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { Credential } from "@opencode-ai/core/credential" import { EventV2 } from "@opencode-ai/core/event" import { Location } from "@opencode-ai/core/location" @@ -22,35 +22,38 @@ const it = testEffect( Catalog.locationLayer.pipe( Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge(locationLayer), - Layer.provideMerge(Layer.mock(Credential.Service)({ activeAll: () => Effect.succeed(new Map()) })), + Layer.provideMerge( + Layer.mock(Credential.Service)({ + all: () => Effect.succeed([]), + }), + ), ), ) describe("CatalogV2", () => { it.effect("projects active credentials without rebuilding catalog state", () => { - const connectorID = Connector.ID.make("test") - const methodID = Connector.MethodID.make("api-key") - const first = new Credential.Info({ + const integrationID = Integration.ID.make("test") + const first = { id: Credential.ID.create(), - connectorID, - methodID, + integrationID, label: "First", value: new Credential.Key({ type: "key", key: "first", metadata: { tenant: "one" } }), - }) - const second = new Credential.Info({ + } + const second = { id: Credential.ID.create(), - connectorID, - methodID, + integrationID, label: "Second", value: new Credential.Key({ type: "key", key: "second", metadata: { tenant: "two" } }), - }) + } let active = first const layer = Catalog.locationLayer.pipe( Layer.fresh, Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge(locationLayer), Layer.provideMerge( - Layer.mock(Credential.Service)({ activeAll: () => Effect.succeed(new Map([[connectorID, active]])) }), + Layer.mock(Credential.Service)({ + all: () => Effect.sync(() => [active]), + }), ), ) diff --git a/packages/core/test/connector.test.ts b/packages/core/test/connector.test.ts deleted file mode 100644 index 83c365e22a..0000000000 --- a/packages/core/test/connector.test.ts +++ /dev/null @@ -1,401 +0,0 @@ -import { describe, expect } from "bun:test" -import { Duration, Effect, Exit, Layer, Scope } from "effect" -import * as TestClock from "effect/testing/TestClock" -import { Connector } from "@opencode-ai/core/connector" -import { Credential } from "@opencode-ai/core/credential" -import { EventV2 } from "@opencode-ai/core/event" -import { it } from "./lib/effect" - -const layer = Connector.locationLayer.pipe( - Layer.provide(EventV2.defaultLayer), - Layer.provide( - Layer.mock(Credential.Service)({ - create: () => Effect.die("unexpected credential creation"), - }), - ), -) - -function connectionLayer( - created: Array<{ - connectorID: Connector.ID - methodID: Connector.MethodID - label?: string - value: Credential.Value - }>, -) { - return Connector.locationLayer.pipe( - Layer.provide(EventV2.defaultLayer), - Layer.provide( - Layer.mock(Credential.Service)({ - create: (input) => - Effect.sync(() => { - created.push(input) - return new Credential.Info({ id: Credential.ID.create(), ...input, label: input.label ?? "default" }) - }), - }), - ), - ) -} - -describe("Connector", () => { - it.effect("registers connectors through the editor", () => - Effect.gen(function* () { - const connectors = yield* Connector.Service - const scope = yield* Scope.fork(yield* Scope.Scope) - const openai = Connector.ID.make("openai") - - yield* connectors - .update((editor) => editor.update(openai, (connector) => (connector.name = "OpenAI"))) - .pipe(Scope.provide(scope)) - expect(yield* connectors.get(openai)).toEqual(new Connector.Info({ id: openai, name: "OpenAI", methods: [] })) - - yield* Scope.close(scope, Exit.void) - expect(yield* connectors.get(openai)).toBeUndefined() - }).pipe(Effect.provide(layer)), - ) - - it.effect("reveals the previous registration when an override closes", () => - Effect.gen(function* () { - const connectors = yield* Connector.Service - const id = Connector.ID.make("openai") - const first = yield* Scope.fork(yield* Scope.Scope) - const second = yield* Scope.fork(yield* Scope.Scope) - - yield* connectors - .update((editor) => editor.update(id, (connector) => (connector.name = "OpenAI"))) - .pipe(Scope.provide(first)) - yield* connectors - .update((editor) => editor.update(id, (connector) => (connector.name = "OpenAI Override"))) - .pipe(Scope.provide(second)) - expect((yield* connectors.get(id))?.name).toBe("OpenAI Override") - - yield* Scope.close(second, Exit.void) - expect((yield* connectors.get(id))?.name).toBe("OpenAI") - expect((yield* connectors.list()).map((connector) => connector.id)).toEqual([id]) - }).pipe(Effect.provide(layer)), - ) - - it.effect("registers and overrides methods independently", () => - Effect.gen(function* () { - const connectors = yield* Connector.Service - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("chatgpt") - const first = yield* Scope.fork(yield* Scope.Scope) - const second = yield* Scope.fork(yield* Scope.Scope) - const authorize = () => - Effect.succeed({ - mode: "auto" as const, - url: "https://example.com/authorize", - instructions: "Sign in", - callback: Effect.never, - }) - - yield* connectors - .update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), - authorize, - }), - ) - .pipe(Scope.provide(first)) - yield* connectors - .update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT Override" }), - authorize, - }), - ) - .pipe(Scope.provide(second)) - - expect((yield* connectors.get(connectorID))?.name).toBe("openai") - expect((yield* connectors.get(connectorID))?.methods[0]?.label).toBe("ChatGPT Override") - - yield* Scope.close(second, Exit.void) - expect((yield* connectors.get(connectorID))?.methods[0]?.label).toBe("ChatGPT") - expect((yield* connectors.get(connectorID))?.methods.map((method) => method.id)).toEqual([methodID]) - }).pipe(Effect.provide(layer)), - ) - - it.effect("connects with a key and stores the credential", () => { - const created: Array<{ - connectorID: Connector.ID - methodID: Connector.MethodID - label?: string - value: Credential.Value - }> = [] - return Effect.gen(function* () { - const connectors = yield* Connector.Service - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("api-key") - yield* connectors.update((editor) => - editor.method.update({ - connectorID, - method: new Connector.KeyMethod({ id: methodID, type: "key", label: "API key" }), - authorize: (key, inputs) => - Effect.succeed( - new Credential.Key({ type: "key", key, metadata: { organization: inputs.organization ?? "" } }), - ), - }), - ) - - yield* connectors.connect.key({ - connectorID, - methodID, - key: "secret", - inputs: { organization: "acme" }, - label: "Work", - }) - - expect(created).toEqual([ - { - connectorID, - methodID, - label: "Work", - value: new Credential.Key({ type: "key", key: "secret", metadata: { organization: "acme" } }), - }, - ]) - }).pipe(Effect.provide(connectionLayer(created))) - }) - - it.effect("refreshes OAuth with the originating method", () => { - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("chatgpt") - const credentialID = Credential.ID.create() - const current = new Credential.OAuth({ - type: "oauth", - access: "old-access", - refresh: "old-refresh", - expires: 1, - metadata: { accountID: "account" }, - }) - const updated: Array<{ id: Credential.ID; value: Credential.Value }> = [] - const refreshLayer = Connector.locationLayer.pipe( - Layer.provide(EventV2.defaultLayer), - Layer.provide( - Layer.mock(Credential.Service)({ - get: () => - Effect.succeed( - new Credential.Info({ - id: credentialID, - connectorID, - methodID, - label: "Personal", - value: current, - }), - ), - update: (id, input) => - Effect.sync(() => { - if (input.value) updated.push({ id, value: input.value }) - }), - }), - ), - ) - - return Effect.gen(function* () { - const connectors = yield* Connector.Service - yield* connectors.update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), - authorize: () => Effect.die("unexpected authorization"), - refresh: (value) => - Effect.succeed( - new Credential.OAuth({ - type: "oauth", - access: "new-access", - refresh: "new-refresh", - expires: 2, - metadata: value.metadata, - }), - ), - }), - ) - - yield* connectors.refresh(credentialID) - expect(updated).toEqual([ - { - id: credentialID, - value: new Credential.OAuth({ - type: "oauth", - access: "new-access", - refresh: "new-refresh", - expires: 2, - metadata: { accountID: "account" }, - }), - }, - ]) - }).pipe(Effect.provide(refreshLayer)) - }) - - it.effect("completes code OAuth once and stores the credential", () => { - const created: Array<{ - connectorID: Connector.ID - methodID: Connector.MethodID - label?: string - value: Credential.Value - }> = [] - return Effect.gen(function* () { - const connectors = yield* Connector.Service - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("chatgpt") - yield* connectors.update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), - authorize: () => - Effect.succeed({ - mode: "code" as const, - url: "https://example.com/authorize", - instructions: "Paste the code", - callback: (code: string) => - Effect.succeed( - new Credential.OAuth({ - type: "oauth", - access: "access", - refresh: "refresh", - expires: 1, - metadata: { code }, - }), - ), - }), - }), - ) - - const attempt = yield* connectors.connect.oauth.begin({ connectorID, methodID, inputs: {}, label: "Personal" }) - expect(attempt.mode).toBe("code") - yield* connectors.connect.oauth.complete({ attemptID: attempt.attemptID, code: "1234" }) - - expect(created[0]).toEqual({ - connectorID, - methodID, - label: "Personal", - value: new Credential.OAuth({ - type: "oauth", - access: "access", - refresh: "refresh", - expires: 1, - metadata: { code: "1234" }, - }), - }) - }).pipe(Effect.provide(connectionLayer(created))) - }) - - it.effect("keeps code attempts open when the code is missing and closes them on cancel", () => { - const created: Array<{ - connectorID: Connector.ID - methodID: Connector.MethodID - label?: string - value: Credential.Value - }> = [] - return Effect.gen(function* () { - const connectors = yield* Connector.Service - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("chatgpt") - let closed = false - yield* connectors.update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), - authorize: () => - Effect.addFinalizer(() => Effect.sync(() => (closed = true))).pipe( - Effect.as({ - mode: "code" as const, - url: "https://example.com/authorize", - instructions: "Paste the code", - callback: () => Effect.die("unexpected callback"), - }), - ), - }), - ) - - const attempt = yield* connectors.connect.oauth.begin({ connectorID, methodID, inputs: {} }) - expect( - yield* connectors.connect.oauth.complete({ attemptID: attempt.attemptID }).pipe(Effect.flip), - ).toBeInstanceOf(Connector.CodeRequiredError) - expect(closed).toBe(false) - yield* connectors.connect.oauth.cancel(attempt.attemptID) - expect(closed).toBe(true) - expect(created).toEqual([]) - }).pipe(Effect.provide(connectionLayer(created))) - }) - - it.effect("completes auto OAuth in the background", () => { - const created: Array<{ - connectorID: Connector.ID - methodID: Connector.MethodID - label?: string - value: Credential.Value - }> = [] - return Effect.gen(function* () { - const connectors = yield* Connector.Service - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("browser") - yield* connectors.update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "Browser" }), - authorize: () => - Effect.succeed({ - mode: "auto" as const, - url: "https://example.com/authorize", - instructions: "Sign in", - callback: Effect.succeed( - new Credential.OAuth({ type: "oauth", access: "access", refresh: "refresh", expires: 1 }), - ), - }), - }), - ) - - const attempt = yield* connectors.connect.oauth.begin({ connectorID, methodID, inputs: {} }) - yield* Effect.yieldNow - expect(yield* connectors.connect.oauth.status(attempt.attemptID)).toEqual({ - status: "complete", - time: attempt.time, - }) - expect(created).toHaveLength(1) - }).pipe(Effect.provide(connectionLayer(created))) - }) - - it.effect("expires abandoned OAuth attempts", () => { - const created: Array<{ - connectorID: Connector.ID - methodID: Connector.MethodID - label?: string - value: Credential.Value - }> = [] - return Effect.gen(function* () { - const connectors = yield* Connector.Service - const connectorID = Connector.ID.make("openai") - const methodID = Connector.MethodID.make("browser") - let closed = false - yield* connectors.update((editor) => - editor.method.update({ - connectorID, - method: new Connector.OAuthMethod({ id: methodID, type: "oauth", label: "Browser" }), - authorize: () => - Effect.addFinalizer(() => Effect.sync(() => (closed = true))).pipe( - Effect.as({ - mode: "auto" as const, - url: "https://example.com/authorize", - instructions: "Sign in", - callback: Effect.never, - }), - ), - }), - ) - - const attempt = yield* connectors.connect.oauth.begin({ connectorID, methodID, inputs: {} }) - expect(attempt.time.expires - attempt.time.created).toBe(Duration.toMillis(Duration.minutes(10))) - yield* TestClock.adjust(Duration.minutes(10)) - yield* Effect.yieldNow - expect(yield* connectors.connect.oauth.status(attempt.attemptID)).toEqual({ - status: "expired", - time: attempt.time, - }) - expect(closed).toBe(true) - expect(created).toEqual([]) - }).pipe(Effect.provide(connectionLayer(created))) - }) -}) diff --git a/packages/core/test/credential.test.ts b/packages/core/test/credential.test.ts index 0227ca318b..c038598543 100644 --- a/packages/core/test/credential.test.ts +++ b/packages/core/test/credential.test.ts @@ -1,101 +1,20 @@ import path from "path" import { describe, expect } from "bun:test" -import { Effect, Fiber, Layer, Stream } from "effect" +import { Effect, Layer } from "effect" import { Credential } from "@opencode-ai/core/credential" -import { Connector } from "@opencode-ai/core/connector" import { Database } from "@opencode-ai/core/database/database" -import { EventV2 } from "@opencode-ai/core/event" -import { FSUtil } from "@opencode-ai/core/fs-util" -import { Global } from "@opencode-ai/core/global" -import { PluginV2 } from "@opencode-ai/core/plugin" +import { Integration } from "@opencode-ai/core/integration" import { tmpdir } from "./fixture/tmpdir" -import { testEffect } from "./lib/effect" +import { it } from "./lib/effect" -const it = testEffect(PluginV2.locationLayer.pipe(Layer.provide(EventV2.defaultLayer))) - -function testLayer(directory: string) { +function layer(directory: string) { return Credential.layer.pipe( - Layer.fresh, Layer.provide(Database.layerFromPath(path.join(directory, "credential.db")).pipe(Layer.fresh)), - Layer.provideMerge(EventV2.defaultLayer), ) } describe("Credential", () => { - it.live("imports supported legacy auth.json credentials once", () => - Effect.acquireRelease( - Effect.promise(() => tmpdir()), - (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()), - ).pipe( - Effect.flatMap((tmp) => - Effect.gen(function* () { - yield* Effect.promise(() => - Bun.write( - path.join(tmp.path, "auth.json"), - JSON.stringify({ - openai: { - type: "oauth", - refresh: "refresh", - access: "access", - expires: 123, - accountId: "account", - }, - azure: { type: "api", key: "key", metadata: { resourceName: "resource" } }, - ignored: { type: "wellknown", key: "TOKEN", token: "secret" }, - }), - ), - ) - const database = Database.layerFromPath(path.join(tmp.path, "credential.db")).pipe(Layer.fresh) - const global = Global.layerWith({ data: tmp.path }) - const importer = Credential.legacyImportLayer.pipe( - Layer.provide(database), - Layer.provide(FSUtil.defaultLayer), - Layer.provide(global), - ) - const credentials = Credential.layer.pipe( - Layer.provide(database), - Layer.provide(EventV2.defaultLayer), - Layer.provideMerge(importer), - ) - const result = yield* Effect.gen(function* () { - const service = yield* Credential.Service - return yield* service.all() - }).pipe(Effect.provide(credentials), Effect.scoped) - - expect(result).toHaveLength(2) - expect(result).toContainEqual( - expect.objectContaining({ - connectorID: Connector.ID.make("openai"), - methodID: Connector.MethodID.make("chatgpt-browser"), - label: "Imported", - value: expect.objectContaining({ - type: "oauth", - refresh: "refresh", - access: "access", - expires: 123, - metadata: { accountID: "account" }, - }), - }), - ) - expect(result).toContainEqual( - expect.objectContaining({ - connectorID: Connector.ID.make("azure"), - methodID: Connector.MethodID.make("api-key"), - value: expect.objectContaining({ type: "key", key: "key", metadata: { resourceName: "resource" } }), - }), - ) - - yield* importer.pipe(Layer.build, Effect.scoped) - const after = yield* Effect.gen(function* () { - return yield* (yield* Credential.Service).all() - }).pipe(Effect.provide(credentials), Effect.scoped) - expect(after).toHaveLength(2) - }), - ), - ), - ) - - it.live("emits credential lifecycle events", () => + it.live("stores, updates, lists, and removes credentials", () => Effect.acquireRelease( Effect.promise(() => tmpdir()), (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()), @@ -103,103 +22,27 @@ describe("Credential", () => { Effect.flatMap((tmp) => Effect.gen(function* () { const credentials = yield* Credential.Service - const eventSvc = yield* EventV2.Service - const addedFiber = yield* eventSvc - .subscribe(Credential.Event.Added) - .pipe(Stream.take(2), Stream.runCollect, Effect.forkScoped) - const switchedFiber = yield* eventSvc - .subscribe(Credential.Event.Switched) - .pipe(Stream.take(3), Stream.runCollect, Effect.forkScoped) - const removedFiber = yield* eventSvc - .subscribe(Credential.Event.Removed) - .pipe(Stream.take(1), Stream.runCollect, Effect.forkScoped) - - yield* Effect.yieldNow - - const first = yield* credentials.create({ - connectorID: Connector.ID.make("lifecycle"), - methodID: Connector.MethodID.make("key"), - value: new Credential.Key({ type: "key", key: "raw-key" }), - }) - expect(first).toBeDefined() - if (!first) return - expect(first.label).toBe("default") - expect(first.value.type).toBe("key") - if (first.value.type === "key") expect(first.value.key).toBe("raw-key") - - yield* credentials.update(first.id, { label: "keep" }) - const updated = yield* credentials.get(first.id) - expect(updated?.label).toBe("keep") - expect(updated?.value.type).toBe("key") - if (updated?.value.type === "key") expect(updated.value.key).toBe("raw-key") - - const second = yield* credentials.create({ - connectorID: Connector.ID.make("lifecycle"), - methodID: Connector.MethodID.make("key"), - value: new Credential.Key({ type: "key", key: "second-key" }), - }) - expect(second).toBeDefined() - if (!second) return - - yield* credentials.remove(second.id) - const added = Array.from(yield* Fiber.join(addedFiber)) - const switched = Array.from(yield* Fiber.join(switchedFiber)) - const removed = Array.from(yield* Fiber.join(removedFiber)) - expect(added.map((event) => event.data.credential.id)).toEqual([first.id, second.id]) - expect(switched.map((event) => event.data)).toEqual([ - { connectorID: Connector.ID.make("lifecycle"), from: undefined, to: first.id }, - { connectorID: Connector.ID.make("lifecycle"), from: first.id, to: second.id }, - { connectorID: Connector.ID.make("lifecycle"), from: second.id, to: first.id }, - ]) - expect(removed[0]?.data.credential.id).toBe(second.id) - }).pipe(Effect.provide(testLayer(tmp.path))), - ), - ), - ) - - it.live("always switches to newly created credentials", () => - Effect.acquireRelease( - Effect.promise(() => tmpdir()), - (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()), - ).pipe( - Effect.flatMap((tmp) => - Effect.gen(function* () { - const credentials = yield* Credential.Service - const eventSvc = yield* EventV2.Service - const switchedFiber = yield* eventSvc - .subscribe(Credential.Event.Switched) - .pipe(Stream.take(3), Stream.runCollect, Effect.forkScoped) - - yield* Effect.yieldNow - - const first = yield* credentials.create({ - connectorID: Connector.ID.make("switch"), - methodID: Connector.MethodID.make("key"), - value: new Credential.Key({ type: "key", key: "first-key" }), - }) - const second = yield* credentials.create({ - connectorID: Connector.ID.make("switch"), - methodID: Connector.MethodID.make("key"), - value: new Credential.Key({ type: "key", key: "second-key" }), - }) - const third = yield* credentials.create({ - connectorID: Connector.ID.make("switch"), - methodID: Connector.MethodID.make("key"), - value: new Credential.Key({ type: "key", key: "third-key" }), + const integrationID = Integration.ID.make("openai") + const created = yield* credentials.create({ + integrationID, + label: "Work", + value: new Credential.Key({ type: "key", key: "secret" }), }) - expect(first).toBeDefined() - expect(second).toBeDefined() - expect(third).toBeDefined() - if (!first || !second || !third) return + expect(yield* credentials.list(integrationID)).toEqual([created]) + yield* credentials.update(created.id, { label: "Personal" }) + expect((yield* credentials.list(integrationID))[0]?.label).toBe("Personal") - expect((yield* credentials.active(Connector.ID.make("switch")))?.id).toBe(third.id) - expect(Array.from(yield* Fiber.join(switchedFiber)).map((event) => event.data)).toEqual([ - { connectorID: Connector.ID.make("switch"), from: undefined, to: first.id }, - { connectorID: Connector.ID.make("switch"), from: first.id, to: second.id }, - { connectorID: Connector.ID.make("switch"), from: second.id, to: third.id }, - ]) - }).pipe(Effect.provide(testLayer(tmp.path))), + const replacement = yield* credentials.create({ + integrationID, + label: "Replacement", + value: new Credential.Key({ type: "key", key: "replacement" }), + }) + expect(yield* credentials.list(integrationID)).toEqual([replacement]) + + yield* credentials.remove(replacement.id) + expect(yield* credentials.list(integrationID)).toEqual([]) + }).pipe(Effect.provide(layer(tmp.path))), ), ), ) diff --git a/packages/core/test/database-migration.test.ts b/packages/core/test/database-migration.test.ts index 7daff4e5b2..d7126f76e2 100644 --- a/packages/core/test/database-migration.test.ts +++ b/packages/core/test/database-migration.test.ts @@ -13,6 +13,7 @@ import normalizeStoragePathsMigration from "@opencode-ai/core/database/migration import sessionMessageProjectionOrderMigration from "@opencode-ai/core/database/migration/20260603040000_session_message_projection_order" import eventSourcedSessionInputMigration from "@opencode-ai/core/database/migration/20260604172448_event_sourced_session_input" import contextEpochAgentMigration from "@opencode-ai/core/database/migration/20260605042240_add_context_epoch_agent" +import simplifyIntegrationCredentialsMigration from "@opencode-ai/core/database/migration/20260611192811_lush_chimera" import { ProjectV2 } from "@opencode-ai/core/project" import { ProjectTable } from "@opencode-ai/core/project/sql" import { AbsolutePath } from "@opencode-ai/core/schema" @@ -92,6 +93,18 @@ describe("DatabaseMigration", () => { ) }) + test("rejects a non-empty database without a session table", async () => { + await expect( + run( + Effect.gen(function* () { + const db = yield* makeDb + yield* db.run(sql`CREATE TABLE unrelated (id text PRIMARY KEY)`) + yield* DatabaseMigration.apply(db) + }), + ), + ).rejects.toThrow("Database is not empty and has no session table") + }) + test("backfills existing Context Epoch rows to the build agent", async () => { await run( Effect.gen(function* () { @@ -112,6 +125,31 @@ describe("DatabaseMigration", () => { ) }) + test("keeps legacy credential fields nullable", async () => { + await run( + Effect.gen(function* () { + const db = yield* makeDb + yield* db.run( + sql`CREATE TABLE credential (id text PRIMARY KEY, connector_id text NOT NULL, method_id text NOT NULL, label text NOT NULL, value text NOT NULL, active integer DEFAULT false NOT NULL, time_created integer NOT NULL, time_updated integer NOT NULL)`, + ) + yield* db.run( + sql`CREATE UNIQUE INDEX credential_connector_active_idx ON credential (connector_id) WHERE active = 1`, + ) + yield* DatabaseMigration.applyOnly(db, [simplifyIntegrationCredentialsMigration]) + + yield* db.run( + sql`INSERT INTO credential (id, connector_id, method_id, label, value, active, time_created, time_updated) VALUES ('legacy', 'openai', 'oauth', 'Legacy', '{}', 1, 1, 1)`, + ) + yield* db.run( + sql`INSERT INTO credential (id, integration_id, label, value, time_created, time_updated) VALUES ('current', 'anthropic', 'Current', '{}', 2, 2)`, + ) + expect(yield* db.get(sql`SELECT connector_id, method_id, active FROM credential WHERE id = 'current'`)).toEqual( + { connector_id: null, method_id: null, active: null }, + ) + }), + ) + }) + test("resets beta history and rebuilds event-sourced Session input storage", async () => { await run( Effect.gen(function* () { diff --git a/packages/core/test/integration.test.ts b/packages/core/test/integration.test.ts new file mode 100644 index 0000000000..fa05e23d95 --- /dev/null +++ b/packages/core/test/integration.test.ts @@ -0,0 +1,401 @@ +import { describe, expect } from "bun:test" +import { Duration, Effect, Exit, Layer, Scope } from "effect" +import * as TestClock from "effect/testing/TestClock" +import { Integration } from "@opencode-ai/core/integration" +import { IntegrationConnection } from "@opencode-ai/core/integration/connection" +import { Credential } from "@opencode-ai/core/credential" +import { EventV2 } from "@opencode-ai/core/event" +import { it } from "./lib/effect" + +const layer = Integration.locationLayer.pipe( + Layer.provide(EventV2.defaultLayer), + Layer.provide( + Layer.mock(Credential.Service)({ + create: () => Effect.die("unexpected credential creation"), + list: () => Effect.succeed([]), + }), + ), +) + +function connectionLayer( + created: Array<{ + integrationID: Integration.ID + label?: string + value: Credential.Info + }>, +) { + return Integration.locationLayer.pipe( + Layer.provide(EventV2.defaultLayer), + Layer.provide( + Layer.mock(Credential.Service)({ + create: (input) => + Effect.sync(() => { + created.push(input) + return new Credential.Stored({ + id: Credential.ID.create(), + integrationID: input.integrationID, + label: input.label ?? "default", + value: input.value, + }) + }), + list: () => Effect.succeed([]), + }), + ), + ) +} + +describe("Integration", () => { + it.effect("registers integrations through the editor", () => + Effect.gen(function* () { + const integrations = yield* Integration.Service + const scope = yield* Scope.fork(yield* Scope.Scope) + const openai = Integration.ID.make("openai") + + yield* integrations + .update((editor) => editor.update(openai, (integration) => (integration.name = "OpenAI"))) + .pipe(Scope.provide(scope)) + expect(yield* integrations.get(openai)).toEqual( + new Integration.Info({ id: openai, name: "OpenAI", methods: [], connections: [] }), + ) + + yield* Scope.close(scope, Exit.void) + expect(yield* integrations.get(openai)).toBeUndefined() + }).pipe(Effect.provide(layer)), + ) + + it.effect("reveals the previous registration when an override closes", () => + Effect.gen(function* () { + const integrations = yield* Integration.Service + const id = Integration.ID.make("openai") + const first = yield* Scope.fork(yield* Scope.Scope) + const second = yield* Scope.fork(yield* Scope.Scope) + + yield* integrations + .update((editor) => editor.update(id, (integration) => (integration.name = "OpenAI"))) + .pipe(Scope.provide(first)) + yield* integrations + .update((editor) => editor.update(id, (integration) => (integration.name = "OpenAI Override"))) + .pipe(Scope.provide(second)) + expect((yield* integrations.get(id))?.name).toBe("OpenAI Override") + + yield* Scope.close(second, Exit.void) + expect((yield* integrations.get(id))?.name).toBe("OpenAI") + expect((yield* integrations.list()).map((integration) => integration.id)).toEqual([id]) + }).pipe(Effect.provide(layer)), + ) + + it.effect("registers and overrides methods independently", () => + Effect.gen(function* () { + const integrations = yield* Integration.Service + const integrationID = Integration.ID.make("openai") + const methodID = Integration.MethodID.make("chatgpt") + const first = yield* Scope.fork(yield* Scope.Scope) + const second = yield* Scope.fork(yield* Scope.Scope) + const authorize = () => + Effect.succeed({ + mode: "auto" as const, + url: "https://example.com/authorize", + instructions: "Sign in", + callback: Effect.never, + }) + + yield* integrations + .update((editor) => + editor.method.update({ + integrationID, + method: new Integration.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), + authorize, + }), + ) + .pipe(Scope.provide(first)) + yield* integrations + .update((editor) => { + expect(editor.get(integrationID)).toEqual({ id: integrationID, name: "openai" }) + expect(editor.list()).toEqual([{ id: integrationID, name: "openai" }]) + expect(editor.method.list(integrationID)).toEqual([ + expect.objectContaining({ id: methodID, label: "ChatGPT" }), + ]) + editor.method.update({ + integrationID, + method: new Integration.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT Override" }), + authorize, + }) + }) + .pipe(Scope.provide(second)) + + expect((yield* integrations.get(integrationID))?.name).toBe("openai") + expect((yield* integrations.get(integrationID))?.methods[0]).toMatchObject({ label: "ChatGPT Override" }) + + yield* Scope.close(second, Exit.void) + expect((yield* integrations.get(integrationID))?.methods[0]).toMatchObject({ label: "ChatGPT" }) + expect((yield* integrations.get(integrationID))?.methods).toEqual([expect.objectContaining({ id: methodID })]) + }).pipe(Effect.provide(layer)), + ) + + it.effect("connects with a key and stores the credential", () => { + const created: Array<{ + integrationID: Integration.ID + label?: string + value: Credential.Info + }> = [] + return Effect.gen(function* () { + const integrations = yield* Integration.Service + const integrationID = Integration.ID.make("openai") + yield* integrations.update((editor) => + editor.method.update({ + integrationID, + method: new Integration.KeyMethod({ type: "key", label: "API key" }), + }), + ) + + yield* integrations.connect.key({ + integrationID, + key: "secret", + label: "Work", + }) + + expect(created).toEqual([ + { + integrationID, + label: "Work", + value: new Credential.Key({ type: "key", key: "secret" }), + }, + ]) + }).pipe(Effect.provide(connectionLayer(created))) + }) + + it.effect("completes code OAuth once and stores the credential", () => { + const created: Array<{ + integrationID: Integration.ID + label?: string + value: Credential.Info + }> = [] + return Effect.gen(function* () { + const integrations = yield* Integration.Service + const integrationID = Integration.ID.make("openai") + const methodID = Integration.MethodID.make("chatgpt") + yield* integrations.update((editor) => + editor.method.update({ + integrationID, + method: new Integration.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), + authorize: () => + Effect.succeed({ + mode: "code" as const, + url: "https://example.com/authorize", + instructions: "Paste the code", + callback: (code: string) => + Effect.succeed( + new Credential.OAuth({ + type: "oauth", + methodID, + access: "access", + refresh: "refresh", + expires: 1, + metadata: { code }, + }), + ), + }), + }), + ) + + const attempt = yield* integrations.connect.oauth({ + integrationID, + methodID, + inputs: {}, + label: "Personal", + }) + expect(attempt.mode).toBe("code") + yield* integrations.attempt.complete({ attemptID: attempt.attemptID, code: "1234" }) + + expect(created[0]).toEqual({ + integrationID, + label: "Personal", + value: new Credential.OAuth({ + type: "oauth", + methodID, + access: "access", + refresh: "refresh", + expires: 1, + metadata: { code: "1234" }, + }), + }) + }).pipe(Effect.provide(connectionLayer(created))) + }) + + it.effect("keeps code attempts open when the code is missing and closes them on cancel", () => { + const created: Array<{ + integrationID: Integration.ID + label?: string + value: Credential.Info + }> = [] + return Effect.gen(function* () { + const integrations = yield* Integration.Service + const integrationID = Integration.ID.make("openai") + const methodID = Integration.MethodID.make("chatgpt") + let closed = false + yield* integrations.update((editor) => + editor.method.update({ + integrationID, + method: new Integration.OAuthMethod({ id: methodID, type: "oauth", label: "ChatGPT" }), + authorize: () => + Effect.addFinalizer(() => Effect.sync(() => (closed = true))).pipe( + Effect.as({ + mode: "code" as const, + url: "https://example.com/authorize", + instructions: "Paste the code", + callback: () => Effect.die("unexpected callback"), + }), + ), + }), + ) + + const attempt = yield* integrations.connect.oauth({ integrationID, methodID, inputs: {} }) + expect(yield* integrations.attempt.complete({ attemptID: attempt.attemptID }).pipe(Effect.flip)).toBeInstanceOf( + Integration.CodeRequiredError, + ) + expect(closed).toBe(false) + yield* integrations.attempt.cancel(attempt.attemptID) + expect(closed).toBe(true) + expect(created).toEqual([]) + }).pipe(Effect.provide(connectionLayer(created))) + }) + + it.effect("completes auto OAuth in the background", () => { + const created: Array<{ + integrationID: Integration.ID + label?: string + value: Credential.Info + }> = [] + return Effect.gen(function* () { + const integrations = yield* Integration.Service + const integrationID = Integration.ID.make("openai") + const methodID = Integration.MethodID.make("browser") + yield* integrations.update((editor) => + editor.method.update({ + integrationID, + method: new Integration.OAuthMethod({ id: methodID, type: "oauth", label: "Browser" }), + authorize: () => + Effect.succeed({ + mode: "auto" as const, + url: "https://example.com/authorize", + instructions: "Sign in", + callback: Effect.succeed( + new Credential.OAuth({ type: "oauth", methodID, access: "access", refresh: "refresh", expires: 1 }), + ), + }), + }), + ) + + const attempt = yield* integrations.connect.oauth({ integrationID, methodID, inputs: {} }) + yield* Effect.yieldNow + expect(yield* integrations.attempt.status(attempt.attemptID)).toEqual({ + status: "complete", + time: attempt.time, + }) + expect(created).toHaveLength(1) + }).pipe(Effect.provide(connectionLayer(created))) + }) + + it.effect("expires abandoned OAuth attempts", () => { + const created: Array<{ + integrationID: Integration.ID + label?: string + value: Credential.Info + }> = [] + return Effect.gen(function* () { + const integrations = yield* Integration.Service + const integrationID = Integration.ID.make("openai") + const methodID = Integration.MethodID.make("browser") + let closed = false + yield* integrations.update((editor) => + editor.method.update({ + integrationID, + method: new Integration.OAuthMethod({ id: methodID, type: "oauth", label: "Browser" }), + authorize: () => + Effect.addFinalizer(() => Effect.sync(() => (closed = true))).pipe( + Effect.as({ + mode: "auto" as const, + url: "https://example.com/authorize", + instructions: "Sign in", + callback: Effect.never, + }), + ), + }), + ) + + const attempt = yield* integrations.connect.oauth({ integrationID, methodID, inputs: {} }) + expect(attempt.time.expires - attempt.time.created).toBe(Duration.toMillis(Duration.minutes(10))) + yield* TestClock.adjust(Duration.minutes(10)) + yield* Effect.yieldNow + expect(yield* integrations.attempt.status(attempt.attemptID)).toEqual({ + status: "expired", + time: attempt.time, + }) + expect(closed).toBe(true) + expect(created).toEqual([]) + }).pipe(Effect.provide(connectionLayer(created))) + }) + + it.effect("projects credential and env connections", () => { + const integrationID = Integration.ID.make("acme") + const rows = [ + { + id: Credential.ID.create(), + integrationID, + label: "Work", + value: new Credential.Key({ type: "key", key: "a" }), + }, + { + id: Credential.ID.create(), + integrationID, + label: "Personal", + value: new Credential.Key({ type: "key", key: "b" }), + }, + ] + const projectionLayer = Integration.locationLayer.pipe( + Layer.provide(EventV2.defaultLayer), + Layer.provide( + Layer.mock(Credential.Service)({ + list: () => Effect.succeed(rows.map((row) => new Credential.Stored(row))), + }), + ), + ) + return Effect.acquireUseRelease( + Effect.sync(() => { + const previous = process.env.INTEGRATION_TEST_ACME_KEY + process.env.INTEGRATION_TEST_ACME_KEY = "secret" + delete process.env.INTEGRATION_TEST_ACME_MISSING + return previous + }), + () => + Effect.gen(function* () { + const integrations = yield* Integration.Service + yield* integrations.update((editor) => + editor.method.update({ + integrationID, + method: new Integration.EnvMethod({ + type: "env", + names: ["INTEGRATION_TEST_ACME_KEY", "INTEGRATION_TEST_ACME_MISSING"], + }), + }), + ) + + // Stored credentials and detected env vars appear as connections. + expect((yield* integrations.get(integrationID))?.connections).toEqual([ + new IntegrationConnection.CredentialInfo({ type: "credential", id: rows[0]!.id, label: "Work" }), + new IntegrationConnection.CredentialInfo({ + type: "credential", + id: rows[1]!.id, + label: "Personal", + }), + new IntegrationConnection.EnvInfo({ type: "env", name: "INTEGRATION_TEST_ACME_KEY" }), + ]) + }).pipe(Effect.provide(projectionLayer)), + (previous) => + Effect.sync(() => { + if (previous === undefined) delete process.env.INTEGRATION_TEST_ACME_KEY + else process.env.INTEGRATION_TEST_ACME_KEY = previous + }), + ) + }) +}) diff --git a/packages/core/test/location-layer.test.ts b/packages/core/test/location-layer.test.ts index 0bd3a2497a..69dba2ae0a 100644 --- a/packages/core/test/location-layer.test.ts +++ b/packages/core/test/location-layer.test.ts @@ -27,17 +27,15 @@ import { ApplicationTools } from "../src/tool/application-tools" const applicationTools = ApplicationTools.layer const it = testEffect( Layer.merge( - applicationTools, + Layer.mergeAll(applicationTools, Database.defaultLayer, EventV2.defaultLayer), LocationServiceMap.layer.pipe( Layer.provide(applicationTools), Layer.provide( Layer.mergeAll( Project.defaultLayer, EventV2.defaultLayer, - Credential.layer.pipe( - Layer.provide(Database.layerFromPath(":memory:").pipe(Layer.fresh)), - Layer.provide(EventV2.defaultLayer), - ), + Credential.defaultLayer, + Credential.layer.pipe(Layer.provide(Database.layerFromPath(":memory:").pipe(Layer.fresh))), Npm.defaultLayer, ModelsDev.defaultLayer, FSUtil.defaultLayer, diff --git a/packages/core/test/move-session.test.ts b/packages/core/test/move-session.test.ts index 0af8da1b9f..5f7fbb16d3 100644 --- a/packages/core/test/move-session.test.ts +++ b/packages/core/test/move-session.test.ts @@ -11,6 +11,7 @@ import { Git } from "@opencode-ai/core/git" import { EventV2 } from "@opencode-ai/core/event" import { Project } from "@opencode-ai/core/project" import { ProjectTable } from "@opencode-ai/core/project/sql" +import { ProjectDirectories } from "@opencode-ai/core/project/directories" import { AbsolutePath } from "@opencode-ai/core/schema" import { SessionV2 } from "@opencode-ai/core/session" import { SessionExecution } from "@opencode-ai/core/session/execution" @@ -22,11 +23,13 @@ import { testEffect } from "./lib/effect" const database = Database.layerFromPath(":memory:") const events = EventV2.layer.pipe(Layer.provide(database)) +const directories = ProjectDirectories.layer.pipe(Layer.provide(database), Layer.provide(events)) const projector = SessionProjector.layer.pipe(Layer.provide(database), Layer.provide(events)) const project = Project.layer.pipe( Layer.provide(database), Layer.provide(FSUtil.defaultLayer), Layer.provide(Git.defaultLayer), + Layer.provide(directories), ) const store = SessionStore.layer.pipe(Layer.provide(database)) const sessions = SessionV2.layer.pipe( @@ -45,7 +48,7 @@ const layer = MoveSession.layer.pipe( Layer.provide(sessions), ) const it = testEffect( - Layer.mergeAll(layer, database, events, project, projector, store, SessionExecution.noopLayer, sessions), + Layer.mergeAll(layer, database, events, directories, project, projector, store, SessionExecution.noopLayer, sessions), ) function abs(input: string) { diff --git a/packages/core/test/plugin/models-dev.test.ts b/packages/core/test/plugin/models-dev.test.ts index 3abc39464f..8cdfc066cd 100644 --- a/packages/core/test/plugin/models-dev.test.ts +++ b/packages/core/test/plugin/models-dev.test.ts @@ -2,7 +2,7 @@ import path from "path" import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" import { Catalog } from "@opencode-ai/core/catalog" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { Credential } from "@opencode-ai/core/credential" import { Database } from "@opencode-ai/core/database/database" import { EventV2 } from "@opencode-ai/core/event" @@ -23,14 +23,25 @@ const locationLayer = Layer.succeed( ) const plugins = PluginV2.layer.pipe(Layer.provide(events)) const policy = Policy.layer.pipe(Layer.provide(locationLayer)) -const credentials = Credential.layer.pipe(Layer.provide(Database.layerFromPath(":memory:")), Layer.provide(events)) -const catalog = Catalog.layer.pipe(Layer.provide(Layer.mergeAll(events, locationLayer, plugins, policy, credentials))) -const connectors = Connector.locationLayer.pipe(Layer.provide(credentials), Layer.provide(events)) -const layer = Layer.mergeAll(catalog, connectors, credentials, events, locationLayer, plugins) +const connections = Credential.layer.pipe( + Layer.fresh, + Layer.provide(Database.layerFromPath(":memory:").pipe(Layer.fresh)), + Layer.provide(events), +) +const catalog = Catalog.layer.pipe(Layer.provide(Layer.mergeAll(events, locationLayer, plugins, policy, connections))) +const integrations = Integration.locationLayer.pipe(Layer.provide(events), Layer.provide(connections)) +const layer = Layer.mergeAll( + catalog.pipe(Layer.provide(connections)), + integrations, + connections, + events, + locationLayer, + plugins, +) const it = testEffect(layer) describe("ModelsDevPlugin", () => { - it.effect("registers key connectors for providers with environment variables", () => + it.effect("registers key methods for providers with environment variables", () => Effect.acquireUseRelease( Effect.sync(() => { const previous = { @@ -44,14 +55,19 @@ describe("ModelsDevPlugin", () => { () => Effect.gen(function* () { yield* ModelsDevPlugin.effect - const connectors = yield* Connector.Service - expect(yield* connectors.list()).toEqual([ - new Connector.Info({ - id: Connector.ID.make("acme"), + const integrations = yield* Integration.Service + expect(yield* integrations.list()).toEqual([ + new Integration.Info({ + id: Integration.ID.make("acme"), name: "Acme", methods: [ - new Connector.KeyMethod({ id: Connector.MethodID.make("api-key"), type: "key", label: "API Key" }), + new Integration.KeyMethod({ type: "key" }), + new Integration.EnvMethod({ + type: "env", + names: ["ACME_API_KEY"], + }), ], + connections: [], }), ]) }).pipe(Effect.provide(ModelsDev.defaultLayer)), diff --git a/packages/core/test/plugin/provider-azure.test.ts b/packages/core/test/plugin/provider-azure.test.ts index d5fe1df027..c4bdd806c9 100644 --- a/packages/core/test/plugin/provider-azure.test.ts +++ b/packages/core/test/plugin/provider-azure.test.ts @@ -1,7 +1,7 @@ import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" import { Credential } from "@opencode-ai/core/credential" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { Database } from "@opencode-ai/core/database/database" import { Catalog } from "@opencode-ai/core/catalog" import { EventV2 } from "@opencode-ai/core/event" @@ -14,14 +14,15 @@ import { location } from "../fixture/location" import { testEffect } from "../lib/effect" import { fakeSelectorSdk, it, model, npmLayer, provider, withEnv } from "./provider-helper" +const database = Database.layerFromPath(":memory:").pipe(Layer.fresh) +const preferences = Credential.layer.pipe(Layer.provide(database)) +const accounts = Layer.merge( + Credential.layer.pipe(Layer.provide(database), Layer.provide(preferences), Layer.provide(EventV2.defaultLayer)), + preferences, +) const itWithAccount = testEffect( Catalog.locationLayer.pipe( - Layer.provideMerge( - Credential.layer.pipe( - Layer.provide(Database.layerFromPath(":memory:").pipe(Layer.fresh)), - Layer.provide(EventV2.defaultLayer), - ), - ), + Layer.provideMerge(accounts), Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge( Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make("test") }))), @@ -83,8 +84,7 @@ describe("AzurePlugin", () => { const credentials = yield* Credential.Service const catalog = yield* Catalog.Service yield* credentials.create({ - connectorID: Connector.ID.make("azure"), - methodID: Connector.MethodID.make("api-key"), + integrationID: Integration.ID.make("azure"), value: new Credential.Key({ type: "key", key: "key", diff --git a/packages/core/test/plugin/provider-cloudflare-workers-ai.test.ts b/packages/core/test/plugin/provider-cloudflare-workers-ai.test.ts index 235f76d039..208ab8710d 100644 --- a/packages/core/test/plugin/provider-cloudflare-workers-ai.test.ts +++ b/packages/core/test/plugin/provider-cloudflare-workers-ai.test.ts @@ -1,7 +1,7 @@ import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" import { Credential } from "@opencode-ai/core/credential" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { Database } from "@opencode-ai/core/database/database" import { Catalog } from "@opencode-ai/core/catalog" import { Location } from "@opencode-ai/core/location" @@ -15,14 +15,15 @@ import { location } from "../fixture/location" import { testEffect } from "../lib/effect" import { fakeSelectorSdk, it, model, npmLayer, withEnv } from "./provider-helper" +const database = Database.layerFromPath(":memory:").pipe(Layer.fresh) +const preferences = Credential.layer.pipe(Layer.provide(database)) +const accounts = Layer.merge( + Credential.layer.pipe(Layer.provide(database), Layer.provide(preferences), Layer.provide(EventV2.defaultLayer)), + preferences, +) const itWithAccount = testEffect( Catalog.locationLayer.pipe( - Layer.provideMerge( - Credential.layer.pipe( - Layer.provide(Database.layerFromPath(":memory:").pipe(Layer.fresh)), - Layer.provide(EventV2.defaultLayer), - ), - ), + Layer.provideMerge(accounts), Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge( Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make("test") }))), @@ -137,8 +138,7 @@ describe("CloudflareWorkersAIPlugin", () => { const credentials = yield* Credential.Service const catalog = yield* Catalog.Service yield* credentials.create({ - connectorID: Connector.ID.make("cloudflare-workers-ai"), - methodID: Connector.MethodID.make("api-key"), + integrationID: Integration.ID.make("cloudflare-workers-ai"), value: new Credential.Key({ type: "key", key: "account-key", diff --git a/packages/core/test/plugin/provider-gitlab.test.ts b/packages/core/test/plugin/provider-gitlab.test.ts index 5b82cda959..dab52a1f7f 100644 --- a/packages/core/test/plugin/provider-gitlab.test.ts +++ b/packages/core/test/plugin/provider-gitlab.test.ts @@ -1,7 +1,7 @@ import { describe, expect, mock } from "bun:test" import { Effect, Layer } from "effect" import { Credential } from "@opencode-ai/core/credential" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { Database } from "@opencode-ai/core/database/database" import { Catalog } from "@opencode-ai/core/catalog" import { EventV2 } from "@opencode-ai/core/event" @@ -15,6 +15,12 @@ import { testEffect } from "../lib/effect" import { it, model, npmLayer, withEnv } from "./provider-helper" const gitlabSDKOptions: Record[] = [] +const database = Database.layerFromPath(":memory:").pipe(Layer.fresh) +const preferences = Credential.layer.pipe(Layer.provide(database)) +const accounts = Layer.merge( + Credential.layer.pipe(Layer.provide(database), Layer.provide(preferences), Layer.provide(EventV2.defaultLayer)), + preferences, +) void mock.module("gitlab-ai-provider", () => ({ VERSION: "test-version", @@ -31,12 +37,7 @@ void mock.module("gitlab-ai-provider", () => ({ const itWithAccount = testEffect( Catalog.locationLayer.pipe( - Layer.provideMerge( - Credential.layer.pipe( - Layer.provide(Database.layerFromPath(":memory:").pipe(Layer.fresh)), - Layer.provide(EventV2.defaultLayer), - ), - ), + Layer.provideMerge(accounts), Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge( Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make("/") }))), @@ -174,8 +175,7 @@ describe("GitLabPlugin", () => { const credentials = yield* Credential.Service const catalog = yield* Catalog.Service yield* credentials.create({ - connectorID: Connector.ID.make("gitlab"), - methodID: Connector.MethodID.make("api-key"), + integrationID: Integration.ID.make("gitlab"), value: new Credential.Key({ type: "key", key: "account-token" }), }) yield* plugin.add(GitLabPlugin) @@ -208,10 +208,10 @@ describe("GitLabPlugin", () => { const credentials = yield* Credential.Service const catalog = yield* Catalog.Service yield* credentials.create({ - connectorID: Connector.ID.make("gitlab"), - methodID: Connector.MethodID.make("oauth"), + integrationID: Integration.ID.make("gitlab"), value: new Credential.OAuth({ type: "oauth", + methodID: Integration.MethodID.make("oauth"), refresh: "refresh-token", access: "account-oauth-token", expires: 9999999999999, diff --git a/packages/core/test/plugin/provider-helper.ts b/packages/core/test/plugin/provider-helper.ts index cc8ebbf396..f9334480d1 100644 --- a/packages/core/test/plugin/provider-helper.ts +++ b/packages/core/test/plugin/provider-helper.ts @@ -3,7 +3,7 @@ import type { LanguageModelV3 } from "@ai-sdk/provider" import { expect } from "bun:test" import { Effect, Layer, Option } from "effect" import { Catalog } from "@opencode-ai/core/catalog" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { Credential } from "@opencode-ai/core/credential" import { EventV2 } from "@opencode-ai/core/event" import { Location } from "@opencode-ai/core/location" @@ -48,15 +48,24 @@ export const catalogLayer = Layer.succeed( }), ) -const connectors = Connector.locationLayer.pipe( +const integrations = Integration.locationLayer.pipe( Layer.provide(EventV2.defaultLayer), - Layer.provide(Layer.mock(Credential.Service)({ create: () => Effect.die("unexpected credential creation") })), + Layer.provide( + Layer.mock(Credential.Service)({ + create: () => Effect.die("unexpected credential creation"), + list: () => Effect.succeed([]), + }), + ), ) export const it = testEffect( Catalog.locationLayer.pipe( - Layer.provideMerge(connectors), - Layer.provideMerge(Layer.mock(Credential.Service)({ activeAll: () => Effect.succeed(new Map()) })), + Layer.provideMerge(integrations), + Layer.provideMerge( + Layer.mock(Credential.Service)({ + all: () => Effect.succeed([]), + }), + ), Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge(locationLayer), Layer.provideMerge(npmLayer), diff --git a/packages/core/test/plugin/provider-openai.test.ts b/packages/core/test/plugin/provider-openai.test.ts index f67a4e9449..a317ba4bf7 100644 --- a/packages/core/test/plugin/provider-openai.test.ts +++ b/packages/core/test/plugin/provider-openai.test.ts @@ -1,17 +1,17 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" import { Catalog } from "@opencode-ai/core/catalog" -import { Connector } from "@opencode-ai/core/connector" +import { Integration } from "@opencode-ai/core/integration" import { ModelV2 } from "@opencode-ai/core/model" import { PluginV2 } from "@opencode-ai/core/plugin" import { OpenAIPlugin } from "@opencode-ai/core/plugin/provider/openai" import { ProviderV2 } from "@opencode-ai/core/provider" import { fakeSelectorSdk, it, model, provider } from "./provider-helper" -function add(plugin: PluginV2.Interface, connectors: Connector.Interface) { +function add(plugin: PluginV2.Interface, integrations: Integration.Interface) { return plugin.add({ ...OpenAIPlugin, - effect: OpenAIPlugin.effect.pipe(Effect.provideService(Connector.Service, connectors)), + effect: OpenAIPlugin.effect.pipe(Effect.provideService(Integration.Service, integrations)), }) } @@ -19,15 +19,15 @@ describe("OpenAIPlugin", () => { it.effect("registers browser and headless ChatGPT OAuth methods", () => Effect.gen(function* () { const plugin = yield* PluginV2.Service - yield* add(plugin, yield* Connector.Service) - expect((yield* (yield* Connector.Service).get(Connector.ID.make("openai")))?.methods).toEqual([ - new Connector.OAuthMethod({ - id: Connector.MethodID.make("chatgpt-browser"), + yield* add(plugin, yield* Integration.Service) + expect((yield* (yield* Integration.Service).get(Integration.ID.make("openai")))?.methods).toEqual([ + new Integration.OAuthMethod({ + id: Integration.MethodID.make("chatgpt-browser"), type: "oauth", label: "ChatGPT Pro/Plus (browser)", }), - new Connector.OAuthMethod({ - id: Connector.MethodID.make("chatgpt-headless"), + new Integration.OAuthMethod({ + id: Integration.MethodID.make("chatgpt-headless"), type: "oauth", label: "ChatGPT Pro/Plus (headless)", }), @@ -38,7 +38,7 @@ describe("OpenAIPlugin", () => { it.effect("creates an OpenAI SDK for @ai-sdk/openai using the provider ID as SDK name", () => Effect.gen(function* () { const plugin = yield* PluginV2.Service - yield* add(plugin, yield* Connector.Service) + yield* add(plugin, yield* Integration.Service) const result = yield* plugin.trigger( "aisdk.sdk", { @@ -55,7 +55,7 @@ describe("OpenAIPlugin", () => { it.effect("ignores non-OpenAI SDK packages", () => Effect.gen(function* () { const plugin = yield* PluginV2.Service - yield* add(plugin, yield* Connector.Service) + yield* add(plugin, yield* Integration.Service) const result = yield* plugin.trigger( "aisdk.sdk", { model: model("openai", "gpt-5"), package: "@ai-sdk/openai-compatible", options: { name: "openai" } }, @@ -69,7 +69,7 @@ describe("OpenAIPlugin", () => { Effect.gen(function* () { const plugin = yield* PluginV2.Service const calls: string[] = [] - yield* add(plugin, yield* Connector.Service) + yield* add(plugin, yield* Integration.Service) const result = yield* plugin.trigger( "aisdk.language", { @@ -90,7 +90,7 @@ describe("OpenAIPlugin", () => { Effect.gen(function* () { const plugin = yield* PluginV2.Service const calls: string[] = [] - yield* add(plugin, yield* Connector.Service) + yield* add(plugin, yield* Integration.Service) const result = yield* plugin.trigger( "aisdk.language", { model: model("anthropic", "gpt-5"), sdk: fakeSelectorSdk(calls), options: {} }, @@ -105,7 +105,7 @@ describe("OpenAIPlugin", () => { Effect.gen(function* () { const plugin = yield* PluginV2.Service const catalog = yield* Catalog.Service - yield* add(plugin, yield* Connector.Service) + yield* add(plugin, yield* Integration.Service) const transform = yield* catalog.transform() yield* transform((catalog) => { const item = provider("openai", { api: { type: "aisdk", package: "@ai-sdk/openai" } }) @@ -124,7 +124,7 @@ describe("OpenAIPlugin", () => { Effect.gen(function* () { const plugin = yield* PluginV2.Service const catalog = yield* Catalog.Service - yield* add(plugin, yield* Connector.Service) + yield* add(plugin, yield* Integration.Service) const transform = yield* catalog.transform() yield* transform((catalog) => { const item = provider("custom-openai") diff --git a/packages/core/test/plugin/provider-snowflake-cortex.test.ts b/packages/core/test/plugin/provider-snowflake-cortex.test.ts index f702945978..ff5ec4ba45 100644 --- a/packages/core/test/plugin/provider-snowflake-cortex.test.ts +++ b/packages/core/test/plugin/provider-snowflake-cortex.test.ts @@ -72,6 +72,48 @@ describe("SnowflakeCortexPlugin", () => { ), ) + it.effect("uses SNOWFLAKE_CORTEX_TOKEN env var", () => + withEnv({ SNOWFLAKE_CORTEX_TOKEN: "oauth-token", SNOWFLAKE_CORTEX_PAT: undefined }, () => + Effect.gen(function* () { + const plugin = yield* PluginV2.Service + yield* plugin.add(SnowflakeCortexPlugin) + const result = yield* plugin.trigger( + "aisdk.sdk", + { + model: model("snowflake-cortex", "claude-sonnet-4-6"), + package: "@ai-sdk/openai-compatible", + options: { name: "snowflake-cortex", baseURL: "https://test.snowflakecomputing.com/api/v2/cortex/v1" }, + }, + {}, + ) + expect(result.sdk).toBeDefined() + }), + ), + ) + + it.effect("falls back to options.token when no Snowflake env token is set", () => + withEnv({ SNOWFLAKE_CORTEX_TOKEN: undefined, SNOWFLAKE_CORTEX_PAT: undefined }, () => + Effect.gen(function* () { + const plugin = yield* PluginV2.Service + yield* plugin.add(SnowflakeCortexPlugin) + const result = yield* plugin.trigger( + "aisdk.sdk", + { + model: model("snowflake-cortex", "claude-sonnet-4-6"), + package: "@ai-sdk/openai-compatible", + options: { + name: "snowflake-cortex", + baseURL: "https://test.snowflakecomputing.com/api/v2/cortex/v1", + token: "options-token", + }, + }, + {}, + ) + expect(result.sdk).toBeDefined() + }), + ), + ) + it.effect("sets includeUsage on the SDK options", () => withEnv({ SNOWFLAKE_CORTEX_PAT: "test-pat" }, () => Effect.gen(function* () { diff --git a/packages/core/test/project-copy.test.ts b/packages/core/test/project-copy.test.ts index f1ba10fb09..823d8d842e 100644 --- a/packages/core/test/project-copy.test.ts +++ b/packages/core/test/project-copy.test.ts @@ -12,23 +12,28 @@ import { EventV2 } from "@opencode-ai/core/event" import { Project } from "@opencode-ai/core/project" import { ProjectDirectoryTable, ProjectTable } from "@opencode-ai/core/project/sql" import { ProjectCopy } from "@opencode-ai/core/project/copy" +import { ProjectDirectories } from "@opencode-ai/core/project/directories" import { tmpdir } from "./fixture/tmpdir" import { testEffect } from "./lib/effect" const databaseLayer = Database.layerFromPath(":memory:") const eventLayer = EventV2.layer.pipe(Layer.provide(databaseLayer)) +const directoriesLayer = ProjectDirectories.layer.pipe(Layer.provide(databaseLayer)) const copyLayer = ProjectCopy.layer.pipe( Layer.provide(databaseLayer), + Layer.provide(directoriesLayer), Layer.provide(eventLayer), Layer.provide(FSUtil.defaultLayer), Layer.provide(Git.defaultLayer), ) -const it = testEffect(Layer.mergeAll(copyLayer, databaseLayer, eventLayer)) +const it = testEffect(Layer.mergeAll(copyLayer, databaseLayer, eventLayer, directoriesLayer)) function abs(input: string) { return AbsolutePath.make(input) } +const gitWorktree = ProjectCopy.StrategyID.make("git_worktree") + async function initRepo(directory: string) { await $`git init`.cwd(directory).quiet() await $`git config core.fsmonitor false`.cwd(directory).quiet() @@ -55,7 +60,7 @@ function setup() { .pipe(Effect.orDie) yield* db .insert(ProjectDirectoryTable) - .values({ project_id: projectID, directory: sourceDirectory, type: "main" }) + .values({ project_id: projectID, directory: sourceDirectory }) .run() .pipe(Effect.orDie) return { root, sourceDirectory, projectID, db } @@ -65,7 +70,7 @@ function setup() { function stored(projectID: Project.ID) { return Database.Service.use(({ db }) => db - .select({ directory: ProjectDirectoryTable.directory, type: ProjectDirectoryTable.type }) + .select({ directory: ProjectDirectoryTable.directory, strategy: ProjectDirectoryTable.strategy }) .from(ProjectDirectoryTable) .where(eq(ProjectDirectoryTable.project_id, projectID)) .all() @@ -77,18 +82,40 @@ function stored(projectID: Project.ID) { } describe("ProjectCopy", () => { - it.live("detects linked git worktrees but not root checkouts", () => + it.effect("accepts arbitrary non-empty strategy ids", () => + Effect.sync(() => { + expect(String(ProjectCopy.StrategyID.make("acme/snapshot"))).toBe("acme/snapshot") + expect(() => ProjectCopy.StrategyID.make(" acme/snapshot ")).toThrow() + expect(() => ProjectCopy.StrategyID.make(" ")).toThrow() + }), + ) + + it.effect("rejects duplicate strategies and reports unavailable ids", () => Effect.gen(function* () { const input = yield* setup() const copy = yield* ProjectCopy.Service - const target = abs(`${input.root.path}-copy-detected`) - yield* Effect.addFinalizer(() => - Effect.promise(() => fs.rm(target, { recursive: true, force: true })).pipe(Effect.ignore), - ) - yield* Effect.promise(() => $`git worktree add --detach ${target} HEAD`.cwd(input.root.path).quiet()) + const strategy: ProjectCopy.Strategy = { + id: ProjectCopy.StrategyID.make("test/duplicate"), + create: () => Effect.die("unused"), + remove: () => Effect.die("unused"), + list: () => Effect.succeed([]), + } - expect(yield* copy.detect({ directory: input.sourceDirectory })).toBeUndefined() - expect(yield* copy.detect({ directory: target })).toBe("git_worktree") + yield* copy.register(strategy) + expect(yield* copy.register(strategy).pipe(Effect.flip)).toBeInstanceOf(ProjectCopy.DuplicateStrategyError) + + const unavailable = ProjectCopy.StrategyID.make("acme/missing") + const error = yield* copy + .create({ + projectID: input.projectID, + strategy: unavailable, + sourceDirectory: input.sourceDirectory, + directory: abs(`${input.root.path}-missing-strategy`), + name: "copy", + }) + .pipe(Effect.flip) + expect(error).toBeInstanceOf(ProjectCopy.StrategyUnavailableError) + if (error instanceof ProjectCopy.StrategyUnavailableError) expect(error.strategy).toBe(unavailable) }), ) @@ -110,7 +137,7 @@ describe("ProjectCopy", () => { const created = yield* copy.create({ projectID: input.projectID, - strategy: "git_worktree", + strategy: gitWorktree, sourceDirectory: input.sourceDirectory, directory: parent, name: "copy", @@ -118,15 +145,15 @@ describe("ProjectCopy", () => { expect(created.directory).toBe(target) expect(yield* stored(input.projectID)).toEqual( [ - { directory: input.sourceDirectory, type: "main" as const }, - { directory: created.directory, type: "git_worktree" as const }, + { directory: input.sourceDirectory, strategy: null }, + { directory: created.directory, strategy: "git_worktree" }, ].toSorted((a, b) => a.directory.localeCompare(b.directory)), ) expect(Array.from(yield* Fiber.join(fiber))[0]?.data).toEqual({ projectID: input.projectID }) yield* copy.remove({ projectID: input.projectID, directory: created.directory, force: false }) - expect(yield* stored(input.projectID)).toEqual([{ directory: input.sourceDirectory, type: "main" as const }]) + expect(yield* stored(input.projectID)).toEqual([{ directory: input.sourceDirectory, strategy: null }]) expect(yield* Effect.promise(() => Bun.file(target).exists())).toBe(false) }), ) @@ -142,7 +169,7 @@ describe("ProjectCopy", () => { ) const created = yield* copy.create({ projectID: input.projectID, - strategy: "git_worktree", + strategy: gitWorktree, sourceDirectory: input.sourceDirectory, directory: parent, name: "copy", @@ -158,7 +185,7 @@ describe("ProjectCopy", () => { expect(error.operation).toBe("remove") expect(error.forceRequired).toBe(true) } - expect(yield* stored(input.projectID)).toContainEqual({ directory: created.directory, type: "git_worktree" }) + expect(yield* stored(input.projectID)).toContainEqual({ directory: created.directory, strategy: "git_worktree" }) expect(yield* Effect.promise(() => Bun.file(path.join(created.directory, "dirty.txt")).exists())).toBe(true) yield* copy.remove({ projectID: input.projectID, directory: created.directory, force: true }) @@ -166,6 +193,28 @@ describe("ProjectCopy", () => { }), ) + it.live("preserves copies whose stored strategy is unavailable", () => + Effect.gen(function* () { + const input = yield* setup() + const copy = yield* ProjectCopy.Service + const unavailable = abs(`${input.root.path}-copy-unavailable`) + yield* Effect.promise(() => fs.mkdir(unavailable)) + yield* Effect.addFinalizer(() => Effect.promise(() => fs.rm(unavailable, { recursive: true, force: true }))) + yield* input.db + .insert(ProjectDirectoryTable) + .values({ project_id: input.projectID, directory: unavailable, strategy: "acme/missing" }) + .run() + .pipe(Effect.orDie) + + const error = yield* copy + .remove({ projectID: input.projectID, directory: unavailable, force: false }) + .pipe(Effect.flip) + + expect(error).toBeInstanceOf(ProjectCopy.StrategyUnavailableError) + expect(yield* stored(input.projectID)).toContainEqual({ directory: unavailable, strategy: "acme/missing" }) + }), + ) + it.live("adds a numeric suffix when a copy directory already exists", () => Effect.gen(function* () { const input = yield* setup() @@ -181,7 +230,7 @@ describe("ProjectCopy", () => { const created = yield* copy.create({ projectID: input.projectID, - strategy: "git_worktree", + strategy: gitWorktree, sourceDirectory: input.sourceDirectory, directory: parent, name: "copy", @@ -219,7 +268,7 @@ describe("ProjectCopy", () => { const error = yield* copy .create({ projectID: input.projectID, - strategy: "git_worktree", + strategy: gitWorktree, sourceDirectory: input.sourceDirectory, directory: parent, name: "copy", @@ -227,7 +276,8 @@ describe("ProjectCopy", () => { .pipe(Effect.flip) expect(error).toBeInstanceOf(ProjectCopy.DestinationExistsError) - expect(error.directory).toBe(abs(path.join(parent, "copy-10"))) + if (error instanceof ProjectCopy.DestinationExistsError) + expect(error.directory).toBe(abs(path.join(parent, "copy-10"))) }), ) @@ -263,25 +313,30 @@ describe("ProjectCopy", () => { Effect.promise(() => fs.rm(target, { recursive: true, force: true })).pipe(Effect.ignore), ) yield* Effect.promise(() => $`git worktree add --detach ${target} HEAD`.cwd(input.root.path).quiet()) + yield* input.db + .insert(ProjectDirectoryTable) + .values({ project_id: input.projectID, directory: target }) + .run() + .pipe(Effect.orDie) const fiber = yield* events .subscribe(ProjectCopy.Event.Updated) .pipe(Stream.take(1), Stream.runCollect, Effect.forkScoped) yield* Effect.yieldNow - yield* copy.refresh({ projectID: input.projectID }) - const discovered = abs(yield* Effect.promise(() => fs.realpath(target))) + expect(yield* copy.refresh({ projectID: input.projectID })).toEqual({ updated: [discovered], removed: [] }) + expect(yield* stored(input.projectID)).toEqual( [ - { directory: input.sourceDirectory, type: "main" as const }, - { directory: discovered, type: "git_worktree" as const }, + { directory: input.sourceDirectory, strategy: null }, + { directory: discovered, strategy: "git_worktree" }, ].toSorted((a, b) => a.directory.localeCompare(b.directory)), ) expect(Array.from(yield* Fiber.join(fiber))[0]?.data).toEqual({ projectID: input.projectID }) yield* Effect.promise(() => $`git worktree remove --force ${target}`.cwd(input.root.path).quiet()) - yield* copy.refresh({ projectID: input.projectID }) - expect(yield* stored(input.projectID)).toEqual([{ directory: input.sourceDirectory, type: "main" as const }]) + expect(yield* copy.refresh({ projectID: input.projectID })).toEqual({ updated: [], removed: [discovered] }) + expect(yield* stored(input.projectID)).toEqual([{ directory: input.sourceDirectory, strategy: null }]) }), ) @@ -303,8 +358,8 @@ describe("ProjectCopy", () => { const discovered = abs(yield* Effect.promise(() => fs.realpath(target))) expect(yield* stored(input.projectID)).toEqual( [ - { directory: input.sourceDirectory, type: "main" as const }, - { directory: discovered, type: "git_worktree" as const }, + { directory: input.sourceDirectory, strategy: null }, + { directory: discovered, strategy: "git_worktree" }, ].toSorted((a, b) => a.directory.localeCompare(b.directory)), ) }), @@ -314,7 +369,27 @@ describe("ProjectCopy", () => { Effect.gen(function* () { const copy = yield* ProjectCopy.Service - yield* copy.refresh({ projectID: Project.ID.make("missing-project") }) + expect(yield* copy.refresh({ projectID: Project.ID.make("missing-project") })).toEqual({ + updated: [], + removed: [], + }) + }), + ) + + it.live("refresh removes missing ordinary checkouts", () => + Effect.gen(function* () { + const input = yield* setup() + const missing = abs(`${input.root.path}-missing-checkout`) + yield* input.db + .insert(ProjectDirectoryTable) + .values({ project_id: input.projectID, directory: missing }) + .run() + .pipe(Effect.orDie) + const copy = yield* ProjectCopy.Service + + expect(yield* copy.refresh({ projectID: input.projectID })).toEqual({ updated: [], removed: [missing] }) + + expect(yield* stored(input.projectID)).not.toContainEqual({ directory: missing, strategy: null }) }), ) }) diff --git a/packages/core/test/project-directories.test.ts b/packages/core/test/project-directories.test.ts new file mode 100644 index 0000000000..c1d2d8801f --- /dev/null +++ b/packages/core/test/project-directories.test.ts @@ -0,0 +1,63 @@ +import { describe, expect } from "bun:test" +import { Effect, Layer, Schema } from "effect" +import { Database } from "@opencode-ai/core/database/database" +import { EventV2 } from "@opencode-ai/core/event" +import { Project } from "@opencode-ai/core/project" +import { ProjectDirectories } from "@opencode-ai/core/project/directories" +import { ProjectTable } from "@opencode-ai/core/project/sql" +import { AbsolutePath } from "@opencode-ai/core/schema" +import { testEffect } from "./lib/effect" + +const database = Database.layerFromPath(":memory:") +const events = EventV2.layer.pipe(Layer.provide(database)) +const directories = ProjectDirectories.layer.pipe(Layer.provide(database), Layer.provide(events)) +const it = testEffect(Layer.mergeAll(database, events, directories)) + +const projectID = Project.ID.make("project-directories") +const directory = AbsolutePath.make("/tmp/project-directories") + +function setup() { + return Database.Service.use(({ db }) => + db + .insert(ProjectTable) + .values({ id: projectID, worktree: directory, sandboxes: [], time_created: 1, time_updated: 1 }) + .onConflictDoNothing() + .run() + .pipe(Effect.orDie), + ) +} + +describe("ProjectDirectories", () => { + it.effect("decodes directory schemas", () => + Effect.sync(() => { + expect(Schema.decodeUnknownSync(ProjectDirectories.ListInput)({ projectID })).toEqual({ projectID }) + expect(Schema.decodeUnknownSync(ProjectDirectories.ListOutput)([{ directory }])).toEqual([{ directory }]) + }), + ) + + it.effect("creates once and ignores conflicts", () => + Effect.gen(function* () { + yield* setup() + const service = yield* ProjectDirectories.Service + + expect(yield* service.create({ projectID, directory })).toBe(true) + expect(yield* service.create({ projectID, directory, strategy: "git_worktree" })).toBe(false) + expect(yield* service.list(projectID)).toEqual([{ directory, strategy: undefined }]) + }), + ) + + it.effect("replaces the strategy when requested", () => + Effect.gen(function* () { + yield* setup() + const service = yield* ProjectDirectories.Service + yield* service.create({ projectID, directory, strategy: "old/strategy" }) + + expect(yield* service.create({ projectID, directory, strategy: "new/strategy", behavior: "replace" })).toBe(true) + expect(yield* service.create({ projectID, directory, strategy: "new/strategy", behavior: "replace" })).toBe(false) + expect(yield* service.create({ projectID, directory, behavior: "replace" })).toBe(true) + expect(yield* service.create({ projectID, directory, behavior: "replace" })).toBe(false) + expect(yield* service.create({ projectID, directory, strategy: "new/strategy", behavior: "replace" })).toBe(true) + expect(yield* service.list(projectID)).toEqual([{ directory, strategy: "new/strategy" }]) + }), + ) +}) diff --git a/packages/core/test/project.test.ts b/packages/core/test/project.test.ts index 3608939d7b..45fba0d18f 100644 --- a/packages/core/test/project.test.ts +++ b/packages/core/test/project.test.ts @@ -4,24 +4,27 @@ import fs from "fs/promises" import path from "path" import { Effect, Layer, Schema } from "effect" import { ProjectV2 } from "@opencode-ai/core/project" -import { ProjectDirectoryTable, ProjectTable } from "@opencode-ai/core/project/sql" import { Database } from "@opencode-ai/core/database/database" import { FSUtil } from "@opencode-ai/core/fs-util" import { Git } from "@opencode-ai/core/git" import { AbsolutePath } from "@opencode-ai/core/schema" import { Hash } from "@opencode-ai/core/util/hash" +import { ProjectDirectories } from "@opencode-ai/core/project/directories" import { tmpdir } from "./fixture/tmpdir" import { testEffect } from "./lib/effect" const databaseLayer = Database.layerFromPath(":memory:") +const directoriesLayer = ProjectDirectories.layer.pipe(Layer.provide(databaseLayer)) const it = testEffect( Layer.mergeAll( ProjectV2.layer.pipe( - Layer.provide(databaseLayer), Layer.provide(FSUtil.defaultLayer), Layer.provide(Git.defaultLayer), + Layer.provide(directoriesLayer), + Layer.provide(databaseLayer), ), databaseLayer, + directoriesLayer, ), ) @@ -51,54 +54,6 @@ async function rootCommit(dir: string) { return (await $`git rev-list --max-parents=0 HEAD`.cwd(dir).text()).trim() } -describe("Project directories schemas", () => { - it.effect("decodes project directory input and inline directory results", () => - Effect.sync(() => { - expect(Schema.decodeUnknownSync(ProjectV2.DirectoriesInput)({ projectID: ProjectV2.ID.make("project") })).toEqual( - { - projectID: ProjectV2.ID.make("project"), - }, - ) - expect( - Schema.decodeUnknownSync(ProjectV2.Directories)([ - { directory: AbsolutePath.make("/tmp/project"), type: "main" }, - ]), - ).toEqual([{ directory: AbsolutePath.make("/tmp/project"), type: "main" }]) - }), - ) - - it.effect("lists stored project directories newest first for the requested project", () => - Effect.gen(function* () { - const project = yield* ProjectV2.Service - const { db } = yield* Database.Service - const projectID = ProjectV2.ID.make("directories-project") - const otherID = ProjectV2.ID.make("directories-other") - yield* db - .insert(ProjectTable) - .values([ - { id: projectID, worktree: AbsolutePath.make("/repo"), sandboxes: [], time_created: 1, time_updated: 1 }, - { id: otherID, worktree: AbsolutePath.make("/other"), sandboxes: [], time_created: 1, time_updated: 1 }, - ]) - .run() - .pipe(Effect.orDie) - yield* db - .insert(ProjectDirectoryTable) - .values([ - { project_id: projectID, directory: AbsolutePath.make("/repo/z"), type: "root", time_created: 2 }, - { project_id: projectID, directory: AbsolutePath.make("/repo/a"), type: "main", time_created: 1 }, - { project_id: otherID, directory: AbsolutePath.make("/other"), type: "main", time_created: 3 }, - ]) - .run() - .pipe(Effect.orDie) - - expect(yield* project.directories({ projectID })).toEqual([ - { directory: AbsolutePath.make("/repo/z"), type: "root" }, - { directory: AbsolutePath.make("/repo/a"), type: "main" }, - ]) - }), - ) -}) - describe("ProjectV2.resolve", () => { it.live("returns global for non-git directory", () => Effect.gen(function* () { diff --git a/packages/effect-drizzle-sqlite/package.json b/packages/effect-drizzle-sqlite/package.json index 555c28b4ab..07e50d2804 100644 --- a/packages/effect-drizzle-sqlite/package.json +++ b/packages/effect-drizzle-sqlite/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "7.4.7", + "version": "7.4.11", "name": "@opencode-ai/effect-drizzle-sqlite", "type": "module", "license": "MIT", diff --git a/packages/effect-sqlite-node/package.json b/packages/effect-sqlite-node/package.json index 089a702194..2df1487fac 100644 --- a/packages/effect-sqlite-node/package.json +++ b/packages/effect-sqlite-node/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "7.4.7", + "version": "7.4.11", "name": "@opencode-ai/effect-sqlite-node", "type": "module", "license": "MIT", diff --git a/packages/http-recorder/package.json b/packages/http-recorder/package.json index 1ad3d1a005..9026560bb4 100644 --- a/packages/http-recorder/package.json +++ b/packages/http-recorder/package.json @@ -1,13 +1,13 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "7.4.7", + "version": "7.4.11", "name": "@opencode-ai/http-recorder", "description": "Record and replay Effect HTTP client traffic with deterministic cassettes", "type": "module", "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/anomalyco/opencode.git", + "url": "git+https://github.com/Kilo-Org/kilocode.git", "directory": "packages/http-recorder" }, "homepage": "https://github.com/anomalyco/opencode/tree/dev/packages/http-recorder", diff --git a/packages/llm/package.json b/packages/llm/package.json index e4c42c119b..c78418fbde 100644 --- a/packages/llm/package.json +++ b/packages/llm/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "7.4.7", + "version": "7.4.11", "name": "@opencode-ai/llm", "type": "module", "license": "MIT", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index d1cab7d1c3..f62473bbc1 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "7.4.7", + "version": "7.4.11", "name": "@kilocode/cli", "type": "module", "license": "MIT", diff --git a/packages/opencode/src/cli/cmd/providers.ts b/packages/opencode/src/cli/cmd/providers.ts index 22b0aadf27..b52496e074 100644 --- a/packages/opencode/src/cli/cmd/providers.ts +++ b/packages/opencode/src/cli/cmd/providers.ts @@ -477,25 +477,6 @@ export const ProvidersLoginCommand = effectCmd({ ) } - if (provider === "snowflake-cortex") { - const account = yield* promptValue( - yield* Prompt.text({ - message: "Snowflake Account Identifier", - placeholder: "xy12345.us-east-1", - validate: (x) => (x && x.length > 0 ? undefined : "Required"), - }), - ) - const pat = yield* promptValue( - yield* Prompt.password({ - message: "Programmatic Access Token (PAT)", - validate: (x) => (x && x.length > 0 ? undefined : "Required"), - }), - ) - yield* Effect.orDie(authSvc.set(provider, { type: "api", key: pat, metadata: { account } })) - yield* Prompt.outro("Done") - return - } - const key = yield* Prompt.password({ message: "Enter your API key", validate: (x) => (x && x.length > 0 ? undefined : "Required"), diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts index ac8e5b0e65..f6b18129a9 100644 --- a/packages/opencode/src/cli/cmd/run.ts +++ b/packages/opencode/src/cli/cmd/run.ts @@ -840,7 +840,10 @@ export const RunCommand = effectCmd({ const fetchFn = (async (input: RequestInfo | URL, init?: RequestInit) => { const { Server } = await import("@/server/server") const request = new Request(input, init) - return Server.Default().app.fetch(request) + const headers = new Headers(request.headers) + const auth = ServerAuth.header() + if (auth) headers.set("Authorization", auth) + return Server.Default().app.fetch(new Request(request, { headers })) }) as typeof globalThis.fetch try { @@ -875,7 +878,10 @@ export const RunCommand = effectCmd({ const fetchFn = (async (input: RequestInfo | URL, init?: RequestInit) => { const { Server } = await import("@/server/server") const request = new Request(input, init) - return Server.Default().app.fetch(request) + const headers = new Headers(request.headers) + const auth = ServerAuth.header() + if (auth) headers.set("Authorization", auth) + return Server.Default().app.fetch(new Request(request, { headers })) }) as typeof globalThis.fetch const sdk = createKiloClient({ baseUrl: "http://kilo.internal", diff --git a/packages/opencode/src/cli/cmd/run/footer.command.tsx b/packages/opencode/src/cli/cmd/run/footer.command.tsx index 27c1e98998..c97af0ce09 100644 --- a/packages/opencode/src/cli/cmd/run/footer.command.tsx +++ b/packages/opencode/src/cli/cmd/run/footer.command.tsx @@ -202,7 +202,6 @@ function match(query: string, entries: T[]) { } function PanelShell(props: { - id: string title: string countVisible?: boolean query: string @@ -279,7 +278,7 @@ function PanelShell(props: { ) return ( - + {minimal() ? ( {content} @@ -298,14 +297,7 @@ function PanelShell(props: { )} {minimal() ? ( - + ) : ( ; limit?: } export function RunFooterMenu(props: { - id?: string theme: Accessor items: Accessor selected: Accessor @@ -226,7 +225,6 @@ export function RunFooterMenu(props: { } return ( + - + +