teamcopilot 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +10 -0
- package/LICENSE.md +21 -0
- package/README.md +131 -0
- package/bin/teamcopilot.js +281 -0
- package/dist/auth/index.js +189 -0
- package/dist/change-user-role.js +77 -0
- package/dist/chat/index.js +849 -0
- package/dist/constants.js +2 -0
- package/dist/create-user.js +98 -0
- package/dist/cronjob/index.js +16 -0
- package/dist/cronjob/resource-reconciliation.js +33 -0
- package/dist/delete-user.js +66 -0
- package/dist/frontend/assets/abap-CRCWOmpq.js +1 -0
- package/dist/frontend/assets/apex-DnsZk_dE.js +1 -0
- package/dist/frontend/assets/azcli-1IWB1ccx.js +1 -0
- package/dist/frontend/assets/bat-DPkNLes8.js +1 -0
- package/dist/frontend/assets/bicep-Corcdgou.js +2 -0
- package/dist/frontend/assets/cameligo-CGrWLZr3.js +1 -0
- package/dist/frontend/assets/clojure-D9WOWImG.js +1 -0
- package/dist/frontend/assets/codicon-DCmgc-ay.ttf +0 -0
- package/dist/frontend/assets/coffee-B7EJu28W.js +1 -0
- package/dist/frontend/assets/cpp-SEyurbux.js +1 -0
- package/dist/frontend/assets/csharp-BoL64M5l.js +1 -0
- package/dist/frontend/assets/csp-C46ZqvIl.js +1 -0
- package/dist/frontend/assets/css-DQU6DXDx.js +3 -0
- package/dist/frontend/assets/cssMode-BDT3WbVs.js +4 -0
- package/dist/frontend/assets/cypher-D84EuPTj.js +1 -0
- package/dist/frontend/assets/dart-D8lhlL1r.js +1 -0
- package/dist/frontend/assets/dockerfile-DLk6rpji.js +1 -0
- package/dist/frontend/assets/ecl-BO6FnfXk.js +1 -0
- package/dist/frontend/assets/editor.worker-B4pQIWZD.js +12 -0
- package/dist/frontend/assets/elixir-BRjLKONM.js +1 -0
- package/dist/frontend/assets/flow9-Cac8vKd7.js +1 -0
- package/dist/frontend/assets/freemarker2-C7-hEgID.js +3 -0
- package/dist/frontend/assets/fsharp-fd1GTHhf.js +1 -0
- package/dist/frontend/assets/go-O9LJTZXk.js +1 -0
- package/dist/frontend/assets/graphql-LQdxqEYJ.js +1 -0
- package/dist/frontend/assets/handlebars-4cwTkPir.js +1 -0
- package/dist/frontend/assets/hcl-DxDQ3s82.js +1 -0
- package/dist/frontend/assets/html-YNfE1Q0A.js +1 -0
- package/dist/frontend/assets/htmlMode-opTQ1HoB.js +4 -0
- package/dist/frontend/assets/index-DWyaVa1h.js +782 -0
- package/dist/frontend/assets/index-lXrsgeTF.css +1 -0
- package/dist/frontend/assets/ini-BvajGCUy.js +1 -0
- package/dist/frontend/assets/java-SYsfObOQ.js +1 -0
- package/dist/frontend/assets/javascript-BEwGzk7T.js +1 -0
- package/dist/frontend/assets/jsonMode-CGhIS5Al.js +10 -0
- package/dist/frontend/assets/julia-DQXNmw_w.js +1 -0
- package/dist/frontend/assets/kotlin-qQ0MG-9I.js +1 -0
- package/dist/frontend/assets/less-GGFNNJHn.js +2 -0
- package/dist/frontend/assets/lexon-Canl7DCW.js +1 -0
- package/dist/frontend/assets/liquid-QekTGCGJ.js +1 -0
- package/dist/frontend/assets/lua-D28Ae8-K.js +1 -0
- package/dist/frontend/assets/m3-DPitgjJI.js +1 -0
- package/dist/frontend/assets/markdown-B811l8j2.js +1 -0
- package/dist/frontend/assets/mdx-BAVDaB7v.js +1 -0
- package/dist/frontend/assets/mips-CdjsipkG.js +1 -0
- package/dist/frontend/assets/msdax-CYqgjx_P.js +1 -0
- package/dist/frontend/assets/mysql-BHd6q0vd.js +1 -0
- package/dist/frontend/assets/objective-c-B1aVtJYH.js +1 -0
- package/dist/frontend/assets/pascal-BhNW15KB.js +1 -0
- package/dist/frontend/assets/pascaligo-5jv8CcQD.js +1 -0
- package/dist/frontend/assets/perl-DlYyT36c.js +1 -0
- package/dist/frontend/assets/pgsql-Dy0bjov7.js +1 -0
- package/dist/frontend/assets/php-120yhfDK.js +1 -0
- package/dist/frontend/assets/pla-CjnFlu4u.js +1 -0
- package/dist/frontend/assets/postiats-CQpG440k.js +1 -0
- package/dist/frontend/assets/powerquery-DdJtto1Z.js +1 -0
- package/dist/frontend/assets/powershell-Bu_VLpJB.js +1 -0
- package/dist/frontend/assets/protobuf-IBS6jZEB.js +2 -0
- package/dist/frontend/assets/pug-kFxLfcjb.js +1 -0
- package/dist/frontend/assets/python-BQlHw7XO.js +1 -0
- package/dist/frontend/assets/qsharp-q7JyzKFN.js +1 -0
- package/dist/frontend/assets/r-BIFz-_sK.js +1 -0
- package/dist/frontend/assets/razor-Be3Wwc2E.js +1 -0
- package/dist/frontend/assets/redis-CHOsPHWR.js +1 -0
- package/dist/frontend/assets/redshift-CBifECDb.js +1 -0
- package/dist/frontend/assets/restructuredtext-CghPJEOS.js +1 -0
- package/dist/frontend/assets/ruby-CYWGW-b1.js +1 -0
- package/dist/frontend/assets/rust-DMDD0SHb.js +1 -0
- package/dist/frontend/assets/sb-BYAiYHFx.js +1 -0
- package/dist/frontend/assets/scala-Bqvq8jcR.js +1 -0
- package/dist/frontend/assets/scheme-Dhb-2j9p.js +1 -0
- package/dist/frontend/assets/scss-CTwUZ5N7.js +3 -0
- package/dist/frontend/assets/shell-CsDZo4DB.js +1 -0
- package/dist/frontend/assets/solidity-CME5AdoB.js +1 -0
- package/dist/frontend/assets/sophia-RYC1BQQz.js +1 -0
- package/dist/frontend/assets/sparql-KEyrF7De.js +1 -0
- package/dist/frontend/assets/sql-BdTr02Mf.js +1 -0
- package/dist/frontend/assets/st-C7iG7M4S.js +1 -0
- package/dist/frontend/assets/swift-D7IUmUK8.js +1 -0
- package/dist/frontend/assets/systemverilog-DgMryOEJ.js +1 -0
- package/dist/frontend/assets/tcl-PloMZuKG.js +1 -0
- package/dist/frontend/assets/tsMode-CIBFoN3z.js +11 -0
- package/dist/frontend/assets/twig-BfRIq3la.js +1 -0
- package/dist/frontend/assets/typescript-BuV9wEIE.js +1 -0
- package/dist/frontend/assets/typespec-CzxlYoT_.js +1 -0
- package/dist/frontend/assets/vb-BwAE3J76.js +1 -0
- package/dist/frontend/assets/wgsl-B_1kOXbF.js +298 -0
- package/dist/frontend/assets/xml-DcDKYaM4.js +1 -0
- package/dist/frontend/assets/yaml-CuBNmOuI.js +1 -0
- package/dist/frontend/index.html +14 -0
- package/dist/frontend/logo.svg +50 -0
- package/dist/index.js +169 -0
- package/dist/logging.js +30 -0
- package/dist/opencode-auth/index.js +122 -0
- package/dist/opencode-server.js +91 -0
- package/dist/prisma/client.js +38 -0
- package/dist/reset-password.js +73 -0
- package/dist/rotate-jwt-secret.js +20 -0
- package/dist/scripts/prisma-workspace.js +34 -0
- package/dist/skills/index.js +311 -0
- package/dist/types/permissions.js +2 -0
- package/dist/types/shared/permissions.js +17 -0
- package/dist/types/shared/skill.js +17 -0
- package/dist/types/shared/workflow-files.js +17 -0
- package/dist/types/shared/workflow.js +17 -0
- package/dist/types/skill.js +2 -0
- package/dist/types/workflow-files.js +2 -0
- package/dist/types/workflow.js +2 -0
- package/dist/users/index.js +22 -0
- package/dist/utils/approval-snapshot-common.js +596 -0
- package/dist/utils/assert.js +20 -0
- package/dist/utils/chat-session.js +44 -0
- package/dist/utils/cli-bootstrap.js +26 -0
- package/dist/utils/index.js +95 -0
- package/dist/utils/jwt-secret.js +63 -0
- package/dist/utils/opencode-auth.js +126 -0
- package/dist/utils/opencode-client.js +109 -0
- package/dist/utils/password-policy.js +12 -0
- package/dist/utils/permission-common.js +280 -0
- package/dist/utils/redact.js +108 -0
- package/dist/utils/resource-access.js +37 -0
- package/dist/utils/resource-file-routes.js +115 -0
- package/dist/utils/resource-files.js +572 -0
- package/dist/utils/runtime-paths.js +61 -0
- package/dist/utils/session-abort.js +52 -0
- package/dist/utils/skill-approval-snapshot.js +39 -0
- package/dist/utils/skill-files.js +17 -0
- package/dist/utils/skill-permissions.js +15 -0
- package/dist/utils/skill.js +217 -0
- package/dist/utils/user-role.js +14 -0
- package/dist/utils/workflow-approval-snapshot.js +38 -0
- package/dist/utils/workflow-files.js +17 -0
- package/dist/utils/workflow-interruption.js +50 -0
- package/dist/utils/workflow-permissions.js +27 -0
- package/dist/utils/workflow-runner.js +414 -0
- package/dist/utils/workflow.js +158 -0
- package/dist/utils/workspace-sync.js +204 -0
- package/dist/workflows/index.js +751 -0
- package/dist/workspace_files/.opencode/opencode.json +17 -0
- package/dist/workspace_files/.opencode/package.json +14 -0
- package/dist/workspace_files/.opencode/plugins/createSkill.ts +339 -0
- package/dist/workspace_files/.opencode/plugins/createWorkflow.ts +345 -0
- package/dist/workspace_files/.opencode/plugins/findSimilarWorkflow.ts +173 -0
- package/dist/workspace_files/.opencode/plugins/findSkill.ts +211 -0
- package/dist/workspace_files/.opencode/plugins/getSkillContent.ts +135 -0
- package/dist/workspace_files/.opencode/plugins/honeytoken-protection.ts +64 -0
- package/dist/workspace_files/.opencode/plugins/listAvailableSkills.ts +93 -0
- package/dist/workspace_files/.opencode/plugins/listAvailableWorkflows.ts +93 -0
- package/dist/workspace_files/.opencode/plugins/python-protection.ts +184 -0
- package/dist/workspace_files/.opencode/plugins/runWorkflow.ts +168 -0
- package/dist/workspace_files/.opencode/tsconfig.json +16 -0
- package/dist/workspace_files/AGENTS.md +483 -0
- package/dist/workspace_files/package-lock.json +167 -0
- package/dist/workspace_files/package.json +5 -0
- package/package.json +86 -0
- package/prisma/migrations/20260203040755_init/migration.sql +20 -0
- package/prisma/migrations/20260204034845_replace_google_auth_with_email_password/migration.sql +25 -0
- package/prisma/migrations/20260207022226_add_user_role/migration.sql +25 -0
- package/prisma/migrations/20260210161254_add_workflow_runs/migration.sql +16 -0
- package/prisma/migrations/20260211050606_adds_workflow_table/migration.sql +40 -0
- package/prisma/migrations/20260211050750_adds_fkey_constraint/migration.sql +21 -0
- package/prisma/migrations/20260211051912_removes_workflow_table/migration.sql +34 -0
- package/prisma/migrations/20260211052238_changes_workflow_id_to_slug/migration.sql +27 -0
- package/prisma/migrations/20260212051912_add_output_to_workflow_runs/migration.sql +2 -0
- package/prisma/migrations/20260213073006_add_chat_sessions/migration.sql +13 -0
- package/prisma/migrations/20260216053202_add_chat_sessions_opencode_session_id_idx/migration.sql +2 -0
- package/prisma/migrations/20260216053237_drop_redundant_chat_sessions_opencode_idx/migration.sql +2 -0
- package/prisma/migrations/20260219060705_makes/migration.sql +24 -0
- package/prisma/migrations/20260222040542_add_workflow_execution_permissions/migration.sql +18 -0
- package/prisma/migrations/20260222040815_remove_workflow_execution_permissions/migration.sql +10 -0
- package/prisma/migrations/20260222041348_add_workflow_execution_permissions_final/migration.sql +17 -0
- package/prisma/migrations/20260222041741_rename_to_tool_execution_permissions/migration.sql +30 -0
- package/prisma/migrations/20260222041826_simplify_tool_execution_permissions/migration.sql +29 -0
- package/prisma/migrations/20260222041950_add_fields_for_standalone_permissions/migration.sql +32 -0
- package/prisma/migrations/20260222042954_simplify_tool_permissions_table/migration.sql +27 -0
- package/prisma/migrations/20260223073902_add_workflow_run_permissions_tables/migration.sql +23 -0
- package/prisma/migrations/20260225025151_add_workflow_metadata/migration.sql +16 -0
- package/prisma/migrations/20260225031035_merge_workflow_permissions_into_metadata/migration.sql +44 -0
- package/prisma/migrations/20260225031752_removes_default_for_run_permission_mode/migration.sql +20 -0
- package/prisma/migrations/20260225033603_remove_workflow_metadata_user_fkeys/migration.sql +18 -0
- package/prisma/migrations/20260225043032_restore_workflow_metadata_user_fkeys/migration.sql +20 -0
- package/prisma/migrations/20260225091423_add_workflow_approved_snapshots/migration.sql +28 -0
- package/prisma/migrations/20260226032121_add_is_approved_to_workflow_metadata/migration.sql +21 -0
- package/prisma/migrations/20260226032444_undoes_last_db_change/migration.sql +26 -0
- package/prisma/migrations/20260227120000_remove_snapshot_hash_from_approved_snapshots/migration.sql +16 -0
- package/prisma/migrations/20260228071125_adds_workspace_path_to_snapshot_table/migration.sql +22 -0
- package/prisma/migrations/20260228071217_modifies_index_and_removes_default_value/migration.sql +22 -0
- package/prisma/migrations/20260228071710_undoes_previous/migration.sql +27 -0
- package/prisma/migrations/20260228105022_add_must_change_password_first_login/migration.sql +20 -0
- package/prisma/migrations/20260301115439_add_workflow_run_log_refs/migration.sql +8 -0
- package/prisma/migrations/20260301122557_add_workflow_aborted_sessions/migration.sql +5 -0
- package/prisma/migrations/20260302045545_move_workflow_run_log_refs_into_workflow_runs/migration.sql +17 -0
- package/prisma/migrations/20260303040318_add_skill_tables/migration.sql +61 -0
- package/prisma/migrations/20260303051533_unify_resource_permissions/migration.sql +97 -0
- package/prisma/migrations/20260303064255_unify_resource_metadata_and_snapshots/migration.sql +179 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +147 -0
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "teamcopilot",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A shared AI Agent for Teams",
|
|
5
|
+
"homepage": "https://teamcopilot.ai",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/rishabhpoddar/teamcopilot.git"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"bin": {
|
|
12
|
+
"teamcopilot": "bin/teamcopilot.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"dist",
|
|
17
|
+
"prisma",
|
|
18
|
+
".env.example",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rm -rf dist",
|
|
26
|
+
"check:unused:functions": "tsc --noEmit --noUnusedLocals --noUnusedParameters",
|
|
27
|
+
"check:unused:exports": "ts-prune -e -p tsconfig.json -i \"^src/types/shared/\"",
|
|
28
|
+
"check:unused": "npm run check:unused:functions && npm run check:unused:exports",
|
|
29
|
+
"build": "npm run clean && npm run check:unused && cd frontend && npm run build && cd .. && tsc && node scripts/copy-runtime-assets.mjs",
|
|
30
|
+
"start": "node dist/index.js",
|
|
31
|
+
"dev": "concurrently \"npm run dev:backend\" \"npm run dev:frontend\"",
|
|
32
|
+
"dev:backend": "ts-node-dev src/index.ts",
|
|
33
|
+
"dev:frontend": "cd frontend && npm run dev",
|
|
34
|
+
"create-user": "ts-node src/create-user.ts",
|
|
35
|
+
"delete-user": "ts-node src/delete-user.ts",
|
|
36
|
+
"change-user-role": "ts-node src/change-user-role.ts",
|
|
37
|
+
"reset-password": "ts-node src/reset-password.ts",
|
|
38
|
+
"rotate-jwt-secret": "ts-node src/rotate-jwt-secret.ts",
|
|
39
|
+
"prisma": "ts-node src/scripts/prisma-workspace.ts",
|
|
40
|
+
"prisma:migrate:dev": "npm run prisma -- migrate dev",
|
|
41
|
+
"prisma:migrate:reset": "npm run prisma -- migrate reset",
|
|
42
|
+
"prisma:migrate:deploy": "npm run prisma -- migrate deploy",
|
|
43
|
+
"prisma:studio": "npm run prisma -- studio",
|
|
44
|
+
"test": "node -r ts-node/register tests/run-tests.ts",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [],
|
|
48
|
+
"author": "",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@opencode-ai/sdk": "1.1.65",
|
|
52
|
+
"@prisma/client": "^6.0.1",
|
|
53
|
+
"@slack/web-api": "^7.8.0",
|
|
54
|
+
"@supabase/supabase-js": "^2.47.8",
|
|
55
|
+
"@types/bcryptjs": "^2.4.6",
|
|
56
|
+
"@types/cookie-parser": "^1.4.8",
|
|
57
|
+
"@types/cors": "^2.8.17",
|
|
58
|
+
"@types/express": "^5.0.0",
|
|
59
|
+
"@types/jsonwebtoken": "^9.0.9",
|
|
60
|
+
"@types/multer": "^2.0.0",
|
|
61
|
+
"@types/node-cron": "^3.0.11",
|
|
62
|
+
"axios": "^1.7.9",
|
|
63
|
+
"bcryptjs": "^3.0.3",
|
|
64
|
+
"cookie-parser": "^1.4.7",
|
|
65
|
+
"cors": "^2.8.5",
|
|
66
|
+
"cron": "^4.4.0",
|
|
67
|
+
"dotenv": "^16.4.7",
|
|
68
|
+
"express": "^4.21.2",
|
|
69
|
+
"ignore": "^7.0.5",
|
|
70
|
+
"jsonwebtoken": "^9.0.2",
|
|
71
|
+
"multer": "^2.1.0",
|
|
72
|
+
"node-cron": "^3.0.3",
|
|
73
|
+
"openai": "^4.95.1",
|
|
74
|
+
"opencode-ai": "1.1.65",
|
|
75
|
+
"prisma": "^6.0.1",
|
|
76
|
+
"ts-node": "^10.9.2",
|
|
77
|
+
"ts-node-dev": "^2.0.0",
|
|
78
|
+
"twitter-api-v2": "^1.22.0",
|
|
79
|
+
"typescript": "^5.7.2",
|
|
80
|
+
"uuid": "^11.1.0"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"concurrently": "^9.2.1",
|
|
84
|
+
"ts-prune": "^0.10.3"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "users" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"email" TEXT NOT NULL,
|
|
5
|
+
"name" TEXT NOT NULL,
|
|
6
|
+
"created_at" BIGINT NOT NULL,
|
|
7
|
+
"google_user_id" TEXT NOT NULL
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
-- CreateTable
|
|
11
|
+
CREATE TABLE "key_value" (
|
|
12
|
+
"key" TEXT NOT NULL PRIMARY KEY,
|
|
13
|
+
"value" TEXT NOT NULL
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- CreateIndex
|
|
17
|
+
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
|
18
|
+
|
|
19
|
+
-- CreateIndex
|
|
20
|
+
CREATE UNIQUE INDEX "users_google_user_id_key" ON "users"("google_user_id");
|
package/prisma/migrations/20260204034845_replace_google_auth_with_email_password/migration.sql
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `google_user_id` on the `users` table. All the data in the column will be lost.
|
|
5
|
+
- Added the required column `password_hash` to the `users` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- RedefineTables
|
|
9
|
+
PRAGMA defer_foreign_keys=ON;
|
|
10
|
+
PRAGMA foreign_keys=OFF;
|
|
11
|
+
CREATE TABLE "new_users" (
|
|
12
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
13
|
+
"email" TEXT NOT NULL,
|
|
14
|
+
"name" TEXT NOT NULL,
|
|
15
|
+
"created_at" BIGINT NOT NULL,
|
|
16
|
+
"password_hash" TEXT NOT NULL,
|
|
17
|
+
"reset_token" TEXT,
|
|
18
|
+
"reset_token_expires_at" BIGINT
|
|
19
|
+
);
|
|
20
|
+
INSERT INTO "new_users" ("created_at", "email", "id", "name") SELECT "created_at", "email", "id", "name" FROM "users";
|
|
21
|
+
DROP TABLE "users";
|
|
22
|
+
ALTER TABLE "new_users" RENAME TO "users";
|
|
23
|
+
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
|
24
|
+
PRAGMA foreign_keys=ON;
|
|
25
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- Added the required column `role` to the `users` table without a default value. This is not possible if the table is not empty.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- RedefineTables
|
|
8
|
+
PRAGMA defer_foreign_keys=ON;
|
|
9
|
+
PRAGMA foreign_keys=OFF;
|
|
10
|
+
CREATE TABLE "new_users" (
|
|
11
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
12
|
+
"email" TEXT NOT NULL,
|
|
13
|
+
"name" TEXT NOT NULL,
|
|
14
|
+
"role" TEXT NOT NULL,
|
|
15
|
+
"created_at" BIGINT NOT NULL,
|
|
16
|
+
"password_hash" TEXT NOT NULL,
|
|
17
|
+
"reset_token" TEXT,
|
|
18
|
+
"reset_token_expires_at" BIGINT
|
|
19
|
+
);
|
|
20
|
+
INSERT INTO "new_users" ("created_at", "email", "id", "name", "role", "password_hash", "reset_token", "reset_token_expires_at") SELECT "created_at", "email", "id", "name", 'Engineer', "password_hash", "reset_token", "reset_token_expires_at" FROM "users";
|
|
21
|
+
DROP TABLE "users";
|
|
22
|
+
ALTER TABLE "new_users" RENAME TO "users";
|
|
23
|
+
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
|
24
|
+
PRAGMA foreign_keys=ON;
|
|
25
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "workflow_runs" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"workflow_slug" TEXT NOT NULL,
|
|
5
|
+
"workflow_name" TEXT NOT NULL,
|
|
6
|
+
"user_id" TEXT NOT NULL,
|
|
7
|
+
"status" TEXT NOT NULL,
|
|
8
|
+
"started_at" BIGINT NOT NULL,
|
|
9
|
+
"completed_at" BIGINT,
|
|
10
|
+
"args" TEXT,
|
|
11
|
+
"error_message" TEXT,
|
|
12
|
+
CONSTRAINT "workflow_runs_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
-- CreateIndex
|
|
16
|
+
CREATE INDEX "workflow_runs_started_at_idx" ON "workflow_runs"("started_at");
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `user_id` on the `workflow_runs` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `workflow_name` on the `workflow_runs` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `workflow_slug` on the `workflow_runs` table. All the data in the column will be lost.
|
|
7
|
+
- Added the required column `ran_by_user_id` to the `workflow_runs` table without a default value. This is not possible if the table is not empty.
|
|
8
|
+
- Added the required column `workflow_id` to the `workflow_runs` table without a default value. This is not possible if the table is not empty.
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
-- CreateTable
|
|
12
|
+
CREATE TABLE "workflows" (
|
|
13
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
14
|
+
"slug" TEXT NOT NULL,
|
|
15
|
+
"approved_by_user_id" TEXT
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
-- RedefineTables
|
|
19
|
+
PRAGMA defer_foreign_keys=ON;
|
|
20
|
+
PRAGMA foreign_keys=OFF;
|
|
21
|
+
CREATE TABLE "new_workflow_runs" (
|
|
22
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
23
|
+
"ran_by_user_id" TEXT NOT NULL,
|
|
24
|
+
"status" TEXT NOT NULL,
|
|
25
|
+
"started_at" BIGINT NOT NULL,
|
|
26
|
+
"completed_at" BIGINT,
|
|
27
|
+
"args" TEXT,
|
|
28
|
+
"error_message" TEXT,
|
|
29
|
+
"workflow_id" TEXT NOT NULL,
|
|
30
|
+
CONSTRAINT "workflow_runs_workflow_id_fkey" FOREIGN KEY ("workflow_id") REFERENCES "workflows" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
31
|
+
);
|
|
32
|
+
INSERT INTO "new_workflow_runs" ("args", "completed_at", "error_message", "id", "started_at", "status") SELECT "args", "completed_at", "error_message", "id", "started_at", "status" FROM "workflow_runs";
|
|
33
|
+
DROP TABLE "workflow_runs";
|
|
34
|
+
ALTER TABLE "new_workflow_runs" RENAME TO "workflow_runs";
|
|
35
|
+
CREATE INDEX "workflow_runs_started_at_idx" ON "workflow_runs"("started_at");
|
|
36
|
+
PRAGMA foreign_keys=ON;
|
|
37
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
38
|
+
|
|
39
|
+
-- CreateIndex
|
|
40
|
+
CREATE UNIQUE INDEX "workflows_slug_key" ON "workflows"("slug");
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- RedefineTables
|
|
2
|
+
PRAGMA defer_foreign_keys=ON;
|
|
3
|
+
PRAGMA foreign_keys=OFF;
|
|
4
|
+
CREATE TABLE "new_workflow_runs" (
|
|
5
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"ran_by_user_id" TEXT NOT NULL,
|
|
7
|
+
"status" TEXT NOT NULL,
|
|
8
|
+
"started_at" BIGINT NOT NULL,
|
|
9
|
+
"completed_at" BIGINT,
|
|
10
|
+
"args" TEXT,
|
|
11
|
+
"error_message" TEXT,
|
|
12
|
+
"workflow_id" TEXT NOT NULL,
|
|
13
|
+
CONSTRAINT "workflow_runs_workflow_id_fkey" FOREIGN KEY ("workflow_id") REFERENCES "workflows" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
|
14
|
+
CONSTRAINT "workflow_runs_ran_by_user_id_fkey" FOREIGN KEY ("ran_by_user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
15
|
+
);
|
|
16
|
+
INSERT INTO "new_workflow_runs" ("args", "completed_at", "error_message", "id", "ran_by_user_id", "started_at", "status", "workflow_id") SELECT "args", "completed_at", "error_message", "id", "ran_by_user_id", "started_at", "status", "workflow_id" FROM "workflow_runs";
|
|
17
|
+
DROP TABLE "workflow_runs";
|
|
18
|
+
ALTER TABLE "new_workflow_runs" RENAME TO "workflow_runs";
|
|
19
|
+
CREATE INDEX "workflow_runs_started_at_idx" ON "workflow_runs"("started_at");
|
|
20
|
+
PRAGMA foreign_keys=ON;
|
|
21
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `workflows` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropIndex
|
|
8
|
+
DROP INDEX "workflows_slug_key";
|
|
9
|
+
|
|
10
|
+
-- DropTable
|
|
11
|
+
PRAGMA foreign_keys=off;
|
|
12
|
+
DROP TABLE "workflows";
|
|
13
|
+
PRAGMA foreign_keys=on;
|
|
14
|
+
|
|
15
|
+
-- RedefineTables
|
|
16
|
+
PRAGMA defer_foreign_keys=ON;
|
|
17
|
+
PRAGMA foreign_keys=OFF;
|
|
18
|
+
CREATE TABLE "new_workflow_runs" (
|
|
19
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
20
|
+
"ran_by_user_id" TEXT NOT NULL,
|
|
21
|
+
"status" TEXT NOT NULL,
|
|
22
|
+
"started_at" BIGINT NOT NULL,
|
|
23
|
+
"completed_at" BIGINT,
|
|
24
|
+
"args" TEXT,
|
|
25
|
+
"error_message" TEXT,
|
|
26
|
+
"workflow_id" TEXT NOT NULL,
|
|
27
|
+
CONSTRAINT "workflow_runs_ran_by_user_id_fkey" FOREIGN KEY ("ran_by_user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
28
|
+
);
|
|
29
|
+
INSERT INTO "new_workflow_runs" ("args", "completed_at", "error_message", "id", "ran_by_user_id", "started_at", "status", "workflow_id") SELECT "args", "completed_at", "error_message", "id", "ran_by_user_id", "started_at", "status", "workflow_id" FROM "workflow_runs";
|
|
30
|
+
DROP TABLE "workflow_runs";
|
|
31
|
+
ALTER TABLE "new_workflow_runs" RENAME TO "workflow_runs";
|
|
32
|
+
CREATE INDEX "workflow_runs_started_at_idx" ON "workflow_runs"("started_at");
|
|
33
|
+
PRAGMA foreign_keys=ON;
|
|
34
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `workflow_id` on the `workflow_runs` table. All the data in the column will be lost.
|
|
5
|
+
- Added the required column `workflow_slug` to the `workflow_runs` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- RedefineTables
|
|
9
|
+
PRAGMA defer_foreign_keys=ON;
|
|
10
|
+
PRAGMA foreign_keys=OFF;
|
|
11
|
+
CREATE TABLE "new_workflow_runs" (
|
|
12
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
13
|
+
"ran_by_user_id" TEXT NOT NULL,
|
|
14
|
+
"status" TEXT NOT NULL,
|
|
15
|
+
"started_at" BIGINT NOT NULL,
|
|
16
|
+
"completed_at" BIGINT,
|
|
17
|
+
"args" TEXT,
|
|
18
|
+
"error_message" TEXT,
|
|
19
|
+
"workflow_slug" TEXT NOT NULL,
|
|
20
|
+
CONSTRAINT "workflow_runs_ran_by_user_id_fkey" FOREIGN KEY ("ran_by_user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
21
|
+
);
|
|
22
|
+
INSERT INTO "new_workflow_runs" ("args", "completed_at", "error_message", "id", "ran_by_user_id", "started_at", "status") SELECT "args", "completed_at", "error_message", "id", "ran_by_user_id", "started_at", "status" FROM "workflow_runs";
|
|
23
|
+
DROP TABLE "workflow_runs";
|
|
24
|
+
ALTER TABLE "new_workflow_runs" RENAME TO "workflow_runs";
|
|
25
|
+
CREATE INDEX "workflow_runs_started_at_idx" ON "workflow_runs"("started_at");
|
|
26
|
+
PRAGMA foreign_keys=ON;
|
|
27
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "chat_sessions" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"user_id" TEXT NOT NULL,
|
|
5
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
6
|
+
"title" TEXT,
|
|
7
|
+
"created_at" BIGINT NOT NULL,
|
|
8
|
+
"updated_at" BIGINT NOT NULL,
|
|
9
|
+
CONSTRAINT "chat_sessions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- CreateIndex
|
|
13
|
+
CREATE UNIQUE INDEX "chat_sessions_opencode_session_id_key" ON "chat_sessions"("opencode_session_id");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- Made the column `title` on table `chat_sessions` required. This step will fail if there are existing NULL values in that column.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- RedefineTables
|
|
8
|
+
PRAGMA defer_foreign_keys=ON;
|
|
9
|
+
PRAGMA foreign_keys=OFF;
|
|
10
|
+
CREATE TABLE "new_chat_sessions" (
|
|
11
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
12
|
+
"user_id" TEXT NOT NULL,
|
|
13
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
14
|
+
"title" TEXT NOT NULL,
|
|
15
|
+
"created_at" BIGINT NOT NULL,
|
|
16
|
+
"updated_at" BIGINT NOT NULL,
|
|
17
|
+
CONSTRAINT "chat_sessions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
18
|
+
);
|
|
19
|
+
INSERT INTO "new_chat_sessions" ("created_at", "id", "opencode_session_id", "title", "updated_at", "user_id") SELECT "created_at", "id", "opencode_session_id", "title", "updated_at", "user_id" FROM "chat_sessions";
|
|
20
|
+
DROP TABLE "chat_sessions";
|
|
21
|
+
ALTER TABLE "new_chat_sessions" RENAME TO "chat_sessions";
|
|
22
|
+
CREATE UNIQUE INDEX "chat_sessions_opencode_session_id_key" ON "chat_sessions"("opencode_session_id");
|
|
23
|
+
PRAGMA foreign_keys=ON;
|
|
24
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "workflow_execution_permissions" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
5
|
+
"message_id" TEXT NOT NULL,
|
|
6
|
+
"call_id" TEXT NOT NULL,
|
|
7
|
+
"workflow_slug" TEXT NOT NULL,
|
|
8
|
+
"args" TEXT,
|
|
9
|
+
"status" TEXT NOT NULL,
|
|
10
|
+
"created_at" BIGINT NOT NULL,
|
|
11
|
+
"responded_at" BIGINT
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
-- CreateIndex
|
|
15
|
+
CREATE INDEX "workflow_execution_permissions_opencode_session_id_status_idx" ON "workflow_execution_permissions"("opencode_session_id", "status");
|
|
16
|
+
|
|
17
|
+
-- CreateIndex
|
|
18
|
+
CREATE INDEX "workflow_execution_permissions_id_status_idx" ON "workflow_execution_permissions"("id", "status");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `workflow_execution_permissions` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropTable
|
|
8
|
+
PRAGMA foreign_keys=off;
|
|
9
|
+
DROP TABLE "workflow_execution_permissions";
|
|
10
|
+
PRAGMA foreign_keys=on;
|
package/prisma/migrations/20260222041348_add_workflow_execution_permissions_final/migration.sql
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "workflow_execution_permissions" (
|
|
3
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
5
|
+
"message_id" TEXT NOT NULL,
|
|
6
|
+
"workflow_slug" TEXT NOT NULL,
|
|
7
|
+
"args" TEXT,
|
|
8
|
+
"status" TEXT NOT NULL,
|
|
9
|
+
"created_at" BIGINT NOT NULL,
|
|
10
|
+
"responded_at" BIGINT
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- CreateIndex
|
|
14
|
+
CREATE INDEX "workflow_execution_permissions_opencode_session_id_status_idx" ON "workflow_execution_permissions"("opencode_session_id", "status");
|
|
15
|
+
|
|
16
|
+
-- CreateIndex
|
|
17
|
+
CREATE INDEX "workflow_execution_permissions_id_status_idx" ON "workflow_execution_permissions"("id", "status");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `workflow_execution_permissions` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropTable
|
|
8
|
+
PRAGMA foreign_keys=off;
|
|
9
|
+
DROP TABLE "workflow_execution_permissions";
|
|
10
|
+
PRAGMA foreign_keys=on;
|
|
11
|
+
|
|
12
|
+
-- CreateTable
|
|
13
|
+
CREATE TABLE "tool_execution_permissions" (
|
|
14
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
15
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
16
|
+
"message_id" TEXT NOT NULL,
|
|
17
|
+
"call_id" TEXT NOT NULL,
|
|
18
|
+
"tool_name" TEXT NOT NULL,
|
|
19
|
+
"description" TEXT NOT NULL,
|
|
20
|
+
"params" TEXT,
|
|
21
|
+
"status" TEXT NOT NULL,
|
|
22
|
+
"created_at" BIGINT NOT NULL,
|
|
23
|
+
"responded_at" BIGINT
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
-- CreateIndex
|
|
27
|
+
CREATE INDEX "tool_execution_permissions_opencode_session_id_status_idx" ON "tool_execution_permissions"("opencode_session_id", "status");
|
|
28
|
+
|
|
29
|
+
-- CreateIndex
|
|
30
|
+
CREATE INDEX "tool_execution_permissions_id_status_idx" ON "tool_execution_permissions"("id", "status");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `call_id` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `description` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `message_id` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
7
|
+
- You are about to drop the column `params` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
8
|
+
- You are about to drop the column `tool_name` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
9
|
+
- Added the required column `opencode_permission_id` to the `tool_execution_permissions` table without a default value. This is not possible if the table is not empty.
|
|
10
|
+
|
|
11
|
+
*/
|
|
12
|
+
-- RedefineTables
|
|
13
|
+
PRAGMA defer_foreign_keys=ON;
|
|
14
|
+
PRAGMA foreign_keys=OFF;
|
|
15
|
+
CREATE TABLE "new_tool_execution_permissions" (
|
|
16
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
17
|
+
"opencode_permission_id" TEXT NOT NULL,
|
|
18
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
19
|
+
"status" TEXT NOT NULL,
|
|
20
|
+
"created_at" BIGINT NOT NULL,
|
|
21
|
+
"responded_at" BIGINT
|
|
22
|
+
);
|
|
23
|
+
INSERT INTO "new_tool_execution_permissions" ("created_at", "id", "opencode_session_id", "responded_at", "status") SELECT "created_at", "id", "opencode_session_id", "responded_at", "status" FROM "tool_execution_permissions";
|
|
24
|
+
DROP TABLE "tool_execution_permissions";
|
|
25
|
+
ALTER TABLE "new_tool_execution_permissions" RENAME TO "tool_execution_permissions";
|
|
26
|
+
CREATE INDEX "tool_execution_permissions_opencode_session_id_status_idx" ON "tool_execution_permissions"("opencode_session_id", "status");
|
|
27
|
+
CREATE INDEX "tool_execution_permissions_opencode_permission_id_idx" ON "tool_execution_permissions"("opencode_permission_id");
|
|
28
|
+
PRAGMA foreign_keys=ON;
|
|
29
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `opencode_permission_id` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
5
|
+
- Added the required column `call_id` to the `tool_execution_permissions` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
- Added the required column `message_id` to the `tool_execution_permissions` table without a default value. This is not possible if the table is not empty.
|
|
7
|
+
- Added the required column `patterns` to the `tool_execution_permissions` table without a default value. This is not possible if the table is not empty.
|
|
8
|
+
- Added the required column `tool_name` to the `tool_execution_permissions` table without a default value. This is not possible if the table is not empty.
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
-- RedefineTables
|
|
12
|
+
PRAGMA defer_foreign_keys=ON;
|
|
13
|
+
PRAGMA foreign_keys=OFF;
|
|
14
|
+
CREATE TABLE "new_tool_execution_permissions" (
|
|
15
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
16
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
17
|
+
"message_id" TEXT NOT NULL,
|
|
18
|
+
"call_id" TEXT NOT NULL,
|
|
19
|
+
"tool_name" TEXT NOT NULL,
|
|
20
|
+
"patterns" TEXT NOT NULL,
|
|
21
|
+
"metadata" TEXT,
|
|
22
|
+
"status" TEXT NOT NULL,
|
|
23
|
+
"created_at" BIGINT NOT NULL,
|
|
24
|
+
"responded_at" BIGINT
|
|
25
|
+
);
|
|
26
|
+
INSERT INTO "new_tool_execution_permissions" ("created_at", "id", "opencode_session_id", "responded_at", "status") SELECT "created_at", "id", "opencode_session_id", "responded_at", "status" FROM "tool_execution_permissions";
|
|
27
|
+
DROP TABLE "tool_execution_permissions";
|
|
28
|
+
ALTER TABLE "new_tool_execution_permissions" RENAME TO "tool_execution_permissions";
|
|
29
|
+
CREATE INDEX "tool_execution_permissions_opencode_session_id_status_idx" ON "tool_execution_permissions"("opencode_session_id", "status");
|
|
30
|
+
CREATE INDEX "tool_execution_permissions_id_status_idx" ON "tool_execution_permissions"("id", "status");
|
|
31
|
+
PRAGMA foreign_keys=ON;
|
|
32
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `metadata` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `patterns` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `tool_name` on the `tool_execution_permissions` table. All the data in the column will be lost.
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
-- RedefineTables
|
|
10
|
+
PRAGMA defer_foreign_keys=ON;
|
|
11
|
+
PRAGMA foreign_keys=OFF;
|
|
12
|
+
CREATE TABLE "new_tool_execution_permissions" (
|
|
13
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
14
|
+
"opencode_session_id" TEXT NOT NULL,
|
|
15
|
+
"message_id" TEXT NOT NULL,
|
|
16
|
+
"call_id" TEXT NOT NULL,
|
|
17
|
+
"status" TEXT NOT NULL,
|
|
18
|
+
"created_at" BIGINT NOT NULL,
|
|
19
|
+
"responded_at" BIGINT
|
|
20
|
+
);
|
|
21
|
+
INSERT INTO "new_tool_execution_permissions" ("call_id", "created_at", "id", "message_id", "opencode_session_id", "responded_at", "status") SELECT "call_id", "created_at", "id", "message_id", "opencode_session_id", "responded_at", "status" FROM "tool_execution_permissions";
|
|
22
|
+
DROP TABLE "tool_execution_permissions";
|
|
23
|
+
ALTER TABLE "new_tool_execution_permissions" RENAME TO "tool_execution_permissions";
|
|
24
|
+
CREATE INDEX "tool_execution_permissions_opencode_session_id_status_idx" ON "tool_execution_permissions"("opencode_session_id", "status");
|
|
25
|
+
CREATE UNIQUE INDEX "tool_execution_permissions_opencode_session_id_message_id_call_id_key" ON "tool_execution_permissions"("opencode_session_id", "message_id", "call_id");
|
|
26
|
+
PRAGMA foreign_keys=ON;
|
|
27
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "workflow_run_permissions" (
|
|
3
|
+
"workflow_slug" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"mode" TEXT NOT NULL,
|
|
5
|
+
"created_at" BIGINT NOT NULL,
|
|
6
|
+
"updated_at" BIGINT NOT NULL
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
-- CreateTable
|
|
10
|
+
CREATE TABLE "workflow_run_permission_users" (
|
|
11
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
12
|
+
"workflow_slug" TEXT NOT NULL,
|
|
13
|
+
"user_id" TEXT NOT NULL,
|
|
14
|
+
"created_at" BIGINT NOT NULL,
|
|
15
|
+
CONSTRAINT "workflow_run_permission_users_workflow_slug_fkey" FOREIGN KEY ("workflow_slug") REFERENCES "workflow_run_permissions" ("workflow_slug") ON DELETE CASCADE ON UPDATE CASCADE,
|
|
16
|
+
CONSTRAINT "workflow_run_permission_users_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- CreateIndex
|
|
20
|
+
CREATE INDEX "workflow_run_permission_users_workflow_slug_idx" ON "workflow_run_permission_users"("workflow_slug");
|
|
21
|
+
|
|
22
|
+
-- CreateIndex
|
|
23
|
+
CREATE UNIQUE INDEX "workflow_run_permission_users_workflow_slug_user_id_key" ON "workflow_run_permission_users"("workflow_slug", "user_id");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "workflow_metadata" (
|
|
3
|
+
"workflow_slug" TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
"created_by_user_id" TEXT,
|
|
5
|
+
"approved_by_user_id" TEXT,
|
|
6
|
+
"created_at" BIGINT NOT NULL,
|
|
7
|
+
"updated_at" BIGINT NOT NULL,
|
|
8
|
+
CONSTRAINT "workflow_metadata_created_by_user_id_fkey" FOREIGN KEY ("created_by_user_id") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
|
9
|
+
CONSTRAINT "workflow_metadata_approved_by_user_id_fkey" FOREIGN KEY ("approved_by_user_id") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- CreateIndex
|
|
13
|
+
CREATE INDEX "workflow_metadata_created_by_user_id_idx" ON "workflow_metadata"("created_by_user_id");
|
|
14
|
+
|
|
15
|
+
-- CreateIndex
|
|
16
|
+
CREATE INDEX "workflow_metadata_approved_by_user_id_idx" ON "workflow_metadata"("approved_by_user_id");
|
package/prisma/migrations/20260225031035_merge_workflow_permissions_into_metadata/migration.sql
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `workflow_run_permissions` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropTable
|
|
8
|
+
PRAGMA foreign_keys=off;
|
|
9
|
+
DROP TABLE "workflow_run_permissions";
|
|
10
|
+
PRAGMA foreign_keys=on;
|
|
11
|
+
|
|
12
|
+
-- RedefineTables
|
|
13
|
+
PRAGMA defer_foreign_keys=ON;
|
|
14
|
+
PRAGMA foreign_keys=OFF;
|
|
15
|
+
CREATE TABLE "new_workflow_metadata" (
|
|
16
|
+
"workflow_slug" TEXT NOT NULL PRIMARY KEY,
|
|
17
|
+
"created_by_user_id" TEXT,
|
|
18
|
+
"approved_by_user_id" TEXT,
|
|
19
|
+
"run_permission_mode" TEXT NOT NULL DEFAULT 'restricted',
|
|
20
|
+
"created_at" BIGINT NOT NULL,
|
|
21
|
+
"updated_at" BIGINT NOT NULL,
|
|
22
|
+
CONSTRAINT "workflow_metadata_created_by_user_id_fkey" FOREIGN KEY ("created_by_user_id") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
|
23
|
+
CONSTRAINT "workflow_metadata_approved_by_user_id_fkey" FOREIGN KEY ("approved_by_user_id") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
|
24
|
+
);
|
|
25
|
+
INSERT INTO "new_workflow_metadata" ("approved_by_user_id", "created_at", "created_by_user_id", "updated_at", "workflow_slug") SELECT "approved_by_user_id", "created_at", "created_by_user_id", "updated_at", "workflow_slug" FROM "workflow_metadata";
|
|
26
|
+
DROP TABLE "workflow_metadata";
|
|
27
|
+
ALTER TABLE "new_workflow_metadata" RENAME TO "workflow_metadata";
|
|
28
|
+
CREATE INDEX "workflow_metadata_created_by_user_id_idx" ON "workflow_metadata"("created_by_user_id");
|
|
29
|
+
CREATE INDEX "workflow_metadata_approved_by_user_id_idx" ON "workflow_metadata"("approved_by_user_id");
|
|
30
|
+
CREATE TABLE "new_workflow_run_permission_users" (
|
|
31
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
32
|
+
"workflow_slug" TEXT NOT NULL,
|
|
33
|
+
"user_id" TEXT NOT NULL,
|
|
34
|
+
"created_at" BIGINT NOT NULL,
|
|
35
|
+
CONSTRAINT "workflow_run_permission_users_workflow_slug_fkey" FOREIGN KEY ("workflow_slug") REFERENCES "workflow_metadata" ("workflow_slug") ON DELETE CASCADE ON UPDATE CASCADE,
|
|
36
|
+
CONSTRAINT "workflow_run_permission_users_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
37
|
+
);
|
|
38
|
+
INSERT INTO "new_workflow_run_permission_users" ("created_at", "id", "user_id", "workflow_slug") SELECT "created_at", "id", "user_id", "workflow_slug" FROM "workflow_run_permission_users";
|
|
39
|
+
DROP TABLE "workflow_run_permission_users";
|
|
40
|
+
ALTER TABLE "new_workflow_run_permission_users" RENAME TO "workflow_run_permission_users";
|
|
41
|
+
CREATE INDEX "workflow_run_permission_users_workflow_slug_idx" ON "workflow_run_permission_users"("workflow_slug");
|
|
42
|
+
CREATE UNIQUE INDEX "workflow_run_permission_users_workflow_slug_user_id_key" ON "workflow_run_permission_users"("workflow_slug", "user_id");
|
|
43
|
+
PRAGMA foreign_keys=ON;
|
|
44
|
+
PRAGMA defer_foreign_keys=OFF;
|
package/prisma/migrations/20260225031752_removes_default_for_run_permission_mode/migration.sql
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- RedefineTables
|
|
2
|
+
PRAGMA defer_foreign_keys=ON;
|
|
3
|
+
PRAGMA foreign_keys=OFF;
|
|
4
|
+
CREATE TABLE "new_workflow_metadata" (
|
|
5
|
+
"workflow_slug" TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"created_by_user_id" TEXT,
|
|
7
|
+
"approved_by_user_id" TEXT,
|
|
8
|
+
"run_permission_mode" TEXT NOT NULL,
|
|
9
|
+
"created_at" BIGINT NOT NULL,
|
|
10
|
+
"updated_at" BIGINT NOT NULL,
|
|
11
|
+
CONSTRAINT "workflow_metadata_created_by_user_id_fkey" FOREIGN KEY ("created_by_user_id") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
|
12
|
+
CONSTRAINT "workflow_metadata_approved_by_user_id_fkey" FOREIGN KEY ("approved_by_user_id") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
|
13
|
+
);
|
|
14
|
+
INSERT INTO "new_workflow_metadata" ("approved_by_user_id", "created_at", "created_by_user_id", "run_permission_mode", "updated_at", "workflow_slug") SELECT "approved_by_user_id", "created_at", "created_by_user_id", "run_permission_mode", "updated_at", "workflow_slug" FROM "workflow_metadata";
|
|
15
|
+
DROP TABLE "workflow_metadata";
|
|
16
|
+
ALTER TABLE "new_workflow_metadata" RENAME TO "workflow_metadata";
|
|
17
|
+
CREATE INDEX "workflow_metadata_created_by_user_id_idx" ON "workflow_metadata"("created_by_user_id");
|
|
18
|
+
CREATE INDEX "workflow_metadata_approved_by_user_id_idx" ON "workflow_metadata"("approved_by_user_id");
|
|
19
|
+
PRAGMA foreign_keys=ON;
|
|
20
|
+
PRAGMA defer_foreign_keys=OFF;
|