diff --git a/.claude/rules/sim-api-contracts.md b/.claude/rules/sim-api-contracts.md
index 643f31c65aa..9e8e90dc7c1 100644
--- a/.claude/rules/sim-api-contracts.md
+++ b/.claude/rules/sim-api-contracts.md
@@ -35,7 +35,7 @@ Placement: the annotation must immediately precede the call or cast; up to three
```ts
// boundary-raw-fetch: streaming SSE chunks must be processed as they arrive
-const response = await fetch(`/api/copilot/chat/stream?chatId=${chatId}`, { signal })
+const response = await fetch(`/api/mothership/chat/stream?streamId=${streamId}`, { signal })
```
```ts
diff --git a/.cursor/rules/sim-api-contracts.mdc b/.cursor/rules/sim-api-contracts.mdc
index 840e3bbbc23..483379b72a1 100644
--- a/.cursor/rules/sim-api-contracts.mdc
+++ b/.cursor/rules/sim-api-contracts.mdc
@@ -33,7 +33,7 @@ Placement: the annotation must immediately precede the call or cast; up to three
```ts
// boundary-raw-fetch: streaming SSE chunks must be processed as they arrive
-const response = await fetch(`/api/copilot/chat/stream?chatId=${chatId}`, { signal })
+const response = await fetch(`/api/mothership/chat/stream?streamId=${streamId}`, { signal })
```
```ts
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index f03ff816348..7bc4ac74449 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -5,7 +5,6 @@
/apps/sim/app/api/mothership/chat/ @simstudioai/mothership
/apps/sim/app/api/mothership/chats/ @simstudioai/mothership
/apps/sim/app/api/mothership/execute/ @simstudioai/mothership
-/apps/sim/app/api/v1/copilot/chat/ @simstudioai/mothership
# Server-side stream orchestration, persistence, and protocol.
/apps/sim/lib/copilot/chat/ @simstudioai/mothership
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index c009be91430..4277061d49a 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -179,31 +179,34 @@ Access the application at [http://localhost:3000/](http://localhost:3000/)
#### Using Local Models
-To use local models with Sim:
+To use local models with Sim, either point it at an Ollama server you already run or start one alongside the stack.
-1. Install Ollama and pull models:
+- **Ollama on your machine**: install it, pull a model, and point the app at the host:
- ```bash
- # Install Ollama (if not already installed)
- curl -fsSL https://ollama.ai/install.sh | sh
+ ```bash
+ curl -fsSL https://ollama.ai/install.sh | sh
+ ollama pull gemma3:4b
- # Pull a model (e.g., gemma3:4b)
- ollama pull gemma3:4b
- ```
+ echo 'OLLAMA_URL=http://host.docker.internal:11434' >> .env
+ docker compose -f docker-compose.prod.yml up -d
+ ```
-2. Start Sim with local model support:
+ Ollama must listen on an interface the container can reach (`OLLAMA_HOST=0.0.0.0:11434`). For an Ollama server elsewhere, set `OLLAMA_URL` to its address instead.
- ```bash
- # With NVIDIA GPU support
- docker compose --profile local-gpu -f docker-compose.ollama.yml up -d
+- **Bundled Ollama**: layer `docker-compose.ollama.yml` on the production file, with exactly one of the `gpu` or `cpu` profiles, then pull the starter model once:
- # Without GPU (CPU only)
- docker compose --profile local-cpu -f docker-compose.ollama.yml up -d
+ ```bash
+ echo 'OLLAMA_URL=http://ollama:11434' >> .env
- # If hosting on a server, update the environment variables in the docker-compose.prod.yml file
- # to include the server's public IP then start again (OLLAMA_URL to i.e. http://1.1.1.1:11434)
- docker compose -f docker-compose.prod.yml up -d
- ```
+ # With NVIDIA GPU support
+ docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu up -d
+
+ # Without GPU (CPU only)
+ docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu up -d
+
+ # Pull gemma3:4b into the running server
+ docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile setup run --rm model-setup
+ ```
### Option 3: Manual Setup
diff --git a/README.md b/README.md
index e1bc33f0b7e..de4131f0e0b 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
-
+
diff --git a/apps/docs/content/docs/platform/self-hosting/docker.mdx b/apps/docs/content/docs/platform/self-hosting/docker.mdx
index 3666d5fa8d2..11135d005ec 100644
--- a/apps/docs/content/docs/platform/self-hosting/docker.mdx
+++ b/apps/docs/content/docs/platform/self-hosting/docker.mdx
@@ -145,30 +145,64 @@ docker compose -f docker-compose.prod.yml up -d
Container `localhost` is the container itself. The default `http://localhost:11434` does not reach an Ollama server on the host.
-### Development Ollama stack
+### Bundled Ollama
-`docker-compose.ollama.yml` builds the app, realtime, and migrations from source. It does not bundle Redis or cron. Without Redis, pub/sub is process-local and CLI pairing approval has no fallback; idempotency and execution-progress storage can fall back to PostgreSQL. Without a scheduler, background jobs do not run.
+`docker-compose.ollama.yml` is an overlay on `docker-compose.prod.yml`: it adds an Ollama server to the production stack and points the app at it, so the stack keeps the published images, the required secrets, Redis, and cron. Ollama is reachable only inside the Compose network, as `ollama:11434`.
-Use a server profile together with `setup`; `setup` alone starts no Ollama server and the model setup waits:
+Add the address to `.env` first. The overlay refuses to start without it, and keeping it in `.env` means a later run of `docker-compose.prod.yml` alone still reaches Ollama:
```bash
-# NVIDIA GPU
-docker compose -f docker-compose.ollama.yml --profile gpu --profile setup up -d
+OLLAMA_URL=http://ollama:11434
+```
+
+Start the stack with exactly one server profile:
+
+```bash
+# NVIDIA GPU (requires the NVIDIA Container Toolkit)
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu up -d
# CPU only
-docker compose -f docker-compose.ollama.yml --profile cpu --profile setup up -d
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu up -d
+```
+
+Pull the starter model, `gemma3:4b`, once the server is running:
+
+```bash
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile setup run --rm model-setup
```
-Setup pulls `gemma3:4b`. To pull another model:
+To pull another model, exec into the server for your profile:
```bash
# GPU profile
-docker compose -f docker-compose.ollama.yml exec ollama ollama pull llama3.2
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu exec ollama ollama pull llama3.2
# CPU profile
-docker compose -f docker-compose.ollama.yml exec ollama-cpu ollama pull llama3.2
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu exec ollama-cpu ollama pull llama3.2
```
+#### Migrating from the previous Ollama stack
+
+The previous `docker-compose.ollama.yml` was a standalone stack with the fixed project name `sim-with-ollama`, so its database and models live in the `sim-with-ollama_postgres_data` and `sim-with-ollama_ollama_data` volumes. The overlay takes its project name from `docker-compose.prod.yml`, and started as-is it creates empty volumes instead. To keep your data:
+
+1. From the repository directory, stop the old stack without `-v`, so its volumes are kept. The old file is gone, so name the project instead:
+
+ ```bash
+ docker compose -p sim-with-ollama down
+ ```
+
+2. Add the old project name and database password to `.env`, so the overlay and the `sim-setup` CLI both resolve the same project and volumes. The old stack's password defaulted to `postgres` unless you set one:
+
+ ```bash
+ COMPOSE_PROJECT_NAME=sim-with-ollama
+ POSTGRES_PASSWORD=postgres
+ OLLAMA_URL=http://ollama:11434
+ ```
+
+3. Start the stack with the overlay and your profile, as above.
+
+Ollama is no longer published on host port `11434`. Reach it with `docker compose exec`, as in the model pull commands above.
+
## LM Studio
Start [LM Studio's local server](https://lmstudio.ai/docs/developer/core/server), load a model, enable **Serve on Local Network**, and [configure API authentication](https://lmstudio.ai/docs/developer/core/authentication). Save these values beside your Compose file:
@@ -184,13 +218,14 @@ Recreate the app using the file that started your installation:
```bash
COMPOSE_FILE=docker-compose.prod.yml
-# For a source-built stack, use docker-compose.local.yml or docker-compose.ollama.yml.
+# For a source-built stack, use docker-compose.local.yml. With bundled Ollama,
+# add the overlay: -f docker-compose.prod.yml -f docker-compose.ollama.yml
docker compose -f "$COMPOSE_FILE" up -d --force-recreate simstudio
```
## The `sim-setup` CLI
-Invoke commands as `bunx sim-setup ` unless the package is installed globally. Run `doctor`, `config`, and the wizard from the configuration directory. Lifecycle commands discover running production/local Compose stacks, source checkouts, and Helm releases; Ollama-stack installs are not managed.
+Invoke commands as `bunx sim-setup ` unless the package is installed globally. Run `doctor`, `config`, and the wizard from the configuration directory. Lifecycle commands discover running production/local Compose stacks, source checkouts, and Helm releases. A stack started with the Ollama overlay is managed as a production install, through `docker-compose.prod.yml` alone: the CLI acts on the Sim services and leaves the Ollama container untouched.
| Command | Behavior |
| --- | --- |
diff --git a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx
index 31f471f901e..277229e234e 100644
--- a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx
+++ b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx
@@ -260,7 +260,7 @@ Configure at least one. Every configured provider stays active and is tried in o
| `RESUME_EXECUTION_CONCURRENCY_LIMIT` | `50` | Trigger.dev resume task concurrency |
| `EGRESS_ALLOWED_HOSTS` | unset | Comma-separated hostnames outbound requests may reach on a private network. Leading wildcard allowed, e.g. `host.docker.internal,*.svc.cluster.local`. Not honored for URLs harvested from content or a third-party response, nor for an HTTP block's `proxyUrl` |
| `EGRESS_ALLOWED_IP_RANGES` | unset | Comma-separated CIDRs or IPs outbound requests may reach on a private network, e.g. `10.0.0.0/8`. Same exclusions |
-| `ALLOW_PRIVATE_DATABASE_HOSTS` | unset | **Deprecated.** Vouches for the entire private address space, for database, cache, and mail connector hosts only. Replace it with the two settings above naming specific destinations |
+| `ALLOW_PRIVATE_DATABASE_HOSTS` | unset | **Removed.** Has no effect; the app logs an error at startup if it is still set. Name each database, cache, or mail host in `EGRESS_ALLOWED_HOSTS` instead; a host reached by IP address, including any IPv6 literal (which `EGRESS_ALLOWED_HOSTS` rejects), takes a single-address entry such as `10.0.0.5/32` in `EGRESS_ALLOWED_IP_RANGES`. Do not allowlist whole private ranges, which would widen what workflow HTTP blocks can reach, or `localhost`, where Sim's own database and Redis listen |
| `DOMAIN_VERIFICATION_NAMESERVERS` | `1.1.1.1,8.8.8.8` | Comma-separated nameserver IPs that SSO domain verification sends its TXT lookup to. Set it when the network only allows DNS to an internal resolver. Entries that are not IP addresses are ignored |
A malformed entry in either allowlist stops the app at startup with a message naming the setting. See [the SSRF boundary](/platform/self-hosting/security#the-ssrf-boundary) for the accepted syntax and for what the allowlist does and does not reach.
diff --git a/apps/docs/content/docs/platform/self-hosting/observability.mdx b/apps/docs/content/docs/platform/self-hosting/observability.mdx
index f69ffec0c0d..7a308463faf 100644
--- a/apps/docs/content/docs/platform/self-hosting/observability.mdx
+++ b/apps/docs/content/docs/platform/self-hosting/observability.mdx
@@ -71,7 +71,7 @@ Deploy the PII service, configure its internal network path, and enable the stor
## Metrics
- The default app and realtime images **do not expose a `/metrics` endpoint**. The chart's `monitoring.serviceMonitor` option exists for builds that do — enabling it against the stock images produces a ServiceMonitor that scrapes nothing.
+ The app and realtime images **do not expose a `/metrics` endpoint**, and the Helm chart ships no ServiceMonitor. There is nothing for Prometheus to scrape from the Sim pods directly.
Until an application metrics endpoint ships, build alerting from the signals that do exist:
diff --git a/apps/docs/content/docs/platform/self-hosting/security.mdx b/apps/docs/content/docs/platform/self-hosting/security.mdx
index d1cab05df81..5cfb65dc7a5 100644
--- a/apps/docs/content/docs/platform/self-hosting/security.mdx
+++ b/apps/docs/content/docs/platform/self-hosting/security.mdx
@@ -271,7 +271,7 @@ EGRESS_ALLOWED_HOSTS=host.docker.internal
Review these compatibility cases when upgrading:
-- **`ALLOW_PRIVATE_DATABASE_HOSTS`** still works, but it is deprecated and logs a warning at startup. It vouches for the whole private address space, loopback included, for database, cache, and mail connector hosts. Replace it with `EGRESS_ALLOWED_HOSTS` or `EGRESS_ALLOWED_IP_RANGES` naming the hosts you actually use.
+- **`ALLOW_PRIVATE_DATABASE_HOSTS`** has been removed and no longer has any effect; the app logs an error at startup if it is still set. Name the specific database, cache, and mail hosts you use in `EGRESS_ALLOWED_HOSTS`. A host you reach by IP address needs a single-address entry in `EGRESS_ALLOWED_IP_RANGES` instead (for example `10.0.0.5/32`, or `fd00::5/128`); IPv6 literals in particular must go there, since `EGRESS_ALLOWED_HOSTS` rejects them. Do not allowlist whole private ranges in its place, since the allowlist also applies to workflow HTTP blocks and that would widen what every workflow author can reach, and do not allowlist `localhost`, where Sim's own database and Redis listen.
- **1Password Connect** on a private, non-loopback address, and an **MCP server** on a private address or reached through a DNS name that points at loopback, are no longer reachable implicitly. Name them.
- **`ALLOWED_MCP_DOMAINS`** governs which domains may be used; it no longer disables the address check, so an MCP server on a private address needs the allowlist too.
- **Content fetches** — an image URL, a file imported by URL, an MCP OAuth endpoint on a different origin than the MCP server itself — never use the allowlist. Those destinations have to be publicly routable. (An SSO OIDC *discovery* URL is a configured endpoint and does use the allowlist; the endpoints named *inside* the discovery document are validated as content when Sim registers the provider, so an internal IdP endpoint is refused there and cannot be allowlisted — provide the endpoints explicitly to have them validated as configured endpoints instead.)
diff --git a/apps/docs/content/docs/platform/self-hosting/troubleshooting.mdx b/apps/docs/content/docs/platform/self-hosting/troubleshooting.mdx
index 8630a836884..8924875a920 100644
--- a/apps/docs/content/docs/platform/self-hosting/troubleshooting.mdx
+++ b/apps/docs/content/docs/platform/self-hosting/troubleshooting.mdx
@@ -7,7 +7,7 @@ Start with the checks for your deployment type, then follow the symptom below.
## Run `sim-setup doctor`
-On a production or local-development Compose install, or a source checkout, run the built-in checker first. It does not detect the Ollama stack. It checks configuration and common dependency failures. It reads env files, so it is not a Kubernetes tool — on Helm, skip to the checks below.
+On a production or local-development Compose install (including one running the Ollama overlay), or a source checkout, run the built-in checker first. It checks configuration and common dependency failures. It reads env files, so it is not a Kubernetes tool — on Helm, skip to the checks below.
```bash
bunx sim-setup doctor
@@ -193,12 +193,12 @@ OLLAMA_URL=http://host.docker.internal:11434
Sim identifies dynamically discovered LM Studio and vLLM models by their `vllm/` prefix. If the endpoint is unavailable and you manually enter the raw LM Studio model identifier, Sim treats that unknown identifier as an Ollama model.
-1. Set `VLLM_BASE_URL`, and `VLLM_API_KEY` too if you enabled LM Studio's API authentication — without the key, discovery requests omit the bearer token and fail. No Compose file sets either for you — `docker-compose.ollama.yml` only sets `OLLAMA_URL` — so add them to the `.env` file next to your Compose file — `simstudio` declares `env_file: .env` in every shipped file — then recreate the service and confirm it landed:
+1. Set `VLLM_BASE_URL`, and `VLLM_API_KEY` too if you enabled LM Studio's API authentication — without the key, discovery requests omit the bearer token and fail. No Compose file sets either for you, so add them to the `.env` file next to your Compose file — `simstudio` declares `env_file: .env` in every shipped file — then recreate the service and confirm it landed:
- Use the Compose file that started your installation — `docker-compose.prod.yml` for the documented production setup, `docker-compose.local.yml` for a source-built stack, or `docker-compose.ollama.yml` if you started from the Ollama stack:
+ Use the Compose file that started your installation — `docker-compose.prod.yml` for the documented production setup (also when you run the Ollama overlay on top of it) or `docker-compose.local.yml` for a source-built stack:
```bash
- COMPOSE_FILE=docker-compose.prod.yml # or docker-compose.local.yml, docker-compose.ollama.yml
+ COMPOSE_FILE=docker-compose.prod.yml # or docker-compose.local.yml
docker compose -f "$COMPOSE_FILE" up -d --force-recreate simstudio
docker compose -f "$COMPOSE_FILE" exec simstudio printenv VLLM_BASE_URL
```
diff --git a/apps/docs/content/docs/platform/self-hosting/upgrades.mdx b/apps/docs/content/docs/platform/self-hosting/upgrades.mdx
index 18557eb2671..828d54e0e76 100644
--- a/apps/docs/content/docs/platform/self-hosting/upgrades.mdx
+++ b/apps/docs/content/docs/platform/self-hosting/upgrades.mdx
@@ -138,8 +138,8 @@ kubectl logs -n simstudio deploy/sim-app -c migrations --tail=100
```bash
bunx sim-setup update
-# The file that started your install. The Ollama stack is not managed by
-# the CLI at all — see below.
+# The file that started your install. A stack running the Ollama overlay is a
+# docker-compose.prod.yml install — see below.
COMPOSE_FILE=docker-compose.prod.yml
# COMPOSE_FILE=docker-compose.local.yml
docker compose -f "$COMPOSE_FILE" logs migrations
@@ -160,19 +160,18 @@ Inspect the result with `bunx sim-setup logs`, which targets whichever Compose f
Before updating a pinned production install, replace `SIM_VERSION` in `.env` with the chosen release tag. The update command pulls that configured tag; it does not automatically advance a pin.
-The CLI detects only those two files. An install started from `docker-compose.ollama.yml` is invisible to it: `update`, `logs`, and `status` report no install, or — in a source checkout that also carries per-application env files — report that checkout's dev install instead. Upgrade that stack directly:
+The CLI detects only those two files. A stack started with the `docker-compose.ollama.yml` overlay is detected as a `docker-compose.prod.yml` install, and `update` upgrades its Sim services through that file alone, keeping `OLLAMA_URL` from `.env`. It does not touch the Ollama container. To refresh the Ollama image as well, run the update with both files:
```bash
-# That file builds the app, realtime server, and migrator from source, so the
-# upgrade is a checkout plus a rebuild — pulling only refreshes Ollama and
-# Postgres. The Ollama service is profile-scoped, so pass the profile you
-# installed with or Compose silently skips it.
+# The Ollama service is profile-scoped, so pass the profile you installed
+# with or Compose silently skips it.
PROFILE=gpu # or cpu
-git pull
-docker compose -f docker-compose.ollama.yml --profile "$PROFILE" build --pull
-docker compose -f docker-compose.ollama.yml --profile "$PROFILE" up -d
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile "$PROFILE" pull
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile "$PROFILE" up -d
```
+A stack started from the previous, standalone `docker-compose.ollama.yml` ran under the project name `sim-with-ollama`. Upgrading it to the overlay without carrying that name over starts Sim on an empty database: stop it with `docker compose -p sim-with-ollama down` (no `-v`), then set `COMPOSE_PROJECT_NAME=sim-with-ollama` and its `POSTGRES_PASSWORD` (`postgres` unless you set one) in `.env` before starting the overlay. See [Migrating from the previous Ollama stack](/platform/self-hosting/docker#migrating-from-the-previous-ollama-stack). Ollama is no longer published on host port `11434`; use `docker compose exec`.
+
`sim-setup update` refuses two install kinds outright rather than doing something surprising:
@@ -214,17 +213,18 @@ helm rollback sim -n simstudio
docker compose -f docker-compose.prod.yml up -d
```
-The local and Ollama stacks build the app from source and ignore `SIM_VERSION`, so roll those back by checking out the previous tag and rebuilding with the file — and, for the Ollama stack, the profile — that started the install:
+A stack running the Ollama overlay rolls back the same way: it reads `SIM_VERSION` from `.env` like any production install. Pass both files and your profile so Compose manages the Ollama service in the same run:
```bash
-git checkout ""
+PROFILE=gpu # or cpu
+docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile "$PROFILE" up -d
+```
-# Local stack
-docker compose -f docker-compose.local.yml up -d --build
+The local stack builds the app from source and ignores `SIM_VERSION`, so roll it back by checking out the previous tag and rebuilding:
-# Ollama stack — the profile you installed with
-PROFILE=gpu # or cpu
-docker compose -f docker-compose.ollama.yml --profile "$PROFILE" up -d --build
+```bash
+git checkout ""
+docker compose -f docker-compose.local.yml up -d --build
```
Never roll back below v0.9.33 once account tokens are sealed: those releases cannot read them, and every connected account would have to be reconnected. See [Account token sealing](/platform/self-hosting/security#account-token-sealing).
diff --git a/apps/docs/scripts/fixtures/content-baseline.json b/apps/docs/scripts/fixtures/content-baseline.json
index 8b0dea6725e..4382245ee9c 100644
--- a/apps/docs/scripts/fixtures/content-baseline.json
+++ b/apps/docs/scripts/fixtures/content-baseline.json
@@ -172631,10 +172631,15 @@
"depth": 3
},
{
- "title": "Development Ollama stack",
- "url": "#development-ollama-stack",
+ "title": "Bundled Ollama",
+ "url": "#bundled-ollama",
"depth": 3
},
+ {
+ "title": "Migrating from the previous Ollama stack",
+ "url": "#migrating-from-the-previous-ollama-stack",
+ "depth": 4
+ },
{
"title": "LM Studio",
"url": "#lm-studio",
@@ -172698,105 +172703,133 @@
"meta": null,
"sha256": "a68c0e57699fd1b6173497de2b48e69da088d4f060252545cc6073e05474d543",
"bytes": 14,
- "line": 16
+ "line": 20
},
{
"lang": "bash",
"meta": null,
"sha256": "fc4c41bd42c49d3d1e01e1c5b3bea596499a608d6e8b477667c20c94e6392569",
"bytes": 55,
- "line": 24
+ "line": 28
},
{
"lang": "bash",
"meta": null,
"sha256": "8458fd352d5aa0c3bd2d0e4d4e362b72556f9a812206a9b1b311a17df776cffb",
"bytes": 370,
- "line": 37
+ "line": 41
},
{
"lang": "bash",
"meta": null,
"sha256": "895e38a2340e9bc60c742d7b2950ffadbe99a44f47bdb55f94e9c32363f4b126",
"bytes": 196,
- "line": 76
+ "line": 80
},
{
"lang": "bash",
"meta": null,
"sha256": "9a9a03e2cc32aa7b9e9e7b7f44c93923586a33c987a8eac7bd82d393295dafd1",
"bytes": 54,
- "line": 94
+ "line": 98
},
{
"lang": "text",
"meta": null,
"sha256": "57272f564e9f8df27666b97601aa83289d7ca6df712285cf1170be56c945b7c4",
"bytes": 208,
- "line": 104
+ "line": 108
},
{
"lang": "bash",
"meta": null,
"sha256": "6c7c578d5d5d42812a8dd29e3fde30d7282e4f02890c4fffd2055e2086982252",
"bytes": 44,
- "line": 130
+ "line": 134
},
{
"lang": "bash",
"meta": null,
"sha256": "3428ca92c1894f3f15ac85ae0637c969c0c004b29b60bc9fe1393b2c397d245f",
"bytes": 47,
- "line": 136
+ "line": 140
},
{
"lang": "bash",
"meta": null,
- "sha256": "1117f8e0bcc0f62773b181db811dc4845abe41db6430f97a8844b0e6d14a26a0",
- "bytes": 184,
- "line": 150
+ "sha256": "c04933e97d11eb1d70a6dc9bc4dd84de6567b91a5df4028d29f1fb0c7f9248d0",
+ "bytes": 30,
+ "line": 154
},
{
"lang": "bash",
"meta": null,
- "sha256": "29b413408a4d2f9af144351258c1ebc324273879ac991b3f2ae63a25402611d1",
- "bytes": 186,
+ "sha256": "55ae5c7b92a538490f5b42e5be4f11dfd7fd43e6b60dc23c24a14adf9228457f",
+ "bytes": 246,
"line": 160
},
+ {
+ "lang": "bash",
+ "meta": null,
+ "sha256": "e3bbbc664b20d8e444548efdc9528e1156c0d4da50868bb87f01d2797894d785",
+ "bytes": 107,
+ "line": 170
+ },
+ {
+ "lang": "bash",
+ "meta": null,
+ "sha256": "0f620ad171fa8f8a7e4ee5e12a860c218ab48598886e69486f7562d983874f1e",
+ "bytes": 268,
+ "line": 176
+ },
+ {
+ "lang": "bash",
+ "meta": null,
+ "sha256": "7e1c423747795ea24732770b89f38ddeb4f942ebdf25770f23887c66266f0a32",
+ "bytes": 38,
+ "line": 190
+ },
+ {
+ "lang": "bash",
+ "meta": null,
+ "sha256": "894aecda7cae7ed3cd0bf0de86f635db75dd378b32f60e2e496b85b81c78c92a",
+ "bytes": 94,
+ "line": 196
+ },
{
"lang": "bash",
"meta": null,
"sha256": "83e50e313f3b2f086dc8a52ee3716a6a9e5ed6b44cd94b9a6e10e1f65f48bf9e",
"bytes": 84,
- "line": 172
+ "line": 210
},
{
"lang": "bash",
"meta": null,
- "sha256": "f0e3637c851af3d40ba1ed3c076002b7d966292fefc7e25410e757ea24f91a96",
- "bytes": 190,
- "line": 181
+ "sha256": "38232bb8c4e43050f0ec71cbe8a154cb86b9fd02bc63b7cc4f370243129861bd",
+ "bytes": 257,
+ "line": 219
},
{
"lang": "bash",
"meta": null,
"sha256": "d5bd2d83b2af1f760af5560bb09c66eefc40e39cf52352e1001cfad9a3c4eac4",
"bytes": 95,
- "line": 215
+ "line": 254
},
{
"lang": "bash",
"meta": null,
"sha256": "2f058f5665db6f9b709c6d84e196109453b1be9f9af60eee056f98d1a90fc076",
"bytes": 92,
- "line": 221
+ "line": 260
},
{
"lang": "bash",
"meta": null,
"sha256": "a5f21e5199143694b8a6b0048a1cad17a98186f489694b49deacc108edf1fa7b",
"bytes": 21,
- "line": 229
+ "line": 268
}
],
"links": [
@@ -173125,6 +173158,11 @@
"url": "#integration-credentials",
"depth": 2
},
+ {
+ "title": "Keyless cloud credentials",
+ "url": "#workload-identity",
+ "depth": 3
+ },
{
"title": "Access control",
"url": "#access-control",
@@ -173135,6 +173173,11 @@
"url": "#code-execution",
"depth": 2
},
+ {
+ "title": "Preview features",
+ "url": "#preview-features",
+ "depth": 2
+ },
{
"title": "Chat and PII",
"url": "#chat--pii",
@@ -173221,21 +173264,21 @@
"meta": null,
"sha256": "8212e97007004681330f0d78618939abbc4d7a29283580552542a576245c0826",
"bytes": 79,
- "line": 272
+ "line": 295
},
{
"lang": "bash",
"meta": null,
"sha256": "0e794f3491fc1402990b65869622ebe68febe19c0331544891e8eeb01e8249f3",
"bytes": 129,
- "line": 283
+ "line": 306
},
{
"lang": "text",
"meta": null,
"sha256": "a45ddc97179f78324455bd2d0f25917282f721b3962c68e7455d9917e32379f5",
"bytes": 852,
- "line": 306
+ "line": 329
}
],
"links": [
@@ -174797,28 +174840,28 @@
"meta": null,
"sha256": "4b151527ca8880f0091cad081ede9c3080ddbeb58ffa79751cbd8794fa4fd2d3",
"bytes": 110,
- "line": 31
+ "line": 35
},
{
"lang": "bash",
"meta": null,
"sha256": "07b6e155fe047c59e93c5fbf63e3e4eb331eeb2705f5074e1e5028acbda9f1c0",
"bytes": 220,
- "line": 49
+ "line": 53
},
{
"lang": "bash",
"meta": null,
"sha256": "0dd8aa17d989b63d622ef45a99189f5149672f5052866c9178b9579b853eb28d",
"bytes": 59,
- "line": 55
+ "line": 59
},
{
"lang": "yaml",
"meta": null,
"sha256": "076126c0931b3e1fd1f9f73389fd2302f9d6c806f45809410ae273a51923618c",
"bytes": 80,
- "line": 125
+ "line": 129
}
],
"links": [
@@ -175732,70 +175775,70 @@
"meta": null,
"sha256": "d2548fced54a0f26df513f23562741d37cf411569e6070c0e5e83af42dea923f",
"bytes": 30,
- "line": 94
+ "line": 98
},
{
"lang": "yaml",
"meta": null,
"sha256": "4b119b9923af4a285af84dfe3ff39b5a42278ddbda2d450a0b9da7afeb27fbfd",
"bytes": 129,
- "line": 102
+ "line": 106
},
{
"lang": "yaml",
"meta": null,
"sha256": "1286f5b957d8aae8c5e5ba37b8deaa088e40642bd303c6ba0a4a4e6ef1a8c658",
"bytes": 295,
- "line": 115
+ "line": 119
},
{
"lang": "yaml",
"meta": null,
"sha256": "1d6790fb0ffae5ee4bde0dfe5b5fe40f091c241a4936378b37cd299aa107ff7c",
"bytes": 58,
- "line": 135
+ "line": 139
},
{
"lang": "bash",
"meta": null,
"sha256": "5380d663506380272ec502d0cceaef927d173f2836daec02c78c0fc892769919",
"bytes": 79,
- "line": 162
+ "line": 166
},
{
"lang": "bash",
"meta": null,
"sha256": "4fd1ce391cf85e5093c6348b4d57dac12c1302939037c308314bd8e12c260b38",
"bytes": 117,
- "line": 240
+ "line": 244
},
{
"lang": "bash",
"meta": null,
"sha256": "68d150e3ac8a0f2ab0a0a8e7b7f000dd0b4eeb533f074057fc3f0272e314b060",
"bytes": 41,
- "line": 258
+ "line": 262
},
{
"lang": "yaml",
"meta": null,
"sha256": "97a9e97bd237a84b46a8dd55ddde2685442b763d4b00279d9b4d6db05883cfae",
"bytes": 110,
- "line": 292
+ "line": 296
},
{
"lang": "yaml",
"meta": null,
"sha256": "dd2274ef28334de3fd41b204f57e8af3c3fba12c3af4457c44234c72da35b56c",
"bytes": 551,
- "line": 305
+ "line": 309
},
{
"lang": "yaml",
"meta": null,
"sha256": "a6efcc859a8531bfec1e7434aded7fbbacd567afe8875f4bdee025f428f267d2",
"bytes": 137,
- "line": 349
+ "line": 353
}
],
"links": [
@@ -175955,133 +175998,133 @@
"meta": null,
"sha256": "95f834e604341dd3a4a7dbe6d3e03ba145a0ad5be37a545e49cb8c2650d38542",
"bytes": 140,
- "line": 8
+ "line": 12
},
{
"lang": "bash",
"meta": null,
"sha256": "f53db8ab234bd8bc5fcc3d58410b791feda6c3ee388860a2cfe3af51534c2ae3",
"bytes": 229,
- "line": 18
+ "line": 22
},
{
"lang": "bash",
"meta": null,
"sha256": "fa72373581093369f53d01fe1fb8c39b3d718591d0ee29ee6e3e7bb14752cca0",
"bytes": 318,
- "line": 28
+ "line": 32
},
{
"lang": "bash",
"meta": null,
"sha256": "3cecb71d565f222bc89348c8063e2a7bf072a97fda47d8f28777dd03ffdfe02f",
"bytes": 167,
- "line": 46
+ "line": 50
},
{
"lang": "bash",
"meta": null,
"sha256": "689d5e0f169abc2f9a9fd1c5ef618ca9aa8257cc3fae3f15c70ec3e81e387f5a",
"bytes": 65,
- "line": 56
+ "line": 60
},
{
"lang": "yaml",
"meta": null,
"sha256": "d376cd2a53779eeac8931cbad3f40e5ebb4f8ef1ca1e8b232f86beee2b5ba471",
"bytes": 48,
- "line": 63
+ "line": 67
},
{
"lang": "bash",
"meta": null,
"sha256": "0297fdeeaaad204b960ec9384c842991c7e6ef5a6fa46a3c0c37c512cd95b6b0",
"bytes": 107,
- "line": 71
+ "line": 75
},
{
"lang": "bash",
"meta": null,
"sha256": "b8210a5f0b455614cd2657e2a4fc4e7d77a0c02524b56b77722f69c559391507",
"bytes": 33,
- "line": 84
+ "line": 88
},
{
"lang": "bash",
"meta": null,
"sha256": "236c9446662bbb3595b6501e5d963453498a6064c7a66078dd437baadf3713b8",
"bytes": 204,
- "line": 115
+ "line": 119
},
{
"lang": "yaml",
"meta": null,
"sha256": "c54df79de3f702f739f9fe5c288c3a9fcc348197d33272df3187cf74b5ad8117",
"bytes": 197,
- "line": 134
+ "line": 138
},
{
"lang": "yaml",
"meta": null,
"sha256": "7b4b8ea041d0669f220e56eeabcd0c5c906738646a647de5bb1a548983ffc2d3",
"bytes": 280,
- "line": 144
+ "line": 148
},
{
"lang": "bash",
"meta": null,
"sha256": "4fd1ce391cf85e5093c6348b4d57dac12c1302939037c308314bd8e12c260b38",
"bytes": 117,
- "line": 167
+ "line": 171
},
{
"lang": "bash",
"meta": null,
"sha256": "7a9aac79c13c638a232f991fc97e9076d7080ec7ac75d80c60eb780b42e1d4bd",
"bytes": 76,
- "line": 183
+ "line": 187
},
{
"lang": "bash",
"meta": null,
- "sha256": "0d0f8b183f3e48befc0b8261da1923fe9c81eb5189ae2fb0dc887c37d1ccc256",
- "bytes": 234,
- "line": 196
+ "sha256": "ce7ef86fc4fbeab2fdae583b7e60a64259680ac3374b92e8c7641601ca35af93",
+ "bytes": 207,
+ "line": 200
},
{
"lang": "bash",
"meta": null,
"sha256": "8560a7167d89cfcd9241ccda8ad1ed21f36e8dc5f108714518fe306aadbd5222",
"bytes": 61,
- "line": 227
+ "line": 231
},
{
"lang": "bash",
"meta": null,
"sha256": "a69235481ad1a0208b7ab7a563c83664dce5cc1ca5ec486ae08b9c10c194ca94",
"bytes": 108,
- "line": 235
+ "line": 239
},
{
"lang": "bash",
"meta": null,
"sha256": "341e83bdf0029a50800e322164b960fd942b1344aa38b563aea95a5640ca103b",
"bytes": 190,
- "line": 242
+ "line": 246
},
{
"lang": "bash",
"meta": null,
"sha256": "62bb3e351950d9f5d7f8ed10bfae6fa61dddb02dcfbaa1a5a27f805d3c861df9",
"bytes": 13,
- "line": 269
+ "line": 273
},
{
"lang": "bash",
"meta": null,
"sha256": "7b2c4142afb1d9e4d4609bd3746ddf70d89307eda5cc804cf471c5527dbc3f3d",
"bytes": 65,
- "line": 274
+ "line": 278
}
],
"links": [
@@ -176334,105 +176377,112 @@
"meta": null,
"sha256": "f93d9b9699d57eef6c5baedda45e01aca67135784f44f13492672284f604eebb",
"bytes": 89,
- "line": 16
+ "line": 20
},
{
"lang": "yaml",
"meta": null,
"sha256": "7f57b5468e8035e34ab3e919ee30de9aee9f7a41af1592288193a23cfbcad3cf",
"bytes": 206,
- "line": 29
+ "line": 33
},
{
"lang": "yaml",
"meta": null,
"sha256": "5f0525543906c1d87f4f437be4b0e00016854267457f750a26617e34128ea749",
"bytes": 38,
- "line": 43
+ "line": 47
},
{
"lang": "bash",
"meta": null,
"sha256": "3b3f1fe93cf8b3eb76bfc4aed0b77a9d0059f6a80de9d20471ea892d53836094",
"bytes": 26,
- "line": 54
+ "line": 58
},
{
"lang": "bash",
"meta": null,
"sha256": "2b11cb46a00678505e7f39b61358c1196e726b0096f84acb6944ffcdb9b4ff33",
"bytes": 456,
- "line": 84
+ "line": 88
},
{
"lang": "bash",
"meta": null,
"sha256": "63638fd6cf4e99f972edffff928949b04fc63d6b75d83402057156c4b2265b30",
"bytes": 128,
- "line": 112
+ "line": 116
},
{
"lang": "bash",
"meta": null,
"sha256": "a55a5ea9ad954b5ebd159b620c3fecb10a5262d3c5c6224a8ce670a32880c70f",
"bytes": 112,
- "line": 121
+ "line": 125
},
{
"lang": "bash",
"meta": null,
"sha256": "e91ed481dfd9e3b64d81b10df809bdd9b40543ff74d2d5cc32858912ffc85555",
"bytes": 130,
- "line": 127
+ "line": 131
},
{
"lang": "bash",
"meta": null,
- "sha256": "0c51dd7a84c6fbfe2ce344c3e969a3d57f607e58ee0c94f923fd551188b65553",
- "bytes": 253,
- "line": 135
+ "sha256": "ad878e0b3ad9eca63a1d754f876211eebdd440c656ee0d3587aaa68ade3700bb",
+ "bytes": 275,
+ "line": 139
},
{
"lang": "bash",
"meta": null,
- "sha256": "f1d627bf3b9c3825fcbeae8f48a08f66f2c8711685d489af48885267ed43dd84",
- "bytes": 455,
- "line": 161
+ "sha256": "ff1bd014f6d6327ed60b482b030a73278e8d7829940aa009687b6005698f5917",
+ "bytes": 327,
+ "line": 165
},
{
"lang": "bash",
"meta": null,
"sha256": "f06da1c6caa3599e7e0498042c61dad4cb65c3fd390f1ca66f08d2d5d58f6b6a",
"bytes": 30,
- "line": 202
+ "line": 205
},
{
"lang": "bash",
"meta": null,
"sha256": "2eeb472e1b9a01898d9b9f49f52fa6176917f9eb9e5ead4240b36a8061a47d26",
"bytes": 245,
- "line": 206
+ "line": 209
},
{
"lang": "bash",
"meta": null,
- "sha256": "8b7420174e74e7eb17a2424902eed512fb73a00e55931ee604b97c318c93fc22",
- "bytes": 261,
- "line": 215
+ "sha256": "8446fa16e456c1c785b8888bcfc62395fc23e75a40795178bd70a276e26bcd36",
+ "bytes": 119,
+ "line": 218
+ },
+ {
+ "lang": "bash",
+ "meta": null,
+ "sha256": "eaa8f9247177aab7ff05a6ee64cc60f48e8a6905fd3b4773b52568fc14e14ed0",
+ "bytes": 94,
+ "line": 225
},
{
"lang": "bash",
"meta": null,
"sha256": "689d5e0f169abc2f9a9fd1c5ef618ca9aa8257cc3fae3f15c70ec3e81e387f5a",
"bytes": 65,
- "line": 241
+ "line": 245
},
{
"lang": "bash",
"meta": null,
"sha256": "e25438beeab6ee8d89c44a1d2e8c5b1d0f48973c6167530dc7b2ec0e7057a9c7",
"bytes": 98,
- "line": 245
+ "line": 249
}
],
"links": [
diff --git a/apps/sim/app/api/copilot/chat/abort/route.ts b/apps/sim/app/api/copilot/chat/abort/route.ts
deleted file mode 100644
index 64fcf3a5a28..00000000000
--- a/apps/sim/app/api/copilot/chat/abort/route.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { NextRequest } from 'next/server'
-import { copilotChatAbortContract } from '@/lib/api/contracts/copilot'
-import {
- defineInternalJsonRoute,
- internalOrchestrationErrorPolicy,
- internalRateLimits,
- internalSessionAuth,
-} from '@/lib/api/server/routes'
-import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
-import { abortRun, runControlOperations } from '@/lib/mothership/request/application/controls'
-import { withIncomingGoSpan } from '@/lib/mothership/request/otel'
-
-const handler = defineInternalJsonRoute({
- contract: copilotChatAbortContract,
- auth: internalSessionAuth,
- operation: runControlOperations.abort,
- rateLimit: internalRateLimits.none({
- reason:
- 'Authenticated lifecycle control; Stop and steering must remain available while a run is active.',
- }),
- errorPolicy: internalOrchestrationErrorPolicy,
- mapInput: ({ body }) => body,
- useCase: abortRun,
-})
-
-export const POST = (request: NextRequest, context?: Parameters[1]) =>
- withIncomingGoSpan(request.headers, TraceSpan.CopilotChatAbortStream, undefined, () =>
- handler(request, context)
- )
diff --git a/apps/sim/app/api/copilot/chat/resources/route.ts b/apps/sim/app/api/copilot/chat/resources/route.ts
deleted file mode 100644
index c05e09cdd80..00000000000
--- a/apps/sim/app/api/copilot/chat/resources/route.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import {
- addCopilotChatResourceContract,
- removeCopilotChatResourceContract,
- reorderCopilotChatResourcesContract,
-} from '@/lib/api/contracts/copilot'
-import {
- defineInternalJsonRoute,
- internalOrchestrationErrorPolicy,
- internalRateLimits,
- internalSessionAuth,
-} from '@/lib/api/server/routes'
-import { changeChatResources } from '@/lib/mothership/chat/application/change-resources'
-import { presentChatResourceForBrowser } from '@/lib/mothership/resources/presentation'
-import type { MothershipResource } from '@/lib/mothership/resources/types'
-
-const policy = {
- auth: internalSessionAuth,
- operation: changeChatResources.operation,
- rateLimit: internalRateLimits.none({
- reason: 'Personal chat layout updates have no separate rate bucket.',
- }),
- errorPolicy: internalOrchestrationErrorPolicy,
- useCase: changeChatResources,
- present: ({ resources }: { resources: MothershipResource[] }) => ({
- success: true as const,
- resources: resources.map(presentChatResourceForBrowser),
- }),
-}
-
-export const POST = defineInternalJsonRoute({
- ...policy,
- contract: addCopilotChatResourceContract,
- mapInput: ({ body }) => ({
- chatId: body.chatId,
- change: {
- kind: 'upsert' as const,
- resources: [
- { ...body.resource, ...(body.clearViewId ? { clearViewId: true as const } : {}) },
- ],
- },
- }),
-})
-
-export const PATCH = defineInternalJsonRoute({
- ...policy,
- contract: reorderCopilotChatResourcesContract,
- mapInput: ({ body }) => ({
- chatId: body.chatId,
- change: { kind: 'reorder' as const, resources: body.resources },
- }),
-})
-
-export const DELETE = defineInternalJsonRoute({
- ...policy,
- contract: removeCopilotChatResourceContract,
- mapInput: ({ body }) => ({
- chatId: body.chatId,
- change: {
- kind: 'remove' as const,
- resources: [
- {
- type: body.resourceType,
- id: body.resourceId,
- workspaceId: body.workspaceId,
- owner: body.owner,
- },
- ],
- },
- }),
-})
diff --git a/apps/sim/app/api/copilot/chat/stop/route.ts b/apps/sim/app/api/copilot/chat/stop/route.ts
deleted file mode 100644
index 33ccee4e0fd..00000000000
--- a/apps/sim/app/api/copilot/chat/stop/route.ts
+++ /dev/null
@@ -1,115 +0,0 @@
-import { createLogger } from '@sim/logger'
-import { generateId } from '@sim/utils/id'
-import { type NextRequest, NextResponse } from 'next/server'
-import { copilotChatStopContract } from '@/lib/api/contracts/copilot'
-import { parseRequest } from '@/lib/api/server'
-import { getSession } from '@/lib/auth'
-import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
-import { getAccessibleCopilotChatAuth } from '@/lib/mothership/chat/lifecycle'
-import {
- normalizeMessage,
- type PersistedMessage,
- withStoppedContentBlock,
-} from '@/lib/mothership/chat/persisted-message'
-import {
- finalizeAssistantTurn,
- readStoppedAssistantMessage,
-} from '@/lib/mothership/chat/terminal-state'
-import { publishChatStatusChanged } from '@/lib/mothership/chat-status'
-import {
- CopilotChatFinalizeOutcome,
- CopilotStopOutcome,
-} from '@/lib/mothership/generated/trace-attribute-values-v1'
-import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
-import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
-import { withIncomingGoSpan } from '@/lib/mothership/request/otel'
-
-const logger = createLogger('CopilotChatStopAPI')
-
-// POST /api/copilot/chat/stop — persists partial assistant content
-// when the user stops mid-stream. Lock release is handled by the
-// aborted server stream unwinding, not this handler.
-export const POST = withRouteHandler((req: NextRequest) =>
- withIncomingGoSpan(req.headers, TraceSpan.CopilotChatStopStream, undefined, async (span) => {
- try {
- const session = await getSession()
- if (!session?.user?.id) {
- span.setAttribute(TraceAttr.CopilotStopOutcome, CopilotStopOutcome.Unauthorized)
- return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
- }
-
- const parsed = await parseRequest(copilotChatStopContract, req, {})
- if (!parsed.success) {
- span.setAttribute(TraceAttr.CopilotStopOutcome, CopilotStopOutcome.ValidationError)
- return parsed.response
- }
- const { chatId, streamId, content, contentBlocks, requestId } = parsed.data.body
- const chat = await getAccessibleCopilotChatAuth(chatId, session.user.id, {
- principal: { kind: 'session', userId: session.user.id, sessionId: session.session.id },
- })
- if (!chat) return NextResponse.json({ success: true })
- span.setAttributes({
- [TraceAttr.ChatId]: chatId,
- [TraceAttr.StreamId]: streamId,
- [TraceAttr.UserId]: session.user.id,
- [TraceAttr.CopilotStopContentLength]: content.length,
- [TraceAttr.CopilotStopBlocksCount]: contentBlocks?.length ?? 0,
- ...(requestId ? { [TraceAttr.RequestId]: requestId } : {}),
- })
-
- const hasContent = content.trim().length > 0
- const hasBlocks = Array.isArray(contentBlocks) && contentBlocks.length > 0
- const assistantBlocks = hasBlocks
- ? contentBlocks
- : hasContent
- ? [{ type: 'text', channel: 'assistant', content }]
- : []
- const assistantMessage: PersistedMessage | null =
- hasContent || hasBlocks
- ? withStoppedContentBlock(
- normalizeMessage({
- id: generateId(),
- role: 'assistant',
- content,
- timestamp: new Date().toISOString(),
- contentBlocks: assistantBlocks,
- ...(requestId ? { requestId } : {}),
- })
- )
- : await readStoppedAssistantMessage(streamId, chatId, session.user.id)
- /** The run owner retains the full response if replay was trimmed or has not started. */
- if (!assistantMessage) return NextResponse.json({ success: true })
- const result = await finalizeAssistantTurn({
- chatId,
- userId: session.user.id,
- userMessageId: streamId,
- assistantMessage,
- streamMarkerPolicy: 'active-or-cleared',
- preferServerReplay: hasContent || hasBlocks,
- })
- span.setAttribute(TraceAttr.CopilotStopAppendedAssistant, result.appendedAssistant)
- const stopOutcome = !result.found
- ? CopilotStopOutcome.ChatNotFound
- : result.updated || result.outcome === CopilotChatFinalizeOutcome.AssistantAlreadyPersisted
- ? CopilotStopOutcome.Persisted
- : CopilotStopOutcome.NoMatchingRow
- const shouldPublishCompleted =
- result.updated || result.outcome === CopilotChatFinalizeOutcome.AssistantAlreadyPersisted
-
- if (shouldPublishCompleted) {
- publishChatStatusChanged(chat, {
- chatId,
- type: 'completed',
- streamId,
- })
- }
-
- span.setAttribute(TraceAttr.CopilotStopOutcome, stopOutcome)
- return NextResponse.json({ success: true })
- } catch (error) {
- logger.error('Error stopping chat stream:', error)
- span.setAttribute(TraceAttr.CopilotStopOutcome, CopilotStopOutcome.InternalError)
- return NextResponse.json({ error: 'Internal server error' }, { status: 500 })
- }
- })
-)
diff --git a/apps/sim/app/api/copilot/chat/stream/route.ts b/apps/sim/app/api/copilot/chat/stream/route.ts
deleted file mode 100644
index d214fb471a2..00000000000
--- a/apps/sim/app/api/copilot/chat/stream/route.ts
+++ /dev/null
@@ -1,623 +0,0 @@
-import { type Context, context as otelContext, type Span, trace } from '@opentelemetry/api'
-import type { SessionPrincipal } from '@sim/auth/principal'
-import { createLogger } from '@sim/logger'
-import { getErrorMessage } from '@sim/utils/errors'
-import { sleep } from '@sim/utils/helpers'
-import { type NextRequest, NextResponse } from 'next/server'
-import { copilotChatStreamContract } from '@/lib/api/contracts/copilot'
-import { parseRequest } from '@/lib/api/server'
-import {
- InternalUnauthenticatedError,
- internalOrchestrationErrorPolicy,
- internalSessionAuth,
-} from '@/lib/api/server/routes'
-import { encodeSSEComment } from '@/lib/core/utils/sse'
-import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
-import {
- MOTHERSHIP_DESKTOP_EXECUTOR_HEADER,
- MOTHERSHIP_STREAM_REPLAY_HEADER,
-} from '@/lib/mothership/constants'
-import {
- MothershipStreamV1CompletionStatus,
- MothershipStreamV1EventType,
-} from '@/lib/mothership/generated/mothership-stream-v1'
-import {
- CopilotResumeOutcome,
- CopilotTransport,
-} from '@/lib/mothership/generated/trace-attribute-values-v1'
-import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
-import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
-import { readChatStream } from '@/lib/mothership/request/application/recover-stream'
-import { contextFromRequestHeaders } from '@/lib/mothership/request/go/propagation'
-import { getCopilotTracer, markSpanForError } from '@/lib/mothership/request/otel'
-import {
- createEvent,
- encodeSSEEnvelope,
- findReplayGap,
- forwardRunReplay,
- holdStreamViewer,
- isTerminalStreamStatus,
- openRunReplay,
- RunReplayUnavailableError,
- readEvents,
- readFilePreviewSessions,
- readRingPosition,
- replayGapTerminal,
- ringCanServe,
- SSE_RESPONSE_HEADERS,
-} from '@/lib/mothership/request/session'
-import { toReplayEnvelope, toStreamBatchEvent } from '@/lib/mothership/request/session/types'
-
-export const maxDuration = 3600
-
-const logger = createLogger('CopilotChatStreamAPI')
-const POLL_INTERVAL_MS = 250
-const POLL_INTERVAL_MAX_MS = 2_000
-const REPLAY_KEEPALIVE_INTERVAL_MS = 15_000
-/** How often a tail that is still flushing events checks that its ring can serve it. */
-const RING_CHECK_EVERY_BUSY_POLLS = 8
-/**
- * One replay response stays open at most this long, inside the route's `maxDuration`.
- * A run still going at the cap is not over: the response ends without a terminal
- * event and the client re-attaches from its cursor.
- */
-const MAX_STREAM_MS = 60 * 60 * 1000 - 60_000
-
-/**
- * Whether ring events read after `cursor` start right after it. The ring can trim its
- * head between a gap check and the read, and a read that starts later would silently
- * skip part of the turn.
- */
-function startsAfterCursor(events: readonly { seq: number }[], cursor: string): boolean {
- return events.length === 0 || events[0].seq <= Number(cursor || '0') + 1
-}
-
-function extractCanonicalRequestId(value: unknown): string {
- return typeof value === 'string' && value.length > 0 ? value : ''
-}
-
-function extractRunRequestId(run: { requestContext?: unknown } | null | undefined): string {
- if (!run || typeof run.requestContext !== 'object' || run.requestContext === null) {
- return ''
- }
- const requestContext = run.requestContext as Record
- return (
- extractCanonicalRequestId(requestContext.requestId) ||
- extractCanonicalRequestId(requestContext.simRequestId)
- )
-}
-
-function extractEnvelopeRequestId(envelope: { trace?: { requestId?: unknown } }): string {
- return extractCanonicalRequestId(envelope.trace?.requestId)
-}
-
-function buildResumeTerminalEnvelopes(options: {
- streamId: string
- afterCursor: string
- status: MothershipStreamV1CompletionStatus
- message?: string
- code: string
- reason?: string
- requestId?: string
-}) {
- const baseSeq = Number(options.afterCursor || '0')
- const seq = Number.isFinite(baseSeq) ? baseSeq : 0
- const envelopes: ReturnType[] = []
- const rid = options.requestId ?? ''
-
- if (options.status === MothershipStreamV1CompletionStatus.error) {
- envelopes.push(
- createEvent({
- streamId: options.streamId,
- cursor: String(seq + 1),
- seq: seq + 1,
- requestId: rid,
- type: MothershipStreamV1EventType.error,
- payload: {
- message: options.message || 'Stream recovery failed before completion.',
- code: options.code,
- },
- })
- )
- }
-
- envelopes.push(
- createEvent({
- streamId: options.streamId,
- cursor: String(seq + envelopes.length + 1),
- seq: seq + envelopes.length + 1,
- requestId: rid,
- type: MothershipStreamV1EventType.complete,
- payload: {
- status: options.status,
- ...(options.reason ? { reason: options.reason } : {}),
- },
- })
- )
-
- return envelopes
-}
-
-export const GET = withRouteHandler(async (request: NextRequest) => {
- let principal: SessionPrincipal
- try {
- principal = await internalSessionAuth.authenticate()
- } catch (error) {
- if (error instanceof InternalUnauthenticatedError)
- return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
- throw error
- }
- const authenticatedUserId = principal.userId
-
- const parsed = await parseRequest(copilotChatStreamContract, request, {})
- if (!parsed.success) return parsed.response
- const { streamId, after: afterCursor, batch: batchMode, source } = parsed.data.query
-
- if (!streamId) {
- return NextResponse.json({ error: 'streamId is required' }, { status: 400 })
- }
-
- // Root span for the whole resume/reconnect request. In stream mode the
- // work happens inside `ReadableStream.start`, which the Node runtime
- // invokes after this function returns and OUTSIDE the AsyncLocalStorage
- // scope installed by `startActiveSpan`. We therefore start the span
- // manually, capture its context, and re-enter that context inside the
- // stream callback so every nested `withCopilotSpan` / `withDbSpan` call
- // attaches to this root.
- //
- // `contextFromRequestHeaders` extracts the W3C `traceparent` the
- // client echoed (set via `streamTraceparentRef` on Sim's chat POST
- // response), so the resume span becomes a child of the original
- // chat's `gen_ai.agent.execute` trace instead of a disconnected
- // new root. On reconnects after page reload (client ref was wiped)
- // the header is absent and extraction leaves the ambient context
- // alone → the resume span becomes its own root. Same as pre-
- // linking behavior; no regression.
- const incomingContext = contextFromRequestHeaders(request.headers)
- const rootSpan = getCopilotTracer().startSpan(
- TraceSpan.CopilotResumeRequest,
- {
- attributes: {
- [TraceAttr.CopilotTransport]: batchMode ? CopilotTransport.Batch : CopilotTransport.Stream,
- [TraceAttr.StreamId]: streamId,
- [TraceAttr.UserId]: authenticatedUserId,
- [TraceAttr.CopilotResumeAfterCursor]: afterCursor || '0',
- },
- },
- incomingContext
- )
- const rootContext = trace.setSpan(incomingContext, rootSpan)
-
- try {
- return await otelContext.with(rootContext, () =>
- handleResumeRequestBody({
- request,
- streamId,
- afterCursor,
- batchMode,
- fromLog: source === 'log',
- principal,
- rootSpan,
- rootContext,
- })
- )
- } catch (err) {
- markSpanForError(rootSpan, err)
- rootSpan.end()
- const errorResponse =
- internalOrchestrationErrorPolicy.project(err) ?? internalOrchestrationErrorPolicy.unhandled!()
- return NextResponse.json(errorResponse.body, {
- status: errorResponse.status,
- headers: errorResponse.headers,
- })
- }
-})
-
-async function handleResumeRequestBody({
- request,
- streamId,
- afterCursor,
- batchMode,
- fromLog,
- principal,
- rootSpan,
- rootContext,
-}: {
- request: NextRequest
- streamId: string
- afterCursor: string
- batchMode: boolean
- /** The reader's cursor came from a log re-sync, so the ring never serves it. */
- fromLog: boolean
- principal: SessionPrincipal
- rootSpan: Span
- rootContext: Context
-}) {
- const readRun = () =>
- readChatStream.execute({
- principal,
- input: { streamId },
- })
- const run = await readRun()
- logger.info('[Resume] Stream lookup', {
- streamId,
- afterCursor,
- batchMode,
- hasRun: !!run,
- runStatus: run?.status,
- })
- if (!run) {
- rootSpan.setAttribute(TraceAttr.CopilotResumeOutcome, CopilotResumeOutcome.StreamNotFound)
- rootSpan.end()
- return NextResponse.json({ error: 'Stream not found' }, { status: 404 })
- }
- rootSpan.setAttribute(TraceAttr.CopilotRunStatus, run.status)
-
- if (batchMode) {
- const afterSeq = afterCursor || '0'
- const [gap, events, previewSessions] = await Promise.all([
- fromLog ? null : findReplayGap(streamId, afterSeq, extractRunRequestId(run)),
- readEvents(streamId, afterSeq),
- readFilePreviewSessions(streamId).catch((error) => {
- logger.warn('Failed to read preview sessions for stream batch', {
- streamId,
- error: getErrorMessage(error),
- })
- return []
- }),
- ])
- // A reader the ring cannot serve, or whose next event it trimmed after the gap check,
- // is re-synced from the worker log by the live tail.
- const batchEvents =
- fromLog || gap || !startsAfterCursor(events, afterSeq) ? [] : events.map(toStreamBatchEvent)
- logger.info('[Resume] Batch response', {
- streamId,
- afterCursor: afterSeq,
- eventCount: batchEvents.length,
- previewSessionCount: previewSessions.length,
- runStatus: run.status,
- })
- rootSpan.setAttributes({
- [TraceAttr.CopilotResumeOutcome]: CopilotResumeOutcome.BatchDelivered,
- [TraceAttr.CopilotResumeEventCount]: batchEvents.length,
- [TraceAttr.CopilotResumePreviewSessionCount]: previewSessions.length,
- })
- rootSpan.end()
- return NextResponse.json({
- success: true,
- events: batchEvents,
- previewSessions,
- status: run.status,
- ...(run.chatId ? { chatId: run.chatId } : {}),
- ...(run.desktopDeviceId ? { desktopToolsOnDevice: true } : {}),
- })
- }
-
- const startTime = Date.now()
- let totalEventsFlushed = 0
- let pollIterations = 0
-
- /**
- * A reader the ring cannot serve is re-synced from the worker's durable log for the
- * rest of this response, never handed back to the ring: the log and the ring have
- * no shared position to join on. The header tells the client to rebuild the turn
- * from an empty response, since the replay's cursors restart at 1.
- */
- const ringGap = fromLog
- ? null
- : await findReplayGap(streamId, afterCursor || '0', extractRunRequestId(run))
- // A finished run whose buffer expired answers its terminal; its transcript is persisted.
- const gap =
- ringGap && !(ringGap.latestSeq <= 0 && isTerminalStreamStatus(run.status)) ? ringGap : null
- const resyncFromLog = fromLog || gap !== null
- let replayBody: ReadableStream | null = null
- /** Releases the worker's replay once this response ends; the request signal may never fire. */
- const replayAbort = new AbortController()
- const replaySignal = AbortSignal.any([request.signal, replayAbort.signal])
- if (resyncFromLog && run.chatId) {
- try {
- replayBody = await openRunReplay({
- streamId,
- chatId: run.chatId,
- userId: principal.userId,
- signal: replaySignal,
- })
- } catch (error) {
- if (!(error instanceof RunReplayUnavailableError)) throw error
- logger.warn('Run replay unavailable; the client will retry', {
- streamId,
- error: getErrorMessage(error),
- })
- markSpanForError(rootSpan, error)
- rootSpan.end()
- return NextResponse.json({ error: 'Stream replay is unavailable' }, { status: 503 })
- }
- }
-
- const stream = new ReadableStream({
- async start(controller) {
- // Re-enter the root OTel context so any `withCopilotSpan` call below
- // (inside flushEvents/replayGapTerminal/etc.) parents under
- // copilot.resume.request instead of becoming an orphan.
- return otelContext.with(rootContext, () => startInner(controller))
- },
- })
-
- async function startInner(controller: ReadableStreamDefaultController) {
- let cursor = afterCursor || '0'
- let controllerClosed = false
- let sawTerminalEvent = false
- let currentRequestId = extractRunRequestId(run)
- let lastWriteTime = Date.now()
- // Stamp the logical request id + chat id on the resume root as soon
- // as we resolve them from the run row, so TraceQL joins work on
- // resume legs the same way they do on the original POST.
- if (currentRequestId) {
- rootSpan.setAttribute(TraceAttr.RequestId, currentRequestId)
- rootSpan.setAttribute(TraceAttr.SimRequestId, currentRequestId)
- }
- if (run?.chatId) {
- rootSpan.setAttribute(TraceAttr.ChatId, run.chatId)
- }
-
- const closeController = () => {
- if (controllerClosed) return
- controllerClosed = true
- try {
- controller.close()
- } catch {
- // Controller already closed by runtime/client
- }
- }
-
- const enqueueEvent = (payload: unknown) => {
- if (controllerClosed) return false
- try {
- controller.enqueue(encodeSSEEnvelope(payload))
- lastWriteTime = Date.now()
- return true
- } catch {
- controllerClosed = true
- return false
- }
- }
-
- const enqueueComment = (comment: string) => {
- if (controllerClosed) return false
- try {
- controller.enqueue(encodeSSEComment(comment))
- lastWriteTime = Date.now()
- return true
- } catch {
- controllerClosed = true
- return false
- }
- }
-
- const abortListener = () => {
- controllerClosed = true
- }
- request.signal.addEventListener('abort', abortListener, { once: true })
- // An attached reader is a chat view that starts this turn's workflow tools.
- const releaseViewer = await holdStreamViewer(streamId)
-
- /** Delivers the ring's events after the cursor, or returns null if it trimmed the next one. */
- const flushEvents = async (): Promise => {
- const events = await readEvents(streamId, cursor)
- if (!startsAfterCursor(events, cursor)) {
- logger.warn('Replay ring trimmed past a reader cursor', { streamId, cursor })
- return null
- }
- if (events.length > 0) {
- logger.debug('[Resume] Flushing events', {
- streamId,
- afterCursor: cursor,
- eventCount: events.length,
- })
- }
- for (const envelope of events) {
- if (!enqueueEvent(toReplayEnvelope(envelope))) {
- break
- }
- totalEventsFlushed += 1
- cursor = envelope.stream.cursor ?? String(envelope.seq)
- currentRequestId = extractEnvelopeRequestId(envelope) || currentRequestId
- if (envelope.type === MothershipStreamV1EventType.complete) {
- sawTerminalEvent = true
- }
- }
- return events.length
- }
-
- const emitTerminalIfMissing = (
- status: MothershipStreamV1CompletionStatus,
- options?: { message?: string; code: string; reason?: string }
- ) => {
- if (controllerClosed || sawTerminalEvent) {
- return
- }
- for (const envelope of buildResumeTerminalEnvelopes({
- streamId,
- afterCursor: cursor,
- status,
- message: options?.message,
- code: options?.code ?? 'resume_terminal',
- reason: options?.reason,
- requestId: currentRequestId,
- })) {
- if (!enqueueEvent(envelope)) {
- break
- }
- cursor = envelope.stream.cursor ?? String(envelope.seq)
- if (envelope.type === MothershipStreamV1EventType.complete) {
- sawTerminalEvent = true
- }
- }
- }
-
- /** Forwards the worker's replay, keeping the response alive while it waits. */
- const streamRunReplay = async (body: ReadableStream) => {
- const keepalive = setInterval(() => {
- if (Date.now() - lastWriteTime < REPLAY_KEEPALIVE_INTERVAL_MS) return
- if (!enqueueComment('keepalive')) replayAbort.abort()
- }, REPLAY_KEEPALIVE_INTERVAL_MS)
- try {
- const end = await forwardRunReplay({
- body,
- streamId,
- signal: replaySignal,
- write: (envelope) => {
- if (!enqueueEvent(envelope)) return false
- totalEventsFlushed += 1
- cursor = envelope.stream.cursor ?? cursor
- if (envelope.type === MothershipStreamV1EventType.complete) sawTerminalEvent = true
- return true
- },
- readRunStatus: async () => (await readRun().catch(() => null))?.status ?? null,
- isClosed: () => controllerClosed,
- deadlineAt: startTime + MAX_STREAM_MS,
- })
- logger.info('[Resume] Run replay ended', { streamId, end, eventCount: totalEventsFlushed })
- } finally {
- clearInterval(keepalive)
- replayAbort.abort()
- }
- }
-
- try {
- enqueueComment('accepted')
-
- if (replayBody) {
- await streamRunReplay(replayBody)
- return
- }
- if (resyncFromLog) {
- const position = gap ?? (await readRingPosition(streamId, cursor))
- const terminal = await replayGapTerminal(streamId, position, currentRequestId)
- for (const envelope of terminal.envelopes) {
- if (!enqueueEvent(envelope)) {
- break
- }
- cursor = envelope.stream.cursor ?? String(envelope.seq)
- currentRequestId = extractEnvelopeRequestId(envelope) || currentRequestId
- if (envelope.type === MothershipStreamV1EventType.complete) {
- sawTerminalEvent = true
- }
- }
- return
- }
-
- let lastFlushed = await flushEvents()
- if (lastFlushed === null) return
-
- let pollDelayMs = POLL_INTERVAL_MS
- while (!controllerClosed && Date.now() - startTime < MAX_STREAM_MS) {
- pollIterations += 1
- const currentRun = await readRun().catch((err) => {
- logger.warn('Failed to poll latest run for stream', {
- streamId,
- error: getErrorMessage(err),
- })
- return null
- })
- if (!currentRun) {
- emitTerminalIfMissing(MothershipStreamV1CompletionStatus.error, {
- message: 'The stream could not be recovered because its run metadata is unavailable.',
- code: 'resume_run_unavailable',
- reason: 'run_unavailable',
- })
- break
- }
- // The ring lost its head, restarted or expired under this live tail; the re-attach
- // re-syncs, and a finished run answers its terminal instead. Only a quiet ring can
- // restart or be re-sent into by a recovery, so a busy tail checks every few polls.
- const checkRing = lastFlushed === 0 || pollIterations % RING_CHECK_EVERY_BUSY_POLLS === 0
- if (
- checkRing &&
- !isTerminalStreamStatus(currentRun.status) &&
- !ringCanServe(await readRingPosition(streamId, cursor))
- ) {
- logger.warn('Replay ring can no longer serve a live tail', { streamId, cursor })
- break
- }
-
- currentRequestId = extractRunRequestId(currentRun) || currentRequestId
-
- const flushed = await flushEvents()
- if (flushed === null) break
- lastFlushed = flushed
- /* Adaptive tail: 4 Hz only while events are actually flowing; a quiet stream
- decays toward the cap so an attached client doesn't hammer Postgres + Redis
- at 4 Hz for up to an hour. Any flushed event snaps back to full rate. */
- pollDelayMs =
- flushed > 0 ? POLL_INTERVAL_MS : Math.min(pollDelayMs * 2, POLL_INTERVAL_MAX_MS)
-
- if (controllerClosed) {
- break
- }
- if (isTerminalStreamStatus(currentRun.status)) {
- emitTerminalIfMissing(currentRun.status, {
- message:
- currentRun.status === MothershipStreamV1CompletionStatus.error
- ? typeof currentRun.error === 'string'
- ? currentRun.error
- : 'The recovered stream ended with an error.'
- : undefined,
- code: 'resume_terminal_status',
- reason: 'terminal_status',
- })
- break
- }
-
- if (request.signal.aborted) {
- controllerClosed = true
- break
- }
-
- if (Date.now() - lastWriteTime >= REPLAY_KEEPALIVE_INTERVAL_MS) {
- enqueueComment('keepalive')
- }
-
- await sleep(pollDelayMs)
- }
- } catch (error) {
- if (!controllerClosed && !request.signal.aborted) {
- logger.warn('Stream replay failed', {
- streamId,
- error: getErrorMessage(error),
- })
- emitTerminalIfMissing(MothershipStreamV1CompletionStatus.error, {
- message: 'The stream replay failed before completion.',
- code: 'resume_internal',
- reason: 'stream_replay_failed',
- })
- }
- markSpanForError(rootSpan, error)
- } finally {
- releaseViewer()
- request.signal.removeEventListener('abort', abortListener)
- // Read before closing: closing the controller here is this route ending, not the client.
- const clientDisconnected = controllerClosed
- closeController()
- rootSpan.setAttributes({
- [TraceAttr.CopilotResumeOutcome]: sawTerminalEvent
- ? CopilotResumeOutcome.TerminalDelivered
- : clientDisconnected
- ? CopilotResumeOutcome.ClientDisconnected
- : CopilotResumeOutcome.EndedWithoutTerminal,
- [TraceAttr.CopilotResumeEventCount]: totalEventsFlushed,
- [TraceAttr.CopilotResumePollIterations]: pollIterations,
- [TraceAttr.CopilotResumeDurationMs]: Date.now() - startTime,
- })
- rootSpan.end()
- }
- }
-
- return new Response(stream, {
- headers: {
- ...SSE_RESPONSE_HEADERS,
- ...(replayBody ? { [MOTHERSHIP_STREAM_REPLAY_HEADER]: 'log' } : {}),
- ...(run.desktopDeviceId ? { [MOTHERSHIP_DESKTOP_EXECUTOR_HEADER]: 'device' } : {}),
- },
- })
-}
diff --git a/apps/sim/app/api/copilot/chat/abort/route.test.ts b/apps/sim/app/api/mothership/chat/abort/route.test.ts
similarity index 99%
rename from apps/sim/app/api/copilot/chat/abort/route.test.ts
rename to apps/sim/app/api/mothership/chat/abort/route.test.ts
index e3a516df4d7..9a14a247f78 100644
--- a/apps/sim/app/api/copilot/chat/abort/route.test.ts
+++ b/apps/sim/app/api/mothership/chat/abort/route.test.ts
@@ -74,7 +74,7 @@ vi.mock('@/lib/core/application/workspace-authorization', () => workspaceAuthori
vi.mock('@/lib/core/application/organization-authorization', () => organizationAuthorizationMock)
import { OrchestrationError } from '@/lib/core/orchestration/types'
-import { POST } from '@/app/api/copilot/chat/abort/route'
+import { POST } from '@/app/api/mothership/chat/abort/route'
const { mockAuthorizeWorkspaceOperation: mockAuthorize } = workspaceAuthorizationMockFns
const { mockGetActivelyBannedUserIds: mockBannedUsers } = authBanMockFns
@@ -94,7 +94,7 @@ function abortRequest() {
return createMockRequest('POST', { streamId: 'stream-1', chatId: 'chat-1' })
}
-describe('POST /api/copilot/chat/abort', () => {
+describe('POST /api/mothership/chat/abort', () => {
beforeEach(() => {
mockChatContext.mockResolvedValue({
chatId: 'chat-1',
diff --git a/apps/sim/app/api/mothership/chat/abort/route.ts b/apps/sim/app/api/mothership/chat/abort/route.ts
index 25cd9eb42b8..b10d43b2550 100644
--- a/apps/sim/app/api/mothership/chat/abort/route.ts
+++ b/apps/sim/app/api/mothership/chat/abort/route.ts
@@ -1,12 +1,29 @@
import type { NextRequest } from 'next/server'
-import { mothershipChatAbortEnvelopeSchema } from '@/lib/api/contracts/mothership-chats'
-import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
-import { validateShimEnvelope } from '@/lib/mothership/request/http'
-import { POST as copilotAbortPost } from '@/app/api/copilot/chat/abort/route'
+import { mothershipChatAbortContract } from '@/lib/api/contracts/mothership-chats'
+import {
+ defineInternalJsonRoute,
+ internalOrchestrationErrorPolicy,
+ internalRateLimits,
+ internalSessionAuth,
+} from '@/lib/api/server/routes'
+import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
+import { abortRun, runControlOperations } from '@/lib/mothership/request/application/controls'
+import { withIncomingGoSpan } from '@/lib/mothership/request/otel'
-export const POST = withRouteHandler(async (request: NextRequest) => {
- const invalid = await validateShimEnvelope(request, mothershipChatAbortEnvelopeSchema)
- if (invalid) return invalid
-
- return copilotAbortPost(request, undefined)
+const handler = defineInternalJsonRoute({
+ contract: mothershipChatAbortContract,
+ auth: internalSessionAuth,
+ operation: runControlOperations.abort,
+ rateLimit: internalRateLimits.none({
+ reason:
+ 'Authenticated lifecycle control; Stop and steering must remain available while a run is active.',
+ }),
+ errorPolicy: internalOrchestrationErrorPolicy,
+ mapInput: ({ body }) => body,
+ useCase: abortRun,
})
+
+export const POST = (request: NextRequest, context?: Parameters[1]) =>
+ withIncomingGoSpan(request.headers, TraceSpan.CopilotChatAbortStream, undefined, () =>
+ handler(request, context)
+ )
diff --git a/apps/sim/app/api/mothership/chat/resources/route.ts b/apps/sim/app/api/mothership/chat/resources/route.ts
index dbb169f5e3d..897fc8c71ad 100644
--- a/apps/sim/app/api/mothership/chat/resources/route.ts
+++ b/apps/sim/app/api/mothership/chat/resources/route.ts
@@ -1,36 +1,70 @@
-import type { NextRequest, NextResponse } from 'next/server'
-import { mothershipChatResourceEnvelopeSchema } from '@/lib/api/contracts/mothership-chats'
-import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
-import { validateShimEnvelope } from '@/lib/mothership/request/http'
import {
- DELETE as copilotResourcesDelete,
- PATCH as copilotResourcesPatch,
- POST as copilotResourcesPost,
-} from '@/app/api/copilot/chat/resources/route'
+ addMothershipChatResourceContract,
+ removeMothershipChatResourceContract,
+ reorderMothershipChatResourcesContract,
+} from '@/lib/api/contracts/mothership-chats'
+import {
+ defineInternalJsonRoute,
+ internalOrchestrationErrorPolicy,
+ internalRateLimits,
+ internalSessionAuth,
+} from '@/lib/api/server/routes'
+import { changeChatResources } from '@/lib/mothership/chat/application/change-resources'
+import { presentChatResourceForBrowser } from '@/lib/mothership/resources/presentation'
+import type { MothershipResource } from '@/lib/mothership/resources/types'
-async function validateResourceRequestEnvelope(request: NextRequest): Promise {
- const invalid = await validateShimEnvelope(request, mothershipChatResourceEnvelopeSchema)
- if (invalid) return invalid
- return null
+const policy = {
+ auth: internalSessionAuth,
+ operation: changeChatResources.operation,
+ rateLimit: internalRateLimits.none({
+ reason: 'Personal chat layout updates have no separate rate bucket.',
+ }),
+ errorPolicy: internalOrchestrationErrorPolicy,
+ useCase: changeChatResources,
+ present: ({ resources }: { resources: MothershipResource[] }) => ({
+ success: true as const,
+ resources: resources.map(presentChatResourceForBrowser),
+ }),
}
-export const POST = withRouteHandler(async (request: NextRequest) => {
- const validationResponse = await validateResourceRequestEnvelope(request)
- if (validationResponse) return validationResponse
-
- return copilotResourcesPost(request, undefined)
+export const POST = defineInternalJsonRoute({
+ ...policy,
+ contract: addMothershipChatResourceContract,
+ mapInput: ({ body }) => ({
+ chatId: body.chatId,
+ change: {
+ kind: 'upsert' as const,
+ resources: [
+ { ...body.resource, ...(body.clearViewId ? { clearViewId: true as const } : {}) },
+ ],
+ },
+ }),
})
-export const PATCH = withRouteHandler(async (request: NextRequest) => {
- const validationResponse = await validateResourceRequestEnvelope(request)
- if (validationResponse) return validationResponse
-
- return copilotResourcesPatch(request, undefined)
+export const PATCH = defineInternalJsonRoute({
+ ...policy,
+ contract: reorderMothershipChatResourcesContract,
+ mapInput: ({ body }) => ({
+ chatId: body.chatId,
+ change: { kind: 'reorder' as const, resources: body.resources },
+ }),
})
-export const DELETE = withRouteHandler(async (request: NextRequest) => {
- const validationResponse = await validateResourceRequestEnvelope(request)
- if (validationResponse) return validationResponse
-
- return copilotResourcesDelete(request, undefined)
+export const DELETE = defineInternalJsonRoute({
+ ...policy,
+ contract: removeMothershipChatResourceContract,
+ mapInput: ({ body }) => ({
+ chatId: body.chatId,
+ change: {
+ kind: 'remove' as const,
+ resources: [
+ {
+ type: body.resourceType,
+ id: body.resourceId,
+ workspaceId: body.workspaceId,
+ owner: body.owner,
+ },
+ ],
+ },
+ }),
})
diff --git a/apps/sim/app/api/mothership/chat/route.ts b/apps/sim/app/api/mothership/chat/route.ts
index 74f5c159b9f..6374e006909 100644
--- a/apps/sim/app/api/mothership/chat/route.ts
+++ b/apps/sim/app/api/mothership/chat/route.ts
@@ -3,7 +3,7 @@ import { mothershipChatPostEnvelopeSchema } from '@/lib/api/contracts/mothership
import { getSession } from '@/lib/auth'
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
import { handleUnifiedChatPost } from '@/lib/mothership/chat/post'
-import { validateShimEnvelope } from '@/lib/mothership/request/http'
+import { validateChatPostEnvelope } from '@/lib/mothership/request/http'
/**
* Caps this response on serverless hosts only; the Node server bounds nothing with it.
@@ -18,7 +18,7 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}
- const invalid = await validateShimEnvelope(request, mothershipChatPostEnvelopeSchema)
+ const invalid = await validateChatPostEnvelope(request, mothershipChatPostEnvelopeSchema)
if (invalid) return invalid
return handleUnifiedChatPost(request)
diff --git a/apps/sim/app/api/copilot/chat/stop/route.test.ts b/apps/sim/app/api/mothership/chat/stop/route.test.ts
similarity index 98%
rename from apps/sim/app/api/copilot/chat/stop/route.test.ts
rename to apps/sim/app/api/mothership/chat/stop/route.test.ts
index 806741d9f82..55c50d7cd43 100644
--- a/apps/sim/app/api/copilot/chat/stop/route.test.ts
+++ b/apps/sim/app/api/mothership/chat/stop/route.test.ts
@@ -32,7 +32,7 @@ vi.mock('@/lib/mothership/chat/messages-store', () => mothershipChatMessagesMock
vi.mock('@/lib/mothership/chat-status', () => mothershipChatStatusMock)
import { getLatestRunForStream } from '@/lib/mothership/async-runs/repository'
-import { POST } from '@/app/api/copilot/chat/stop/route'
+import { POST } from '@/app/api/mothership/chat/stop/route'
const mockGetAccessibleChat = mothershipChatLifecycleMockFns.mockGetAccessibleCopilotChatAuth
const mockAppendCopilotChatMessages = mothershipChatMessagesMockFns.mockAppendCopilotChatMessages
@@ -46,7 +46,7 @@ mothershipAsyncRunsMockFns.mockGetLatestRunForStream.mockResolvedValue({
const stopRequest = (request: NextRequest) => POST(request, undefined)
function createRequest(body: Record) {
- return new NextRequest('http://localhost:3000/api/copilot/chat/stop', {
+ return new NextRequest('http://localhost:3000/api/mothership/chat/stop', {
method: 'POST',
body: JSON.stringify(body),
headers: { 'Content-Type': 'application/json' },
@@ -66,7 +66,7 @@ function mockReads(opts: {
dbChainMockFns.limit.mockResolvedValueOnce(opts.last ? [opts.last] : [])
}
-describe('copilot chat stop route', () => {
+describe('mothership chat stop route', () => {
beforeEach(() => {
// Drain the once-queue (clearAllMocks/resetDbChainMock don't), then restore defaults.
dbChainMockFns.limit.mockReset()
diff --git a/apps/sim/app/api/mothership/chat/stop/route.ts b/apps/sim/app/api/mothership/chat/stop/route.ts
index 6b40e8093e1..8cfe51b65d1 100644
--- a/apps/sim/app/api/mothership/chat/stop/route.ts
+++ b/apps/sim/app/api/mothership/chat/stop/route.ts
@@ -1,12 +1,116 @@
-import type { NextRequest } from 'next/server'
-import { mothershipChatStopEnvelopeSchema } from '@/lib/api/contracts/mothership-chats'
+import { createLogger } from '@sim/logger'
+import { generateId } from '@sim/utils/id'
+import { type NextRequest, NextResponse } from 'next/server'
+import { mothershipChatStopContract } from '@/lib/api/contracts/mothership-chats'
+import { parseRequest } from '@/lib/api/server'
+import { getSession } from '@/lib/auth'
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
-import { validateShimEnvelope } from '@/lib/mothership/request/http'
-import { POST as copilotStopPost } from '@/app/api/copilot/chat/stop/route'
+import { getAccessibleCopilotChatAuth } from '@/lib/mothership/chat/lifecycle'
+import {
+ normalizeMessage,
+ type PersistedMessage,
+ withStoppedContentBlock,
+} from '@/lib/mothership/chat/persisted-message'
+import {
+ finalizeAssistantTurn,
+ readStoppedAssistantMessage,
+} from '@/lib/mothership/chat/terminal-state'
+import { publishChatStatusChanged } from '@/lib/mothership/chat-status'
+import {
+ CopilotChatFinalizeOutcome,
+ CopilotStopOutcome,
+} from '@/lib/mothership/generated/trace-attribute-values-v1'
+import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
+import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
+import { withIncomingGoSpan } from '@/lib/mothership/request/otel'
-export const POST = withRouteHandler(async (request: NextRequest) => {
- const invalid = await validateShimEnvelope(request, mothershipChatStopEnvelopeSchema)
- if (invalid) return invalid
+const logger = createLogger('CopilotChatStopAPI')
- return copilotStopPost(request, undefined)
-})
+/**
+ * Persists partial assistant content when the user stops mid-stream. Lock release is handled by
+ * the aborted server stream unwinding, not this handler.
+ */
+export const POST = withRouteHandler((req: NextRequest) =>
+ withIncomingGoSpan(req.headers, TraceSpan.CopilotChatStopStream, undefined, async (span) => {
+ try {
+ const session = await getSession()
+ if (!session?.user?.id) {
+ span.setAttribute(TraceAttr.CopilotStopOutcome, CopilotStopOutcome.Unauthorized)
+ return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
+ }
+
+ const parsed = await parseRequest(mothershipChatStopContract, req, {})
+ if (!parsed.success) {
+ span.setAttribute(TraceAttr.CopilotStopOutcome, CopilotStopOutcome.ValidationError)
+ return parsed.response
+ }
+ const { chatId, streamId, content, contentBlocks, requestId } = parsed.data.body
+ const chat = await getAccessibleCopilotChatAuth(chatId, session.user.id, {
+ principal: { kind: 'session', userId: session.user.id, sessionId: session.session.id },
+ })
+ if (!chat) return NextResponse.json({ success: true })
+ span.setAttributes({
+ [TraceAttr.ChatId]: chatId,
+ [TraceAttr.StreamId]: streamId,
+ [TraceAttr.UserId]: session.user.id,
+ [TraceAttr.CopilotStopContentLength]: content.length,
+ [TraceAttr.CopilotStopBlocksCount]: contentBlocks?.length ?? 0,
+ ...(requestId ? { [TraceAttr.RequestId]: requestId } : {}),
+ })
+
+ const hasContent = content.trim().length > 0
+ const hasBlocks = Array.isArray(contentBlocks) && contentBlocks.length > 0
+ const assistantBlocks = hasBlocks
+ ? contentBlocks
+ : hasContent
+ ? [{ type: 'text', channel: 'assistant', content }]
+ : []
+ const assistantMessage: PersistedMessage | null =
+ hasContent || hasBlocks
+ ? withStoppedContentBlock(
+ normalizeMessage({
+ id: generateId(),
+ role: 'assistant',
+ content,
+ timestamp: new Date().toISOString(),
+ contentBlocks: assistantBlocks,
+ ...(requestId ? { requestId } : {}),
+ })
+ )
+ : await readStoppedAssistantMessage(streamId, chatId, session.user.id)
+ /** The run owner retains the full response if replay was trimmed or has not started. */
+ if (!assistantMessage) return NextResponse.json({ success: true })
+ const result = await finalizeAssistantTurn({
+ chatId,
+ userId: session.user.id,
+ userMessageId: streamId,
+ assistantMessage,
+ streamMarkerPolicy: 'active-or-cleared',
+ preferServerReplay: hasContent || hasBlocks,
+ })
+ span.setAttribute(TraceAttr.CopilotStopAppendedAssistant, result.appendedAssistant)
+ const stopOutcome = !result.found
+ ? CopilotStopOutcome.ChatNotFound
+ : result.updated || result.outcome === CopilotChatFinalizeOutcome.AssistantAlreadyPersisted
+ ? CopilotStopOutcome.Persisted
+ : CopilotStopOutcome.NoMatchingRow
+ const shouldPublishCompleted =
+ result.updated || result.outcome === CopilotChatFinalizeOutcome.AssistantAlreadyPersisted
+
+ if (shouldPublishCompleted) {
+ publishChatStatusChanged(chat, {
+ chatId,
+ type: 'completed',
+ streamId,
+ })
+ }
+
+ span.setAttribute(TraceAttr.CopilotStopOutcome, stopOutcome)
+ return NextResponse.json({ success: true })
+ } catch (error) {
+ logger.error('Error stopping chat stream:', error)
+ span.setAttribute(TraceAttr.CopilotStopOutcome, CopilotStopOutcome.InternalError)
+ return NextResponse.json({ error: 'Internal server error' }, { status: 500 })
+ }
+ })
+)
diff --git a/apps/sim/app/api/copilot/chat/stream/desktop-executor.integration.ts b/apps/sim/app/api/mothership/chat/stream/desktop-executor.integration.ts
similarity index 95%
rename from apps/sim/app/api/copilot/chat/stream/desktop-executor.integration.ts
rename to apps/sim/app/api/mothership/chat/stream/desktop-executor.integration.ts
index b58def23553..337dca557c7 100644
--- a/apps/sim/app/api/copilot/chat/stream/desktop-executor.integration.ts
+++ b/apps/sim/app/api/mothership/chat/stream/desktop-executor.integration.ts
@@ -31,7 +31,7 @@ import { eq } from 'drizzle-orm'
import { NextRequest } from 'next/server'
import { closeRedisConnection } from '@/lib/core/config/redis'
import { MOTHERSHIP_DESKTOP_EXECUTOR_HEADER } from '@/lib/mothership/constants'
-import { GET as streamGET } from '@/app/api/copilot/chat/stream/route'
+import { GET as streamGET } from '@/app/api/mothership/chat/stream/route'
const userId = generateId()
const workspaceId = generateId()
@@ -56,7 +56,7 @@ async function finishedRun(desktopDeviceId: string | null): Promise {
function reconnect(streamId: string, batch: boolean) {
return streamGET(
new NextRequest(
- `http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=0${batch ? '&batch=true' : ''}`
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=0${batch ? '&batch=true' : ''}`
),
{ params: Promise.resolve({}) }
)
diff --git a/apps/sim/app/api/copilot/chat/stream/route.test.ts b/apps/sim/app/api/mothership/chat/stream/route.test.ts
similarity index 88%
rename from apps/sim/app/api/copilot/chat/stream/route.test.ts
rename to apps/sim/app/api/mothership/chat/stream/route.test.ts
index 06f25004aa4..969b82368da 100644
--- a/apps/sim/app/api/copilot/chat/stream/route.test.ts
+++ b/apps/sim/app/api/mothership/chat/stream/route.test.ts
@@ -52,17 +52,17 @@ vi.mock('@/lib/mothership/request/session', () => ({
},
}))
-import { GET as routeGET } from './route'
+import { GET as routeGET } from '@/app/api/mothership/chat/stream/route'
const GET = (request: NextRequest) => routeGET(request, { params: Promise.resolve({}) })
async function readAllChunks(response: Response): Promise {
const reader = response.body?.getReader()
- expect(reader).toBeTruthy()
+ if (!reader) throw new Error('Expected a streaming response body')
const chunks: string[] = []
while (true) {
- const { done, value } = await reader!.read()
+ const { done, value } = await reader.read()
if (done) {
break
}
@@ -71,7 +71,7 @@ async function readAllChunks(response: Response): Promise {
return chunks
}
-describe('copilot chat stream replay route', () => {
+describe('mothership chat stream replay route', () => {
afterEach(() => {
vi.useRealTimers()
})
@@ -91,7 +91,9 @@ describe('copilot chat stream replay route', () => {
new OrchestrationError('not_found', 'Chat not found')
)
const response = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&batch=true')
+ new NextRequest(
+ 'http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&batch=true'
+ )
)
expect(response.status).toBe(404)
expect(readEvents).not.toHaveBeenCalled()
@@ -120,7 +122,7 @@ describe('copilot chat stream replay route', () => {
const response = await GET(
new NextRequest(
- 'http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0&batch=true'
+ 'http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0&batch=true'
)
)
@@ -160,14 +162,18 @@ describe('copilot chat stream replay route', () => {
})
const response = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
+ new NextRequest(
+ 'http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0'
+ )
)
const chunks = await readAllChunks(response)
if (elapsedMs >= 3_600_000) {
expect(chunks.join('')).not.toContain('"type":"complete"')
const reattached = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
+ new NextRequest(
+ 'http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0'
+ )
)
chunks.push(...(await readAllChunks(reattached)))
}
@@ -193,7 +199,7 @@ describe('copilot chat stream replay route', () => {
.mockResolvedValueOnce(null)
const response = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
+ new NextRequest('http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0')
)
const chunks = await readAllChunks(response)
@@ -216,7 +222,7 @@ describe('copilot chat stream replay route', () => {
})
const response = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=7')
+ new NextRequest('http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=7')
)
const body = readAllChunks(response)
await vi.advanceTimersByTimeAsync(61 * 60 * 1000)
@@ -251,7 +257,7 @@ describe('copilot chat stream replay route', () => {
])
const response = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
+ new NextRequest('http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0')
)
const text = (await readAllChunks(response)).join('')
@@ -277,7 +283,7 @@ describe('copilot chat stream replay route', () => {
const response = await GET(
new NextRequest(
- 'http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0&batch=true'
+ 'http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0&batch=true'
)
)
@@ -302,7 +308,7 @@ describe('copilot chat stream replay route', () => {
.mockResolvedValue([event(5, 'past a trimmed gap')])
const response = await GET(
- new NextRequest('http://localhost:3000/api/copilot/chat/stream?streamId=stream-1&after=0')
+ new NextRequest('http://localhost:3000/api/mothership/chat/stream?streamId=stream-1&after=0')
)
const text = (await readAllChunks(response)).join('')
diff --git a/apps/sim/app/api/mothership/chat/stream/route.ts b/apps/sim/app/api/mothership/chat/stream/route.ts
index 65233f6cebc..15b35846352 100644
--- a/apps/sim/app/api/mothership/chat/stream/route.ts
+++ b/apps/sim/app/api/mothership/chat/stream/route.ts
@@ -1,13 +1,626 @@
-import type { NextRequest } from 'next/server'
-import { mothershipChatStreamQuerySchema } from '@/lib/api/contracts/mothership-chats'
-import { validationErrorResponse } from '@/lib/api/server'
-import { GET as copilotStreamGet } from '@/app/api/copilot/chat/stream/route'
-
-export function GET(request: NextRequest) {
- const validation = mothershipChatStreamQuerySchema.safeParse(
- Object.fromEntries(request.nextUrl.searchParams.entries())
+import { type Context, context as otelContext, type Span, trace } from '@opentelemetry/api'
+import type { SessionPrincipal } from '@sim/auth/principal'
+import { createLogger } from '@sim/logger'
+import { getErrorMessage } from '@sim/utils/errors'
+import { sleep } from '@sim/utils/helpers'
+import { type NextRequest, NextResponse } from 'next/server'
+import { mothershipChatStreamContract } from '@/lib/api/contracts/mothership-chats'
+import { parseRequest } from '@/lib/api/server'
+import {
+ InternalUnauthenticatedError,
+ internalErrorResponse,
+ internalOrchestrationErrorPolicy,
+ internalSessionAuth,
+} from '@/lib/api/server/routes'
+import { encodeSSEComment } from '@/lib/core/utils/sse'
+import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
+import {
+ MOTHERSHIP_DESKTOP_EXECUTOR_HEADER,
+ MOTHERSHIP_STREAM_REPLAY_HEADER,
+} from '@/lib/mothership/constants'
+import {
+ MothershipStreamV1CompletionStatus,
+ MothershipStreamV1EventType,
+} from '@/lib/mothership/generated/mothership-stream-v1'
+import {
+ CopilotResumeOutcome,
+ CopilotTransport,
+} from '@/lib/mothership/generated/trace-attribute-values-v1'
+import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
+import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
+import { readChatStream } from '@/lib/mothership/request/application/recover-stream'
+import { contextFromRequestHeaders } from '@/lib/mothership/request/go/propagation'
+import { getCopilotTracer, markSpanForError } from '@/lib/mothership/request/otel'
+import {
+ createEvent,
+ encodeSSEEnvelope,
+ findReplayGap,
+ forwardRunReplay,
+ holdStreamViewer,
+ isTerminalStreamStatus,
+ openRunReplay,
+ RunReplayUnavailableError,
+ readEvents,
+ readFilePreviewSessions,
+ readRingPosition,
+ replayGapTerminal,
+ ringCanServe,
+ SSE_RESPONSE_HEADERS,
+} from '@/lib/mothership/request/session'
+import { toReplayEnvelope, toStreamBatchEvent } from '@/lib/mothership/request/session/types'
+
+export const maxDuration = 3600
+
+const logger = createLogger('CopilotChatStreamAPI')
+const POLL_INTERVAL_MS = 250
+const POLL_INTERVAL_MAX_MS = 2_000
+const REPLAY_KEEPALIVE_INTERVAL_MS = 15_000
+/** How often a tail that is still flushing events checks that its ring can serve it. */
+const RING_CHECK_EVERY_BUSY_POLLS = 8
+/**
+ * One replay response stays open at most this long, inside the route's `maxDuration`.
+ * A run still going at the cap is not over: the response ends without a terminal
+ * event and the client re-attaches from its cursor.
+ */
+const MAX_STREAM_MS = 60 * 60 * 1000 - 60_000
+
+/**
+ * Whether ring events read after `cursor` start right after it. The ring can trim its
+ * head between a gap check and the read, and a read that starts later would silently
+ * skip part of the turn.
+ */
+function startsAfterCursor(events: readonly { seq: number }[], cursor: string): boolean {
+ return events.length === 0 || events[0].seq <= Number(cursor || '0') + 1
+}
+
+function extractCanonicalRequestId(value: unknown): string {
+ return typeof value === 'string' && value.length > 0 ? value : ''
+}
+
+function extractRunRequestId(run: { requestContext?: unknown } | null | undefined): string {
+ if (!run || typeof run.requestContext !== 'object' || run.requestContext === null) {
+ return ''
+ }
+ const requestContext = run.requestContext as Record
+ return (
+ extractCanonicalRequestId(requestContext.requestId) ||
+ extractCanonicalRequestId(requestContext.simRequestId)
)
- if (!validation.success) return validationErrorResponse(validation.error)
+}
+
+function extractEnvelopeRequestId(envelope: { trace?: { requestId?: unknown } }): string {
+ return extractCanonicalRequestId(envelope.trace?.requestId)
+}
+
+function buildResumeTerminalEnvelopes(options: {
+ streamId: string
+ afterCursor: string
+ status: MothershipStreamV1CompletionStatus
+ message?: string
+ code: string
+ reason?: string
+ requestId?: string
+}) {
+ const baseSeq = Number(options.afterCursor || '0')
+ const seq = Number.isFinite(baseSeq) ? baseSeq : 0
+ const envelopes: ReturnType[] = []
+ const rid = options.requestId ?? ''
+
+ if (options.status === MothershipStreamV1CompletionStatus.error) {
+ envelopes.push(
+ createEvent({
+ streamId: options.streamId,
+ cursor: String(seq + 1),
+ seq: seq + 1,
+ requestId: rid,
+ type: MothershipStreamV1EventType.error,
+ payload: {
+ message: options.message || 'Stream recovery failed before completion.',
+ code: options.code,
+ },
+ })
+ )
+ }
+
+ envelopes.push(
+ createEvent({
+ streamId: options.streamId,
+ cursor: String(seq + envelopes.length + 1),
+ seq: seq + envelopes.length + 1,
+ requestId: rid,
+ type: MothershipStreamV1EventType.complete,
+ payload: {
+ status: options.status,
+ ...(options.reason ? { reason: options.reason } : {}),
+ },
+ })
+ )
+
+ return envelopes
+}
+
+export const GET = withRouteHandler(async (request: NextRequest) => {
+ let principal: SessionPrincipal
+ try {
+ principal = await internalSessionAuth.authenticate()
+ } catch (error) {
+ if (error instanceof InternalUnauthenticatedError)
+ return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
+ throw error
+ }
+ const authenticatedUserId = principal.userId
+
+ const parsed = await parseRequest(mothershipChatStreamContract, request, {})
+ if (!parsed.success) return parsed.response
+ const { streamId, after: afterCursor, batch: batchMode, source } = parsed.data.query
+
+ if (!streamId) {
+ return NextResponse.json({ error: 'streamId is required' }, { status: 400 })
+ }
+
+ // Root span for the whole resume/reconnect request. In stream mode the
+ // work happens inside `ReadableStream.start`, which the Node runtime
+ // invokes after this function returns and OUTSIDE the AsyncLocalStorage
+ // scope installed by `startActiveSpan`. We therefore start the span
+ // manually, capture its context, and re-enter that context inside the
+ // stream callback so every nested `withCopilotSpan` / `withDbSpan` call
+ // attaches to this root.
+ //
+ // `contextFromRequestHeaders` extracts the W3C `traceparent` the
+ // client echoed (set via `streamTraceparentRef` on Sim's chat POST
+ // response), so the resume span becomes a child of the original
+ // chat's `gen_ai.agent.execute` trace instead of a disconnected
+ // new root. On reconnects after page reload (client ref was wiped)
+ // the header is absent and extraction leaves the ambient context
+ // alone → the resume span becomes its own root. Same as pre-
+ // linking behavior; no regression.
+ const incomingContext = contextFromRequestHeaders(request.headers)
+ const rootSpan = getCopilotTracer().startSpan(
+ TraceSpan.CopilotResumeRequest,
+ {
+ attributes: {
+ [TraceAttr.CopilotTransport]: batchMode ? CopilotTransport.Batch : CopilotTransport.Stream,
+ [TraceAttr.StreamId]: streamId,
+ [TraceAttr.UserId]: authenticatedUserId,
+ [TraceAttr.CopilotResumeAfterCursor]: afterCursor || '0',
+ },
+ },
+ incomingContext
+ )
+ const rootContext = trace.setSpan(incomingContext, rootSpan)
+
+ try {
+ return await otelContext.with(rootContext, () =>
+ handleResumeRequestBody({
+ request,
+ streamId,
+ afterCursor,
+ batchMode,
+ fromLog: source === 'log',
+ principal,
+ rootSpan,
+ rootContext,
+ })
+ )
+ } catch (err) {
+ markSpanForError(rootSpan, err)
+ rootSpan.end()
+ const errorResponse =
+ internalOrchestrationErrorPolicy.project(err) ??
+ internalOrchestrationErrorPolicy.unhandled?.() ??
+ internalErrorResponse(500, { error: 'Internal server error' })
+ return NextResponse.json(errorResponse.body, {
+ status: errorResponse.status,
+ headers: errorResponse.headers,
+ })
+ }
+})
+
+async function handleResumeRequestBody({
+ request,
+ streamId,
+ afterCursor,
+ batchMode,
+ fromLog,
+ principal,
+ rootSpan,
+ rootContext,
+}: {
+ request: NextRequest
+ streamId: string
+ afterCursor: string
+ batchMode: boolean
+ /** The reader's cursor came from a log re-sync, so the ring never serves it. */
+ fromLog: boolean
+ principal: SessionPrincipal
+ rootSpan: Span
+ rootContext: Context
+}) {
+ const readRun = () =>
+ readChatStream.execute({
+ principal,
+ input: { streamId },
+ })
+ const run = await readRun()
+ logger.info('[Resume] Stream lookup', {
+ streamId,
+ afterCursor,
+ batchMode,
+ hasRun: !!run,
+ runStatus: run?.status,
+ })
+ if (!run) {
+ rootSpan.setAttribute(TraceAttr.CopilotResumeOutcome, CopilotResumeOutcome.StreamNotFound)
+ rootSpan.end()
+ return NextResponse.json({ error: 'Stream not found' }, { status: 404 })
+ }
+ rootSpan.setAttribute(TraceAttr.CopilotRunStatus, run.status)
+
+ if (batchMode) {
+ const afterSeq = afterCursor || '0'
+ const [gap, events, previewSessions] = await Promise.all([
+ fromLog ? null : findReplayGap(streamId, afterSeq, extractRunRequestId(run)),
+ readEvents(streamId, afterSeq),
+ readFilePreviewSessions(streamId).catch((error) => {
+ logger.warn('Failed to read preview sessions for stream batch', {
+ streamId,
+ error: getErrorMessage(error),
+ })
+ return []
+ }),
+ ])
+ // A reader the ring cannot serve, or whose next event it trimmed after the gap check,
+ // is re-synced from the worker log by the live tail.
+ const batchEvents =
+ fromLog || gap || !startsAfterCursor(events, afterSeq) ? [] : events.map(toStreamBatchEvent)
+ logger.info('[Resume] Batch response', {
+ streamId,
+ afterCursor: afterSeq,
+ eventCount: batchEvents.length,
+ previewSessionCount: previewSessions.length,
+ runStatus: run.status,
+ })
+ rootSpan.setAttributes({
+ [TraceAttr.CopilotResumeOutcome]: CopilotResumeOutcome.BatchDelivered,
+ [TraceAttr.CopilotResumeEventCount]: batchEvents.length,
+ [TraceAttr.CopilotResumePreviewSessionCount]: previewSessions.length,
+ })
+ rootSpan.end()
+ return NextResponse.json({
+ success: true,
+ events: batchEvents,
+ previewSessions,
+ status: run.status,
+ ...(run.chatId ? { chatId: run.chatId } : {}),
+ ...(run.desktopDeviceId ? { desktopToolsOnDevice: true } : {}),
+ })
+ }
+
+ const startTime = Date.now()
+ let totalEventsFlushed = 0
+ let pollIterations = 0
+
+ /**
+ * A reader the ring cannot serve is re-synced from the worker's durable log for the
+ * rest of this response, never handed back to the ring: the log and the ring have
+ * no shared position to join on. The header tells the client to rebuild the turn
+ * from an empty response, since the replay's cursors restart at 1.
+ */
+ const ringGap = fromLog
+ ? null
+ : await findReplayGap(streamId, afterCursor || '0', extractRunRequestId(run))
+ // A finished run whose buffer expired answers its terminal; its transcript is persisted.
+ const gap =
+ ringGap && !(ringGap.latestSeq <= 0 && isTerminalStreamStatus(run.status)) ? ringGap : null
+ const resyncFromLog = fromLog || gap !== null
+ let replayBody: ReadableStream | null = null
+ /** Releases the worker's replay once this response ends; the request signal may never fire. */
+ const replayAbort = new AbortController()
+ const replaySignal = AbortSignal.any([request.signal, replayAbort.signal])
+ if (resyncFromLog && run.chatId) {
+ try {
+ replayBody = await openRunReplay({
+ streamId,
+ chatId: run.chatId,
+ userId: principal.userId,
+ signal: replaySignal,
+ })
+ } catch (error) {
+ if (!(error instanceof RunReplayUnavailableError)) throw error
+ logger.warn('Run replay unavailable; the client will retry', {
+ streamId,
+ error: getErrorMessage(error),
+ })
+ markSpanForError(rootSpan, error)
+ rootSpan.end()
+ return NextResponse.json({ error: 'Stream replay is unavailable' }, { status: 503 })
+ }
+ }
+
+ const stream = new ReadableStream({
+ async start(controller) {
+ // Re-enter the root OTel context so any `withCopilotSpan` call below
+ // (inside flushEvents/replayGapTerminal/etc.) parents under
+ // copilot.resume.request instead of becoming an orphan.
+ return otelContext.with(rootContext, () => startInner(controller))
+ },
+ })
+
+ async function startInner(controller: ReadableStreamDefaultController) {
+ let cursor = afterCursor || '0'
+ let controllerClosed = false
+ let sawTerminalEvent = false
+ let currentRequestId = extractRunRequestId(run)
+ let lastWriteTime = Date.now()
+ // Stamp the logical request id + chat id on the resume root as soon
+ // as we resolve them from the run row, so TraceQL joins work on
+ // resume legs the same way they do on the original POST.
+ if (currentRequestId) {
+ rootSpan.setAttribute(TraceAttr.RequestId, currentRequestId)
+ rootSpan.setAttribute(TraceAttr.SimRequestId, currentRequestId)
+ }
+ if (run?.chatId) {
+ rootSpan.setAttribute(TraceAttr.ChatId, run.chatId)
+ }
+
+ const closeController = () => {
+ if (controllerClosed) return
+ controllerClosed = true
+ try {
+ controller.close()
+ } catch {
+ // Controller already closed by runtime/client
+ }
+ }
+
+ const enqueueEvent = (payload: unknown) => {
+ if (controllerClosed) return false
+ try {
+ controller.enqueue(encodeSSEEnvelope(payload))
+ lastWriteTime = Date.now()
+ return true
+ } catch {
+ controllerClosed = true
+ return false
+ }
+ }
+
+ const enqueueComment = (comment: string) => {
+ if (controllerClosed) return false
+ try {
+ controller.enqueue(encodeSSEComment(comment))
+ lastWriteTime = Date.now()
+ return true
+ } catch {
+ controllerClosed = true
+ return false
+ }
+ }
+
+ const abortListener = () => {
+ controllerClosed = true
+ }
+ request.signal.addEventListener('abort', abortListener, { once: true })
+ // An attached reader is a chat view that starts this turn's workflow tools.
+ const releaseViewer = await holdStreamViewer(streamId)
+
+ /** Delivers the ring's events after the cursor, or returns null if it trimmed the next one. */
+ const flushEvents = async (): Promise => {
+ const events = await readEvents(streamId, cursor)
+ if (!startsAfterCursor(events, cursor)) {
+ logger.warn('Replay ring trimmed past a reader cursor', { streamId, cursor })
+ return null
+ }
+ if (events.length > 0) {
+ logger.debug('[Resume] Flushing events', {
+ streamId,
+ afterCursor: cursor,
+ eventCount: events.length,
+ })
+ }
+ for (const envelope of events) {
+ if (!enqueueEvent(toReplayEnvelope(envelope))) {
+ break
+ }
+ totalEventsFlushed += 1
+ cursor = envelope.stream.cursor ?? String(envelope.seq)
+ currentRequestId = extractEnvelopeRequestId(envelope) || currentRequestId
+ if (envelope.type === MothershipStreamV1EventType.complete) {
+ sawTerminalEvent = true
+ }
+ }
+ return events.length
+ }
+
+ const emitTerminalIfMissing = (
+ status: MothershipStreamV1CompletionStatus,
+ options?: { message?: string; code: string; reason?: string }
+ ) => {
+ if (controllerClosed || sawTerminalEvent) {
+ return
+ }
+ for (const envelope of buildResumeTerminalEnvelopes({
+ streamId,
+ afterCursor: cursor,
+ status,
+ message: options?.message,
+ code: options?.code ?? 'resume_terminal',
+ reason: options?.reason,
+ requestId: currentRequestId,
+ })) {
+ if (!enqueueEvent(envelope)) {
+ break
+ }
+ cursor = envelope.stream.cursor ?? String(envelope.seq)
+ if (envelope.type === MothershipStreamV1EventType.complete) {
+ sawTerminalEvent = true
+ }
+ }
+ }
+
+ /** Forwards the worker's replay, keeping the response alive while it waits. */
+ const streamRunReplay = async (body: ReadableStream) => {
+ const keepalive = setInterval(() => {
+ if (Date.now() - lastWriteTime < REPLAY_KEEPALIVE_INTERVAL_MS) return
+ if (!enqueueComment('keepalive')) replayAbort.abort()
+ }, REPLAY_KEEPALIVE_INTERVAL_MS)
+ try {
+ const end = await forwardRunReplay({
+ body,
+ streamId,
+ signal: replaySignal,
+ write: (envelope) => {
+ if (!enqueueEvent(envelope)) return false
+ totalEventsFlushed += 1
+ cursor = envelope.stream.cursor ?? cursor
+ if (envelope.type === MothershipStreamV1EventType.complete) sawTerminalEvent = true
+ return true
+ },
+ readRunStatus: async () => (await readRun().catch(() => null))?.status ?? null,
+ isClosed: () => controllerClosed,
+ deadlineAt: startTime + MAX_STREAM_MS,
+ })
+ logger.info('[Resume] Run replay ended', { streamId, end, eventCount: totalEventsFlushed })
+ } finally {
+ clearInterval(keepalive)
+ replayAbort.abort()
+ }
+ }
+
+ try {
+ enqueueComment('accepted')
+
+ if (replayBody) {
+ await streamRunReplay(replayBody)
+ return
+ }
+ if (resyncFromLog) {
+ const position = gap ?? (await readRingPosition(streamId, cursor))
+ const terminal = await replayGapTerminal(streamId, position, currentRequestId)
+ for (const envelope of terminal.envelopes) {
+ if (!enqueueEvent(envelope)) {
+ break
+ }
+ cursor = envelope.stream.cursor ?? String(envelope.seq)
+ currentRequestId = extractEnvelopeRequestId(envelope) || currentRequestId
+ if (envelope.type === MothershipStreamV1EventType.complete) {
+ sawTerminalEvent = true
+ }
+ }
+ return
+ }
+
+ let lastFlushed = await flushEvents()
+ if (lastFlushed === null) return
+
+ let pollDelayMs = POLL_INTERVAL_MS
+ while (!controllerClosed && Date.now() - startTime < MAX_STREAM_MS) {
+ pollIterations += 1
+ const currentRun = await readRun().catch((err) => {
+ logger.warn('Failed to poll latest run for stream', {
+ streamId,
+ error: getErrorMessage(err),
+ })
+ return null
+ })
+ if (!currentRun) {
+ emitTerminalIfMissing(MothershipStreamV1CompletionStatus.error, {
+ message: 'The stream could not be recovered because its run metadata is unavailable.',
+ code: 'resume_run_unavailable',
+ reason: 'run_unavailable',
+ })
+ break
+ }
+ // The ring lost its head, restarted or expired under this live tail; the re-attach
+ // re-syncs, and a finished run answers its terminal instead. Only a quiet ring can
+ // restart or be re-sent into by a recovery, so a busy tail checks every few polls.
+ const checkRing = lastFlushed === 0 || pollIterations % RING_CHECK_EVERY_BUSY_POLLS === 0
+ if (
+ checkRing &&
+ !isTerminalStreamStatus(currentRun.status) &&
+ !ringCanServe(await readRingPosition(streamId, cursor))
+ ) {
+ logger.warn('Replay ring can no longer serve a live tail', { streamId, cursor })
+ break
+ }
+
+ currentRequestId = extractRunRequestId(currentRun) || currentRequestId
+
+ const flushed = await flushEvents()
+ if (flushed === null) break
+ lastFlushed = flushed
+ /* Adaptive tail: 4 Hz only while events are actually flowing; a quiet stream
+ decays toward the cap so an attached client doesn't hammer Postgres + Redis
+ at 4 Hz for up to an hour. Any flushed event snaps back to full rate. */
+ pollDelayMs =
+ flushed > 0 ? POLL_INTERVAL_MS : Math.min(pollDelayMs * 2, POLL_INTERVAL_MAX_MS)
+
+ if (controllerClosed) {
+ break
+ }
+ if (isTerminalStreamStatus(currentRun.status)) {
+ emitTerminalIfMissing(currentRun.status, {
+ message:
+ currentRun.status === MothershipStreamV1CompletionStatus.error
+ ? typeof currentRun.error === 'string'
+ ? currentRun.error
+ : 'The recovered stream ended with an error.'
+ : undefined,
+ code: 'resume_terminal_status',
+ reason: 'terminal_status',
+ })
+ break
+ }
+
+ if (request.signal.aborted) {
+ controllerClosed = true
+ break
+ }
+
+ if (Date.now() - lastWriteTime >= REPLAY_KEEPALIVE_INTERVAL_MS) {
+ enqueueComment('keepalive')
+ }
+
+ await sleep(pollDelayMs)
+ }
+ } catch (error) {
+ if (!controllerClosed && !request.signal.aborted) {
+ logger.warn('Stream replay failed', {
+ streamId,
+ error: getErrorMessage(error),
+ })
+ emitTerminalIfMissing(MothershipStreamV1CompletionStatus.error, {
+ message: 'The stream replay failed before completion.',
+ code: 'resume_internal',
+ reason: 'stream_replay_failed',
+ })
+ }
+ markSpanForError(rootSpan, error)
+ } finally {
+ releaseViewer()
+ request.signal.removeEventListener('abort', abortListener)
+ // Read before closing: closing the controller here is this route ending, not the client.
+ const clientDisconnected = controllerClosed
+ closeController()
+ rootSpan.setAttributes({
+ [TraceAttr.CopilotResumeOutcome]: sawTerminalEvent
+ ? CopilotResumeOutcome.TerminalDelivered
+ : clientDisconnected
+ ? CopilotResumeOutcome.ClientDisconnected
+ : CopilotResumeOutcome.EndedWithoutTerminal,
+ [TraceAttr.CopilotResumeEventCount]: totalEventsFlushed,
+ [TraceAttr.CopilotResumePollIterations]: pollIterations,
+ [TraceAttr.CopilotResumeDurationMs]: Date.now() - startTime,
+ })
+ rootSpan.end()
+ }
+ }
- return copilotStreamGet(request, undefined)
+ return new Response(stream, {
+ headers: {
+ ...SSE_RESPONSE_HEADERS,
+ ...(replayBody ? { [MOTHERSHIP_STREAM_REPLAY_HEADER]: 'log' } : {}),
+ ...(run.desktopDeviceId ? { [MOTHERSHIP_DESKTOP_EXECUTOR_HEADER]: 'device' } : {}),
+ },
+ })
}
diff --git a/apps/sim/app/api/v1/copilot/chat/route.ts b/apps/sim/app/api/v1/copilot/chat/route.ts
deleted file mode 100644
index 970cbab2a81..00000000000
--- a/apps/sim/app/api/v1/copilot/chat/route.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { NextResponse } from 'next/server'
-import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
-
-/**
- * POST /api/v1/copilot/chat
- *
- * Deprecated: the v1 headless copilot chat API has been removed. The endpoint
- * returns 410 Gone for all callers.
- *
- * permission-group-exempt: none — the route authenticates nobody and reaches no
- * resource, so there is no workspace in which to resolve a group. The
- * counterpart `chat.send` declares `copilot.use`; when this surface returns
- * anything but 410 again, it declares that capability.
- */
-export const POST = withRouteHandler(async () =>
- NextResponse.json(
- {
- success: false,
- error: 'The v1 copilot chat API has been deprecated and is no longer available.',
- },
- { status: 410, headers: { 'Cache-Control': 'no-store' } }
- )
-)
diff --git a/apps/sim/app/playground/page.tsx b/apps/sim/app/playground/page.tsx
deleted file mode 100644
index fa5a295eacd..00000000000
--- a/apps/sim/app/playground/page.tsx
+++ /dev/null
@@ -1,1079 +0,0 @@
-'use client'
-
-import { useState, useSyncExternalStore } from 'react'
-import {
- Avatar,
- AvatarFallback,
- AvatarImage,
- Badge,
- BubbleChatClose,
- BubbleChatPreview,
- Button,
- Checkbox,
- ChevronDown,
- ChipButtonGroup,
- ChipButtonGroupItem,
- ChipDatePicker,
- Code,
- Combobox,
- Connections,
- Cursor,
- DocumentAttachment,
- Download,
- Duplicate,
- Expand,
- Eye,
- FolderCode,
- FolderPlus,
- Hand,
- HexSimple,
- Input,
- Key as KeyIcon,
- Label,
- Layout,
- Library,
- Loader,
- Modal,
- ModalBody,
- ModalContent,
- ModalDescription,
- ModalFooter,
- ModalHeader,
- ModalTabs,
- ModalTabsContent,
- ModalTabsList,
- ModalTabsTrigger,
- ModalTrigger,
- MoreHorizontal,
- NoWrap,
- PanelLeft,
- Play,
- PlayOutline,
- Popover,
- PopoverBackButton,
- PopoverContent,
- PopoverFolder,
- PopoverItem,
- PopoverScrollArea,
- PopoverSearch,
- PopoverSection,
- PopoverTrigger,
- Redo,
- Rocket,
- Slider,
- Switch,
- Table,
- TableBody,
- TableCaption,
- TableCell,
- TableFooter,
- TableHead,
- TableHeader,
- TableRow,
- TagInput,
- type TagItem,
- Textarea,
- TimePicker,
- Tooltip,
- Trash,
- toast,
- Undo,
- Wrap,
- ZoomIn,
- ZoomOut,
-} from '@sim/emcn'
-import { ArrowLeft, Folder, Moon, Sun } from '@sim/emcn/icons'
-import { notFound, useRouter } from 'next/navigation'
-import { env, isTruthy } from '@/lib/core/config/env'
-
-function Section({ title, children }: { title: string; children: React.ReactNode }) {
- return (
-
-
- {title}
-
- {children}
-
- )
-}
-
-function VariantRow({ label, children }: { label: string; children: React.ReactNode }) {
- return (
-
- )
-}
-
-const SAMPLE_CODE = `function greet(name) {
- console.log("Hello, " + name);
- return { success: true };
-}`
-
-const SAMPLE_PYTHON = `def greet(name):
- print(f"Hello, {name}")
- return {"success": True}`
-
-const COMBOBOX_OPTIONS = [
- { label: 'Option 1', value: 'opt1' },
- { label: 'Option 2', value: 'opt2' },
- { label: 'Option 3', value: 'opt3' },
-]
-
-const DARK_MODE_EVENT = 'playground:dark-mode-change'
-
-const subscribeToDarkMode = (onStoreChange: () => void) => {
- window.addEventListener(DARK_MODE_EVENT, onStoreChange)
- return () => window.removeEventListener(DARK_MODE_EVENT, onStoreChange)
-}
-
-const getDarkModeSnapshot = () => document.documentElement.classList.contains('dark')
-const getServerDarkModeSnapshot = () => false
-
-export default function PlaygroundPage() {
- const router = useRouter()
- const [comboboxValue, setComboboxValue] = useState('')
- const [switchValue, setSwitchValue] = useState(false)
- const [checkboxValue, setCheckboxValue] = useState(false)
- const [sliderValue, setSliderValue] = useState([50])
- const [timeValue, setTimeValue] = useState('09:30')
- const isDarkMode = useSyncExternalStore(
- subscribeToDarkMode,
- getDarkModeSnapshot,
- getServerDarkModeSnapshot
- )
- const [buttonGroupValue, setButtonGroupValue] = useState('curl')
- const [dateValue, setDateValue] = useState('')
- const [dateRangeStart, setDateRangeStart] = useState('')
- const [dateRangeEnd, setDateRangeEnd] = useState('')
- const [tagItems, setTagItems] = useState([
- { value: 'user@example.com', isValid: true },
- { value: 'invalid-email', isValid: false, error: 'Invalid email format' },
- ])
-
- const toggleDarkMode = () => {
- document.documentElement.classList.toggle('dark')
- window.dispatchEvent(new Event(DARK_MODE_EVENT))
- }
-
- if (!isTruthy(env.NEXT_PUBLIC_ENABLE_PLAYGROUND)) {
- notFound()
- }
-
- return (
- <>
-
-
-
-
-
- router.back()}
- className='size-8 p-0'
- >
-
-
-
- Go back
-
-
-
-
-
-
- {isDarkMode ? : }
-
-
- {isDarkMode ? 'Light mode' : 'Dark mode'}
-
-
-
-
-
EMCN Component Playground
-
- All emcn UI components and their variants
-
-
-
- {/* Toast */}
-
-
- toast({ message: 'Workflow saved' })}>
- Show
-
-
-
- toast.info('Sync in progress')}>
- Show
-
-
-
- toast.success('Imported 1,240 rows')}>
- Show
-
-
-
-
- toast.warning('Usage nearing limit', {
- description: '$4.20 used of $5.00 limit.',
- })
- }
- >
- Show
-
-
-
-
- toast.error('Jira 1: Read Issue failed', {
- description: 'Domain and account are required.',
- })
- }
- >
- Show
-
-
-
-
- toast.error('Workflow Validation', {
- description:
- 'Usage limit exceeded: $0.00 used of $5.00 limit. Please upgrade your plan to continue running this workflow.',
- action: { label: 'Fix in Chat', onClick: () => {} },
- })
- }
- >
- Show
-
-
-
-
- toast.success('Deployed v3', {
- action: { label: 'View deployment', onClick: () => {} },
- })
- }
- >
- Show
-
-
-
- {
- toast.info('First notification')
- toast.warning('Second notification')
- toast.error('Third notification')
- }}
- >
- Show 3
-
- toast.dismissAll()}>
- Dismiss all
-
-
-
-
- {/* Button */}
-
-
- Default
-
-
- Active
-
-
- 3D
-
-
- Outline
-
-
- Primary
-
-
- Destructive
-
-
- Secondary
-
-
- Tertiary
-
-
- Ghost
-
-
- Ghost Secondary
-
-
- Disabled
-
-
- Small
-
- Small Primary
-
-
-
- Medium
-
- Medium Primary
-
-
-
-
-
-
-
- cURL
- Python
- JavaScript
-
-
-
-
- Option 1
- Option 2
-
-
-
-
- Option 1
- Option 2
-
-
-
-
- Option 1
- Option 2
-
-
-
-
- Only Option
-
-
-
-
- {/* Badge */}
-
-
- Default
-
-
- Outline
-
-
- Type
-
-
- Green
-
- With Dot
-
-
-
- Red
-
- With Dot
-
-
-
- Blue
-
- With Dot
-
-
-
- Blue Secondary
-
-
- Purple
-
-
- Orange
-
-
- Amber
-
-
- Teal
-
-
- Cyan
-
-
- Gray
-
-
- Gray Secondary
-
-
- Small
- Medium
- Large
-
-
-
- {/* Input */}
-
-
- {/* TagInput */}
-
-
-
- {
- const isValid = value.includes('@') && value.includes('.')
- setTagItems((prev) => [...prev, { value, isValid }])
- return isValid
- }}
- onRemove={(_, index) => {
- setTagItems((prev) => prev.filter((_, i) => i !== index))
- }}
- placeholder='Enter emails...'
- placeholderWithTags='Add another'
- />
-
-
-
-
- true}
- onRemove={() => {}}
- placeholder='Add tags'
- placeholderWithTags='Add another'
- triggerKeys={['Enter', ',']}
- />
-
-
-
-
- false}
- onRemove={() => {}}
- placeholder='Disabled input'
- disabled
- />
-
-
-
-
- {/* Textarea */}
-
-
- {/* Label */}
-
-
- {/* Switch */}
-
-
-
-
- {switchValue ? 'On' : 'Off'}
-
-
-
-
- {/* Checkbox */}
-
-
- setCheckboxValue(!!c)} />
-
- {checkboxValue ? 'Checked' : 'Unchecked'}
-
-
-
-
- Small (14px)
-
-
-
- Medium (16px)
-
-
-
- Large (20px)
-
-
-
-
-
-
-
- {/* Slider */}
-
-
-
-
-
- {sliderValue[0]}
-
-
-
-
-
-
-
-
- {/* Avatar */}
-
-
-
- XS
-
-
- SM
-
-
- MD
-
-
- LG
-
-
-
-
-
- CN
-
-
-
-
- JD
-
-
-
-
- JD
-
-
-
-
- JD
-
-
-
-
- JD
-
-
-
-
- XS
-
-
- SM
-
-
- MD
-
-
- LG
-
-
-
-
- {/* Table */}
-
-
-
-
-
- Name
- Status
- Role
-
-
-
-
- Alice
- Active
- Admin
-
-
- Bob
- Pending
- User
-
-
- Charlie
- Active
- User
-
-
-
-
-
-
-
-
- Item
- Price
-
-
-
-
- Product A
- $10.00
-
-
- Product B
- $20.00
-
-
-
-
- Total
- $30.00
-
-
-
-
-
-
- A list of team members
-
-
- Name
- Department
-
-
-
-
- Alice
- Engineering
-
-
- Bob
- Design
-
-
-
-
-
-
- {/* Combobox */}
-
-
-
-
-
-
-
-
- {}}
- placeholder='Small size'
- size='sm'
- />
-
-
-
-
- {}}
- placeholder='With search'
- searchable
- />
-
-
-
-
- {}}
- placeholder='Type or select...'
- editable
- />
-
-
-
-
- {}}
- placeholder='Select multiple...'
- multiSelect
- searchable
- />
-
-
-
-
- {/* TimePicker */}
-
-
-
-
-
- {timeValue}
-
-
-
- {}}
- placeholder='Small size'
- size='sm'
- />
-
-
-
-
- {}} />
-
-
-
-
-
-
-
-
-
- {/* ChipDatePicker */}
-
-
-
-
-
-
- {dateValue || 'No date'}
-
-
-
-
- {
- setDateRangeStart(start)
- setDateRangeEnd(end)
- }}
- placeholder='Select date range'
- fullWidth
- />
-
-
-
-
- {
- setDateRangeStart(start)
- setDateRangeEnd(end)
- }}
- placeholder='Select date range'
- fullWidth
- />
-
-
-
-
-
-
-
-
-
- {/* Tooltip */}
-
-
-
-
- Hover me
-
- Tooltip content
-
-
-
-
-
- Clear console
-
-
- Clear console
-
-
-
-
-
-
- Save
-
-
-
-
-
-
-
-
- {/* Popover */}
-
-
-
-
- Open Popover
-
-
- Section Title
- Item 1
- Item 2
- Active Item
-
-
-
-
-
-
- Inverted Popover
-
-
- Item 1
- Active Item
-
-
-
-
-
-
- Searchable Popover
-
-
-
-
- Apple
- Banana
- Cherry
- Date
- Elderberry
-
-
-
-
-
-
-
- Folder Navigation
-
-
-
- Root Item
- }
- >
- Nested Item 1
- Nested Item 2
-
- }
- >
- Another Nested Item
-
-
-
-
-
-
- {/* Modal */}
-
-
- {(['sm', 'md', 'lg', 'xl', 'full'] as const).map((size) => (
-
-
- {size}
-
-
- Modal {size.toUpperCase()}
-
-
- This is a {size} sized modal.
-
-
-
- Cancel
- Save
-
-
-
- ))}
-
-
-
-
- Modal with Tabs
-
-
- Settings
-
-
- General
- Advanced
-
-
-
- Modal settings with general and advanced tabs
-
-
- General settings content
-
-
- Advanced settings content
-
-
-
-
- Save
-
-
-
-
-
-
- {/* Code */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/* Icons */}
-
-
- {[
- { Icon: BubbleChatClose, name: 'BubbleChatClose' },
- { Icon: BubbleChatPreview, name: 'BubbleChatPreview' },
- { Icon: ChevronDown, name: 'ChevronDown' },
- { Icon: Connections, name: 'Connections' },
- { Icon: Cursor, name: 'Cursor' },
- { Icon: DocumentAttachment, name: 'DocumentAttachment' },
- { Icon: Download, name: 'Download' },
- { Icon: Duplicate, name: 'Duplicate' },
- { Icon: Expand, name: 'Expand' },
- { Icon: Eye, name: 'Eye' },
- { Icon: FolderCode, name: 'FolderCode' },
- { Icon: FolderPlus, name: 'FolderPlus' },
- { Icon: Hand, name: 'Hand' },
- { Icon: HexSimple, name: 'HexSimple' },
- { Icon: KeyIcon, name: 'Key' },
- { Icon: Layout, name: 'Layout' },
- { Icon: Library, name: 'Library' },
- { Icon: Loader, name: 'Loader' },
- { Icon: MoreHorizontal, name: 'MoreHorizontal' },
- { Icon: NoWrap, name: 'NoWrap' },
- { Icon: PanelLeft, name: 'PanelLeft' },
- { Icon: Play, name: 'Play' },
- { Icon: PlayOutline, name: 'PlayOutline' },
- { Icon: Redo, name: 'Redo' },
- { Icon: Rocket, name: 'Rocket' },
- { Icon: Trash, name: 'Trash' },
- { Icon: Undo, name: 'Undo' },
- { Icon: Wrap, name: 'Wrap' },
- { Icon: ZoomIn, name: 'ZoomIn' },
- { Icon: ZoomOut, name: 'ZoomOut' },
- ].map(({ Icon, name }) => (
-
-
-
-
-
-
- {name}
-
- ))}
-
-
-
-
-
- >
- )
-}
diff --git a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.dom.test.tsx b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.dom.test.tsx
index 67e039f7322..db21062bc04 100644
--- a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.dom.test.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.dom.test.tsx
@@ -73,7 +73,7 @@ vi.mock('@/lib/api/client/request', async (importOriginal) => {
return {
...actual,
requestJson(contract: C, input: ApiClientRequest) {
- return contract.path === '/api/copilot/chat/abort'
+ return contract.path === '/api/mothership/chat/abort'
? actual.requestJson(contract, input)
: mockRequestJson(contract, input)
},
@@ -83,7 +83,10 @@ vi.mock('@/lib/api/client/request', async (importOriginal) => {
import { ToastProvider } from '@sim/emcn'
import type { ApiClientRequest } from '@/lib/api/client/request'
import type { AnyApiRouteContract } from '@/lib/api/contracts'
-import type { CopilotChatAbortBody, CopilotChatStopBody } from '@/lib/api/contracts/copilot'
+import type {
+ MothershipChatAbortBody,
+ MothershipChatStopBody,
+} from '@/lib/api/contracts/mothership-chats'
import {
resetDeploymentShape,
resolveDeploymentShape,
@@ -165,8 +168,8 @@ interface NetworkState {
postBodies: Array<{ message: string; userMessageId?: string; chatId?: string; effort?: string }>
pendingAdmissions: Map void>
abortSettlements: boolean[]
- abortBodies: CopilotChatAbortBody[]
- stopBodies: CopilotChatStopBody[]
+ abortBodies: MothershipChatAbortBody[]
+ stopBodies: MothershipChatStopBody[]
toolInputPadding?: string
abortTraceparents: Array
}
@@ -194,8 +197,8 @@ function emptySseResponse(): Response {
async function fetchStub(input: RequestInfo | URL, init?: RequestInit): Promise {
const url = String(input instanceof Request ? input.url : input)
- if (url.includes('/api/copilot/chat/abort')) {
- const body: CopilotChatAbortBody = JSON.parse(String(init?.body))
+ if (url.includes('/api/mothership/chat/abort')) {
+ const body: MothershipChatAbortBody = JSON.parse(String(init?.body))
state.abortBodies.push(body)
if (body.streamId) state.pendingAdmissions.get(body.streamId)?.()
state.abortTraceparents.push(new Headers(init?.headers).get('traceparent'))
@@ -1280,7 +1283,7 @@ describe('useChat remount send recovery', () => {
})
let stopRequested = false
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
- if (String(input).includes('/api/copilot/chat/abort')) {
+ if (String(input).includes('/api/mothership/chat/abort')) {
stopRequested = true
await stopGate
}
@@ -1325,7 +1328,7 @@ describe('useChat remount send recovery', () => {
})
let stopRequested = false
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
- if (String(input).includes('/api/copilot/chat/abort')) {
+ if (String(input).includes('/api/mothership/chat/abort')) {
stopRequested = true
await stopGate
}
@@ -2003,7 +2006,7 @@ describe('useChat remount send recovery', () => {
let abortAttempts = 0
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
const url = String(input instanceof Request ? input.url : input)
- if (url.includes('/api/copilot/chat/abort')) {
+ if (url.includes('/api/mothership/chat/abort')) {
abortAttempts += 1
if (abortAttempts === 1 || retryFails) {
return Response.json({ error: 'Stop service unavailable' }, { status: 503 })
@@ -2253,7 +2256,7 @@ describe('useChat remount send recovery', () => {
})
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
const url = String(input instanceof Request ? input.url : input)
- if (url.includes('/api/copilot/chat/abort')) {
+ if (url.includes('/api/mothership/chat/abort')) {
state.abortBodies.push(JSON.parse(String(init?.body)))
return Response.json({ aborted: true, settled: true })
}
@@ -2381,7 +2384,7 @@ describe('useChat remount send recovery', () => {
let settleResponse = settled
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
const url = String(input instanceof Request ? input.url : input)
- if (url.includes('/api/copilot/chat/abort')) {
+ if (url.includes('/api/mothership/chat/abort')) {
state.abortBodies.push(JSON.parse(String(init?.body)))
return Response.json({ aborted: true, settled: settleResponse })
}
@@ -2603,7 +2606,7 @@ describe('useChat remount send recovery', () => {
}
)
}
- if (url.includes('/api/copilot/chat/abort')) {
+ if (url.includes('/api/mothership/chat/abort')) {
state.abortBodies.push(JSON.parse(String(init?.body)))
return Response.json({ error: 'Internal error' }, { status: 500 })
}
@@ -2949,7 +2952,8 @@ describe('useChat remount send recovery', () => {
await waitFor(() => state.postBodies.length === 1 && first.getResult().isSending)
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
/** The Stop never settles before the reload. */
- if (String(input).includes('/api/copilot/chat/abort')) return new Promise(() => {})
+ if (String(input).includes('/api/mothership/chat/abort'))
+ return new Promise(() => {})
return fetchStub(input, init)
})
useMothershipQueueStore.getState().enqueue('chat-a', {
@@ -3148,7 +3152,7 @@ describe('useChat remount send recovery', () => {
mockRequestJson.mockImplementation(() => Promise.resolve({ chat: history }))
vi.stubGlobal('fetch', async (input: RequestInfo | URL, init?: RequestInit) => {
const url = String(input)
- if (url.includes('/api/copilot/chat/abort')) {
+ if (url.includes('/api/mothership/chat/abort')) {
state.abortBodies.push(JSON.parse(String(init?.body)))
return Response.json({ aborted: true, settled: true })
}
diff --git a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
index 554c17085e3..71bc48fc472 100644
--- a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
+++ b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
@@ -20,10 +20,10 @@ import { useQueryClient } from '@tanstack/react-query'
import { usePathname, useRouter } from 'next/navigation'
import { isApiClientError } from '@/lib/api/client/errors'
import { requestJson } from '@/lib/api/client/request'
-import { copilotChatAbortContract } from '@/lib/api/contracts/copilot'
import type { WorkspaceSearchFilters } from '@/lib/api/contracts/knowledge/search'
import {
addMothershipChatResourceContract,
+ mothershipChatAbortContract,
removeMothershipChatResourceContract,
reorderMothershipChatResourcesContract,
} from '@/lib/api/contracts/mothership-chats'
@@ -3939,7 +3939,7 @@ export function useChat(
} else {
const predecessor = queuedSendHandoff?.supersededStreamId
if (!predecessor) throw new Error('The previous response could not be identified.')
- const stopped = await requestJson(copilotChatAbortContract, {
+ const stopped = await requestJson(mothershipChatAbortContract, {
keepalive: true,
signal: createTimeoutSignal(STOP_REQUEST_TIMEOUT_MS),
headers: {},
@@ -4894,7 +4894,7 @@ export function useChat(
let abortSettled = false
const postAbortRequest = async (chatId?: string): Promise => {
if (!sid) return true
- const payload = await requestJson(copilotChatAbortContract, {
+ const payload = await requestJson(mothershipChatAbortContract, {
keepalive: true,
signal: createTimeoutSignal(STOP_REQUEST_TIMEOUT_MS),
headers: {
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx
index 274b4e07890..47228d8dac1 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx
@@ -49,9 +49,7 @@ const findFolderInfoForTag = (
group: NestedBlockTagGroup
): {
id: string
- title: string
parentTag: string
- group: NestedBlockTagGroup
nestedTag: NestedTag
} | null => {
for (const nestedTag of nestedTags) {
@@ -61,9 +59,7 @@ const findFolderInfoForTag = (
) {
return {
id: `${group.blockId}-${nestedTag.key}`,
- title: nestedTag.display,
parentTag: nestedTag.parentTag,
- group,
nestedTag,
}
}
@@ -193,15 +189,9 @@ export const KeyboardNavigationHandler: React.FC
const handleKeyboardEvent = useEffectEvent((e: KeyboardEvent) => {
if (!flatTagList.length) return
- const openFolderWithSelection = (
- folderId: string,
- folderTitle: string,
- parentTag: string,
- group: BlockTagGroup
- ) => {
+ const enterFolder = (folderId: string, parentTag: string) => {
const parentIdx = flatTagList.findIndex((item) => item.tag === parentTag)
- const selectionCallback = () => handleTagSelect(parentTag, group)
- openFolder(folderId, folderTitle, undefined, selectionCallback)
+ openFolder(folderId)
if (parentIdx >= 0) {
setSelectedIndex(parentIdx)
}
@@ -210,13 +200,7 @@ export const KeyboardNavigationHandler: React.FC
const selected = flatTagList[selectedIndex]
if (!selected && e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return
- let currentFolderInfo: {
- id: string
- title: string
- parentTag: string
- group: NestedBlockTagGroup
- nestedTag: NestedTag
- } | null = null
+ let currentFolderInfo: ReturnType = null
if (selected) {
for (const group of nestedBlockTagGroups) {
@@ -290,14 +274,9 @@ export const KeyboardNavigationHandler: React.FC
e.preventDefault()
e.stopPropagation()
if (isInFolder && nestedNav) {
- nestedNav.navigateIn(currentFolderInfo.nestedTag, currentFolderInfo.group)
+ nestedNav.navigateIn(currentFolderInfo.nestedTag)
} else {
- openFolderWithSelection(
- currentFolderInfo.id,
- currentFolderInfo.title,
- currentFolderInfo.parentTag,
- currentFolderInfo.group
- )
+ enterFolder(currentFolderInfo.id, currentFolderInfo.parentTag)
onFolderEnter?.()
}
}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx
index 7099c3906cf..dca6987d365 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx
@@ -43,16 +43,9 @@ interface NestedNavigationContextValue {
/** Stack of nested tags representing current navigation depth */
nestedPath: NestedTag[]
/** Navigate into a nested folder */
- navigateIn: (tag: NestedTag, group: NestedBlockTagGroup) => void
+ navigateIn: (tag: NestedTag) => void
/** Navigate back one level, returns true if navigation happened, false if at root */
navigateBack: () => boolean
- /** Register the base folder when it opens */
- registerFolder: (
- folderId: string,
- folderTitle: string,
- baseTag: NestedTag,
- group: NestedBlockTagGroup
- ) => void
}
const NestedNavigationContext = React.createContext(null)
@@ -531,29 +524,16 @@ const FolderContentsInner: React.FC = ({
/**
* Wrapper component that uses shared nested navigation state from context.
- * Handles registration of the base folder and navigation callbacks.
+ * Supplies the current nested path and the navigate-in callback.
*/
const FolderContents: React.FC> = (props) => {
const nestedNav = useNestedNavigation()
- const { currentFolder } = usePopoverContext()
const nestedPath = nestedNav?.nestedPath ?? []
- useEffect(() => {
- if (nestedNav && currentFolder) {
- const folderId = `${props.group.blockId}-${props.nestedTag.key}`
- if (currentFolder === folderId) {
- nestedNav.registerFolder(folderId, props.nestedTag.display, props.nestedTag, props.group)
- }
- }
- }, [currentFolder, nestedNav, props.group, props.nestedTag])
-
- const handleNavigateIn = useCallback(
- (nestedTag: NestedTag) => {
- nestedNav?.navigateIn(nestedTag, props.group)
- },
- [nestedNav, props.group]
- )
+ const handleNavigateIn = (nestedTag: NestedTag) => {
+ nestedNav?.navigateIn(nestedTag)
+ }
return
}
@@ -590,11 +570,6 @@ const NestedTagRenderer: React.FC = ({
id={folderId}
title={nestedTag.display}
active={parentGlobalIndex === selectedIndex && parentGlobalIndex >= 0}
- onSelect={() => {
- if (nestedTag.parentTag) {
- handleTagSelect(nestedTag.parentTag, group)
- }
- }}
onMouseEnter={() => {
if (isKeyboardNav) return
setKeyboardNav(false)
@@ -810,23 +785,6 @@ const BlockRootTagItem: React.FC<{
)
}
-/**
- * Helper component to capture popover context for nested navigation
- */
-const PopoverContextCapture: React.FC<{
- contextRef: React.RefObject<{
- openFolder: (id: string, title: string, onLoad?: () => void, onSelect?: () => void) => void
- } | null>
-}> = ({ contextRef }) => {
- const { openFolder } = usePopoverContext()
- useEffect(() => {
- if (contextRef && 'current' in contextRef) {
- ;(contextRef as { current: typeof contextRef.current }).current = { openFolder }
- }
- }, [openFolder, contextRef])
- return null
-}
-
/**
* Back button that handles nested navigation.
* When in nested folders, goes back one level at a time.
@@ -908,13 +866,6 @@ export const TagDropdown: React.FC = ({
const itemRefs = (itemElementsRef.current ??= new Map())
const [nestedPath, setNestedPath] = useState([])
- const baseFolderRef = useRef<{
- id: string
- title: string
- baseTag: NestedTag
- group: NestedBlockTagGroup
- } | null>(null)
- const handleTagSelectRef = useRef<((tag: string, group?: BlockTagGroup) => void) | null>(null)
const scrollAreaRef = useRef(null)
const inputValueRef = useRef(inputValue)
@@ -1490,76 +1441,21 @@ export const TagDropdown: React.FC = ({
[workflowVariables, onSelect, onClose, getMergedSubBlocks]
)
- handleTagSelectRef.current = handleTagSelect
-
- const popoverContextRef = useRef<{
- openFolder: (id: string, title: string, onLoad?: () => void, onSelect?: () => void) => void
- } | null>(null)
-
const nestedNavigationValue = useMemo(
() => ({
nestedPath,
- navigateIn: (tag: NestedTag, group: NestedBlockTagGroup) => {
- const baseFolder = baseFolderRef.current
- if (!baseFolder || !popoverContextRef.current) return
-
+ navigateIn: (tag: NestedTag) => {
setNestedPath((prev) => [...prev, tag])
if (scrollAreaRef.current) {
scrollAreaRef.current.scrollTop = 0
}
-
- const selectionCallback = () => {
- if (tag.parentTag && handleTagSelectRef.current) {
- handleTagSelectRef.current(tag.parentTag, group)
- }
- }
- popoverContextRef.current.openFolder(
- baseFolder.id,
- tag.display,
- undefined,
- selectionCallback
- )
},
navigateBack: () => {
- const baseFolder = baseFolderRef.current
- if (!baseFolder || !popoverContextRef.current) return false
if (nestedPath.length === 0) return false
-
- const newPath = nestedPath.slice(0, -1)
- setNestedPath(newPath)
-
- if (newPath.length === 0) {
- const selectionCallback = () => {
- if (baseFolder.baseTag.parentTag && handleTagSelectRef.current) {
- handleTagSelectRef.current(baseFolder.baseTag.parentTag, baseFolder.group)
- }
- }
- popoverContextRef.current.openFolder(
- baseFolder.id,
- baseFolder.title,
- undefined,
- selectionCallback
- )
- } else {
- const parentTag = newPath[newPath.length - 1]
- const selectionCallback = () => {
- if (parentTag.parentTag && handleTagSelectRef.current) {
- handleTagSelectRef.current(parentTag.parentTag, baseFolder.group)
- }
- }
- popoverContextRef.current.openFolder(
- baseFolder.id,
- parentTag.display,
- undefined,
- selectionCallback
- )
- }
+ setNestedPath(nestedPath.slice(0, -1))
return true
},
- registerFolder: (folderId, folderTitle, baseTag, group) => {
- baseFolderRef.current = { id: folderId, title: folderTitle, baseTag, group }
- },
}),
[nestedPath]
)
@@ -1567,7 +1463,6 @@ export const TagDropdown: React.FC = ({
useEffect(() => {
if (!visible) {
setNestedPath([])
- baseFolderRef.current = null
}
}, [visible])
@@ -1612,7 +1507,6 @@ export const TagDropdown: React.FC = ({
return (
!open && onClose?.()} colorScheme='inverted'>
-
void
hasInputData: boolean
- isPlaygroundEnabled: boolean
showCopySuccess: boolean
handleCopy: () => void
hasEntries: boolean
@@ -121,7 +118,6 @@ export const OutputPanel = React.memo(function OutputPanel({
showInput,
setShowInput,
hasInputData,
- isPlaygroundEnabled,
showCopySuccess,
handleCopy,
hasEntries,
@@ -385,26 +381,6 @@ export const OutputPanel = React.memo(function OutputPanel({
)}
- {isPlaygroundEnabled && (
-
-
-
-
-
-
-
-
-
- Component Playground
-
-
- )}
-
isTruthy(getEnv('NEXT_PUBLIC_ENABLE_PLAYGROUND')))
-
const { handlePointerDown } = useTerminalResize()
const { handlePointerDown: handleOutputPanelResizePointerDown } = useOutputPanelResize()
@@ -1253,26 +1249,6 @@ export const Terminal = memo(function Terminal() {
)}
- {isPlaygroundEnabled && (
-
-
-
-
-
-
-
-
-
- Component Playground
-
-
- )}
-
{filteredEntries.length > 0 && (
<>
@@ -1387,7 +1363,6 @@ export const Terminal = memo(function Terminal() {
showInput={showInput}
setShowInput={setShowInput}
hasInputData={hasInputData}
- isPlaygroundEnabled={isPlaygroundEnabled}
showCopySuccess={showCopySuccess}
handleCopy={handleCopy}
hasEntries={filteredEntries.length > 0}
diff --git a/apps/sim/lib/api/contracts/copilot.ts b/apps/sim/lib/api/contracts/copilot.ts
index dab30ada290..4b8446c034c 100644
--- a/apps/sim/lib/api/contracts/copilot.ts
+++ b/apps/sim/lib/api/contracts/copilot.ts
@@ -1,11 +1,6 @@
import { z } from 'zod'
-import { persistedContentBlockSchema } from '@/lib/api/contracts/copilot-messages'
import { workspaceSearchFiltersSchema } from '@/lib/api/contracts/knowledge/search'
-import {
- mothershipResourceRemovalSchema,
- mothershipResourceSchema,
-} from '@/lib/api/contracts/mothership-resources'
-import { requiredFieldSchema, workspaceIdSchema } from '@/lib/api/contracts/primitives'
+import { workspaceIdSchema } from '@/lib/api/contracts/primitives'
import { usageUpgradePayloadSchema } from '@/lib/api/contracts/subscription'
import { type ContractJsonResponse, defineRouteContract } from '@/lib/api/contracts/types'
import {
@@ -98,55 +93,6 @@ export const createWorkflowCopilotChatBodySchema = z.object({
})
export type CreateWorkflowCopilotChatBody = z.input
-export const addCopilotChatResourceBodySchema = z
- .object({
- chatId: requiredFieldSchema('chatId cannot be empty'),
- resource: mothershipResourceSchema,
- clearViewId: z.literal(true).optional(),
- })
- .superRefine((body, ctx) => {
- if (body.clearViewId !== true) return
- if (body.resource.type !== 'table') {
- ctx.addIssue({
- code: 'custom',
- path: ['clearViewId'],
- message: 'clearViewId is only valid for table resources',
- })
- }
- if (body.resource.viewId !== undefined) {
- ctx.addIssue({
- code: 'custom',
- path: ['resource', 'viewId'],
- message: 'viewId must be omitted when clearViewId is true',
- })
- }
- })
-export type AddCopilotChatResourceBody = z.input
-
-export const removeCopilotChatResourceBodySchema = mothershipResourceRemovalSchema.safeExtend({
- chatId: z.string(),
-})
-export type RemoveCopilotChatResourceBody = z.input
-
-export const reorderCopilotChatResourcesBodySchema = z.object({
- chatId: z.string(),
- resources: z.array(mothershipResourceSchema),
-})
-export type ReorderCopilotChatResourcesBody = z.input
-
-export const copilotChatAbortBodySchema = z
- .object({
- streamId: z.string().optional(),
- chatId: z.string().optional(),
- workspaceId: z.string().min(1).optional(),
- organizationId: z.string().min(1).optional(),
- })
- .refine((body) => !(body.workspaceId && body.organizationId), {
- message: 'Choose either workspaceId or organizationId, not both',
- path: ['organizationId'],
- })
-export type CopilotChatAbortBody = z.input
-
export const copilotChatSteerBodySchema = z.object({
streamId: z.string().min(1, 'streamId is required'),
chatId: z.string().min(1, 'chatId is required'),
@@ -186,31 +132,6 @@ export const copilotToolExecuteInternalBodySchema = z
)
export type CopilotToolExecuteInternalBody = z.input
-export const copilotChatStreamQuerySchema = z.object({
- streamId: z.string().optional().default(''),
- after: z.string().optional().default(''),
- batch: z
- .string()
- .optional()
- .transform((value) => value === 'true'),
- /** `log` once the reader was re-synced from the worker log: its cursor is a log position. */
- source: z.enum(['ring', 'log']).optional(),
-})
-
-export const copilotChatStopBodySchema = z.object({
- chatId: z.string(),
- streamId: z.string(),
- /**
- * Partial assistant content to persist. Optional: the worker backend persists partials
- * itself, so a Stop with nothing client-buffered is valid — requiring this made bare
- * stops 400 and left the turn running detached.
- */
- content: z.string().default(''),
- contentBlocks: z.array(persistedContentBlockSchema).optional(),
- requestId: z.string().optional(),
-})
-export type CopilotChatStopBody = z.input
-
export const deleteCopilotChatBodySchema = z.object({
chatId: z.string(),
})
@@ -466,59 +387,6 @@ export const copilotToolPermissionContract = defineRouteContract({
},
})
-export const addCopilotChatResourceContract = defineRouteContract({
- method: 'POST',
- path: '/api/copilot/chat/resources',
- body: addCopilotChatResourceBodySchema,
- response: {
- mode: 'json',
- schema: z.object({
- success: z.literal(true),
- resources: z.array(mothershipResourceSchema).optional(),
- }),
- },
-})
-
-export const reorderCopilotChatResourcesContract = defineRouteContract({
- method: 'PATCH',
- path: '/api/copilot/chat/resources',
- body: reorderCopilotChatResourcesBodySchema,
- response: {
- mode: 'json',
- schema: z.object({
- success: z.literal(true),
- resources: z.array(mothershipResourceSchema),
- }),
- },
-})
-
-export const removeCopilotChatResourceContract = defineRouteContract({
- method: 'DELETE',
- path: '/api/copilot/chat/resources',
- body: removeCopilotChatResourceBodySchema,
- response: {
- mode: 'json',
- schema: z.object({
- success: z.literal(true),
- resources: z.array(mothershipResourceSchema),
- }),
- },
-})
-
-export const copilotChatStreamContract = defineRouteContract({
- method: 'GET',
- path: '/api/copilot/chat/stream',
- query: copilotChatStreamQuerySchema,
- response: { mode: 'stream' },
-})
-
-export const copilotChatStopContract = defineRouteContract({
- method: 'POST',
- path: '/api/copilot/chat/stop',
- body: copilotChatStopBodySchema,
- response: { mode: 'json', schema: successFlagSchema },
-})
-
export const deleteCopilotChatContract = defineRouteContract({
method: 'DELETE',
path: '/api/copilot/chat/delete',
@@ -526,23 +394,6 @@ export const deleteCopilotChatContract = defineRouteContract({
response: { mode: 'json', schema: successFlagSchema },
})
-export const copilotChatAbortContract = defineRouteContract({
- method: 'POST',
- path: '/api/copilot/chat/abort',
- headers: z.object({ traceparent: z.string().max(512).optional() }),
- body: copilotChatAbortBodySchema.safeExtend({
- streamId: z.string().min(1, 'streamId is required'),
- }),
- response: {
- mode: 'json',
- schema: z.object({
- aborted: z.boolean(),
- /** Execution ended, or admission was durably cancelled before execution could start. */
- settled: z.boolean(),
- forceReleased: z.boolean().optional(),
- }),
- },
-})
export const copilotChatSteerContract = defineRouteContract({
method: 'POST',
path: '/api/copilot/chat/steer',
diff --git a/apps/sim/lib/api/contracts/mothership-chats.ts b/apps/sim/lib/api/contracts/mothership-chats.ts
index 5f1a7461a50..3b82858ca20 100644
--- a/apps/sim/lib/api/contracts/mothership-chats.ts
+++ b/apps/sim/lib/api/contracts/mothership-chats.ts
@@ -1,9 +1,10 @@
import { z } from 'zod'
-import { addCopilotChatResourceBodySchema } from '@/lib/api/contracts/copilot'
+import { persistedContentBlockSchema } from '@/lib/api/contracts/copilot-messages'
import {
mothershipResourceRemovalSchema,
mothershipResourceSchema,
} from '@/lib/api/contracts/mothership-resources'
+import { requiredFieldSchema } from '@/lib/api/contracts/primitives'
import { scheduleContextSchema } from '@/lib/api/contracts/schedules'
import {
mountedSecretNamesSchema,
@@ -181,37 +182,6 @@ export const mothershipChatPostEnvelopeSchema = z
})
.passthrough()
-export const mothershipChatStopEnvelopeSchema = z
- .object({
- chatId: z.string().optional(),
- streamId: z.string().optional(),
- content: z.string().optional(),
- contentBlocks: z.array(z.unknown()).optional(),
- requestId: z.string().optional(),
- })
- .passthrough()
-
-export const mothershipChatAbortEnvelopeSchema = z
- .object({
- streamId: z.string().optional(),
- chatId: z.string().optional(),
- workspaceId: z.string().min(1).optional(),
- })
- .passthrough()
-
-export const mothershipChatStreamQuerySchema = z
- .object({
- streamId: z.string().optional(),
- after: z.string().optional(),
- batch: z.string().optional(),
- source: z.enum(['ring', 'log']).optional(),
- })
- .passthrough()
-
-export const mothershipChatResourceEnvelopeSchema = z
- .object({ chatId: z.string().optional() })
- .passthrough()
-
export const adminMothershipQuerySchema = z
.object({
env: z.preprocess(
@@ -228,7 +198,29 @@ const mothershipChatResourcesResponseSchema = z.object({
resources: z.array(mothershipResourceSchema),
})
-export const addMothershipChatResourceBodySchema = addCopilotChatResourceBodySchema
+export const addMothershipChatResourceBodySchema = z
+ .object({
+ chatId: requiredFieldSchema('chatId cannot be empty'),
+ resource: mothershipResourceSchema,
+ clearViewId: z.literal(true).optional(),
+ })
+ .superRefine((body, ctx) => {
+ if (body.clearViewId !== true) return
+ if (body.resource.type !== 'table') {
+ ctx.addIssue({
+ code: 'custom',
+ path: ['clearViewId'],
+ message: 'clearViewId is only valid for table resources',
+ })
+ }
+ if (body.resource.viewId !== undefined) {
+ ctx.addIssue({
+ code: 'custom',
+ path: ['resource', 'viewId'],
+ message: 'viewId must be omitted when clearViewId is true',
+ })
+ }
+ })
export type AddMothershipChatResourceBody = z.input
const reorderMothershipChatResourcesBodySchema = z.object({
@@ -270,6 +262,75 @@ export const removeMothershipChatResourceContract = defineRouteContract({
},
})
+const mothershipChatStreamQuerySchema = z.object({
+ streamId: z.string().optional().default(''),
+ after: z.string().optional().default(''),
+ batch: z
+ .string()
+ .optional()
+ .transform((value) => value === 'true'),
+ /** `log` once the reader was re-synced from the worker log: its cursor is a log position. */
+ source: z.enum(['ring', 'log']).optional(),
+})
+
+/** Re-attaches to a chat run's event stream from a cursor, or returns one batch of it. */
+export const mothershipChatStreamContract = defineRouteContract({
+ method: 'GET',
+ path: '/api/mothership/chat/stream',
+ query: mothershipChatStreamQuerySchema,
+ response: { mode: 'stream' },
+})
+
+export const mothershipChatStopBodySchema = z.object({
+ chatId: z.string(),
+ streamId: z.string(),
+ /**
+ * Partial assistant content to persist. Optional: the worker backend persists partials
+ * itself, so a Stop with nothing client-buffered is valid — requiring this made bare
+ * stops 400 and left the turn running detached.
+ */
+ content: z.string().default(''),
+ contentBlocks: z.array(persistedContentBlockSchema).optional(),
+ requestId: z.string().optional(),
+})
+export type MothershipChatStopBody = z.input
+
+export const mothershipChatStopContract = defineRouteContract({
+ method: 'POST',
+ path: '/api/mothership/chat/stop',
+ body: mothershipChatStopBodySchema,
+ response: { mode: 'json', schema: z.object({ success: z.literal(true) }) },
+})
+
+const mothershipChatAbortBodySchema = z
+ .object({
+ streamId: z.string().min(1, 'streamId is required'),
+ chatId: z.string().optional(),
+ workspaceId: z.string().min(1).optional(),
+ organizationId: z.string().min(1).optional(),
+ })
+ .refine((body) => !(body.workspaceId && body.organizationId), {
+ message: 'Choose either workspaceId or organizationId, not both',
+ path: ['organizationId'],
+ })
+export type MothershipChatAbortBody = z.input
+
+export const mothershipChatAbortContract = defineRouteContract({
+ method: 'POST',
+ path: '/api/mothership/chat/abort',
+ headers: z.object({ traceparent: z.string().max(512).optional() }),
+ body: mothershipChatAbortBodySchema,
+ response: {
+ mode: 'json',
+ schema: z.object({
+ aborted: z.boolean(),
+ /** Execution ended, or admission was durably cancelled before execution could start. */
+ settled: z.boolean(),
+ forceReleased: z.boolean().optional(),
+ }),
+ },
+})
+
export const mothershipChatSchema = z.object({
mode: z.enum(['agent', 'assistant', 'plan']),
id: z.string(),
diff --git a/apps/sim/lib/core/config/env-flags.ts b/apps/sim/lib/core/config/env-flags.ts
index 515dac4a862..6201927a849 100644
--- a/apps/sim/lib/core/config/env-flags.ts
+++ b/apps/sim/lib/core/config/env-flags.ts
@@ -173,35 +173,12 @@ export function getEgressAllowedIpRanges(): string | undefined {
return isHosted ? undefined : env.EGRESS_ALLOWED_IP_RANGES
}
-/**
- * Whether the deprecated `ALLOW_PRIVATE_DATABASE_HOSTS` is set.
- *
- * It stood for a blanket "database and connector tools may reach anything
- * private", so it maps to a policy that vouches for every private address rather
- * than to a range list — a list would silently drop the ranges it never
- * enumerated, CGNAT (`100.64.0.0/10`, where Tailscale lives) among them.
- *
- * Scoped to database hosts, which is all the flag ever governed. Widening it to
- * HTTP destinations would hand every workflow author on an upgrading deployment
- * a route into the internal network they never granted.
- */
-export function isLegacyPrivateDatabaseAccessAllowed(): boolean {
- return !isHosted && isTruthy(env.ALLOW_PRIVATE_DATABASE_HOSTS)
-}
-
if (isTruthy(env.ALLOW_PRIVATE_DATABASE_HOSTS)) {
import('@sim/logger')
.then(({ createLogger }) => {
- const logger = createLogger('EnvFlags')
- if (isHosted) {
- logger.error(
- 'ALLOW_PRIVATE_DATABASE_HOSTS is set but ignored on hosted environment. Private, reserved, and loopback destinations remain blocked for security.'
- )
- } else {
- logger.warn(
- 'ALLOW_PRIVATE_DATABASE_HOSTS is deprecated. It opens the whole private address space to database and connector tools. Replace it with EGRESS_ALLOWED_HOSTS / EGRESS_ALLOWED_IP_RANGES naming only the destinations you need.'
- )
- }
+ createLogger('EnvFlags').error(
+ 'ALLOW_PRIVATE_DATABASE_HOSTS was removed and has no effect; allow specific database hostnames with EGRESS_ALLOWED_HOSTS, or a database IP address (including IPv6) with a single-address EGRESS_ALLOWED_IP_RANGES entry'
+ )
})
.catch(() => {
// Fallback during config compilation when logger is unavailable
diff --git a/apps/sim/lib/core/config/env.ts b/apps/sim/lib/core/config/env.ts
index a8e737ef902..6ab1f1d6739 100644
--- a/apps/sim/lib/core/config/env.ts
+++ b/apps/sim/lib/core/config/env.ts
@@ -131,7 +131,7 @@ export const env = createEnv({
DISABLE_REGISTRATION: z.boolean().optional(), // Flag to disable new user registration
EMAIL_PASSWORD_SIGNUP_ENABLED: z.boolean().optional().default(true), // Enable email/password authentication (server-side enforcement)
DISABLE_AUTH: z.boolean().optional(), // Bypass authentication entirely (self-hosted only, creates anonymous session)
- ALLOW_PRIVATE_DATABASE_HOSTS: z.boolean().optional(), // Deprecated alias for the egress allowlist, kept so existing self-hosted deployments keep working. Equivalent to allowing every private, reserved, and loopback destination. Prefer EGRESS_ALLOWED_HOSTS / EGRESS_ALLOWED_IP_RANGES, which name specific destinations.
+ ALLOW_PRIVATE_DATABASE_HOSTS: z.boolean().optional(), // Removed; read only to log a startup error that it has no effect. Use EGRESS_ALLOWED_HOSTS / EGRESS_ALLOWED_IP_RANGES.
EGRESS_ALLOWED_HOSTS: z.string().optional(), // Comma-separated hostnames outbound requests may reach on a private network, leading wildcard allowed (e.g. "host.docker.internal,*.svc.cluster.local"). Self-hosted only; ignored on the hosted platform. Replaces ALLOW_PRIVATE_DATABASE_HOSTS.
EGRESS_ALLOWED_IP_RANGES: z.string().optional(), // Comma-separated CIDRs or IPs outbound requests may reach on a private network (e.g. "10.0.0.0/8,192.168.65.254/32"). Self-hosted only; never lifts the cloud-metadata block.
DOMAIN_VERIFICATION_NAMESERVERS: z.string().optional(), // Comma-separated nameserver IPs for the domain-verification TXT lookup (e.g. "10.0.0.2"). Defaults to 1.1.1.1 and 8.8.8.8; set it where outbound DNS is restricted to an internal resolver.
@@ -757,7 +757,6 @@ export const env = createEnv({
NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALS: z.string().optional(), // Hide Bedrock credential fields when deployment uses AWS default credential chain (IAM roles, instance profiles, ECS task roles, IRSA)
NEXT_PUBLIC_AZURE_CONFIGURED: z.string().optional(), // Hide Azure credential fields when endpoint/key/version are pre-configured server-side
NEXT_PUBLIC_COHERE_CONFIGURED: z.string().optional(), // Hide Cohere API key field on Knowledge block when COHERE_API_KEY is pre-configured server-side
- NEXT_PUBLIC_ENABLE_PLAYGROUND: z.string().optional(), // Enable component playground at /playground
// Feature Flags
NEXT_PUBLIC_ENTERPRISE_ENABLED: z.boolean().optional(), // Client twin of ENTERPRISE_ENABLED — set both together
@@ -817,7 +816,6 @@ export const env = createEnv({
NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALS: process.env.NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALS,
NEXT_PUBLIC_AZURE_CONFIGURED: process.env.NEXT_PUBLIC_AZURE_CONFIGURED,
NEXT_PUBLIC_COHERE_CONFIGURED: process.env.NEXT_PUBLIC_COHERE_CONFIGURED,
- NEXT_PUBLIC_ENABLE_PLAYGROUND: process.env.NEXT_PUBLIC_ENABLE_PLAYGROUND,
NEXT_PUBLIC_POSTHOG_ENABLED: process.env.NEXT_PUBLIC_POSTHOG_ENABLED,
NEXT_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY,
NODE_ENV: process.env.NODE_ENV,
diff --git a/apps/sim/lib/core/security/egress/profiles.test.ts b/apps/sim/lib/core/security/egress/profiles.test.ts
index 50af050160a..3d0db526ef3 100644
--- a/apps/sim/lib/core/security/egress/profiles.test.ts
+++ b/apps/sim/lib/core/security/egress/profiles.test.ts
@@ -111,21 +111,6 @@ describe('the hosted platform ignores every softening', () => {
})
})
-describe('the deprecated ALLOW_PRIVATE_DATABASE_HOSTS', () => {
- it('reaches database hosts only', () => {
- envFlagsMock.legacyPrivateDatabaseAccess = true
- expect(decide('databaseHost', 'https://pg.corp/', '10.4.2.9').allowed).toBe(true)
- for (const profile of ['configuredEndpoint', 'selfHostedService', 'requestTarget'] as const) {
- expect(decide(profile, 'https://pg.corp/', '10.4.2.9').allowed).toBe(false)
- }
- })
-
- it('still cannot reach a metadata endpoint', () => {
- envFlagsMock.legacyPrivateDatabaseAccess = true
- expect(decide('databaseHost', 'https://pg.corp/', '169.254.169.254').allowed).toBe(false)
- })
-})
-
describe('an unrecognized profile falls back to the strictest one', () => {
it('refuses what contentFetch refuses', () => {
envFlagsMock.egressAllowedIpRanges = '10.0.0.0/8'
diff --git a/apps/sim/lib/core/security/egress/profiles.ts b/apps/sim/lib/core/security/egress/profiles.ts
index 9a40f116442..96d17231c70 100644
--- a/apps/sim/lib/core/security/egress/profiles.ts
+++ b/apps/sim/lib/core/security/egress/profiles.ts
@@ -22,7 +22,6 @@ import {
getEgressAllowedHosts,
getEgressAllowedIpRanges,
isHosted,
- isLegacyPrivateDatabaseAccessAllowed,
} from '@/lib/core/config/env-flags'
/**
@@ -94,12 +93,6 @@ interface ProfileSpec {
* reachable configuration at all.
*/
readonly schemeFixedByProtocol?: boolean
- /**
- * Whether the deprecated `ALLOW_PRIVATE_DATABASE_HOSTS` applies. Only
- * `databaseHost` sets this, because that is the only thing the flag ever
- * governed.
- */
- readonly honorsLegacyPrivateFlag?: boolean
}
const PROFILE_SPECS: Record = {
@@ -126,7 +119,6 @@ const PROFILE_SPECS: Record = {
honorsAllowlist: true,
insecureHttp: 'whenVouched',
allowLoopbackOffHosted: false,
- honorsLegacyPrivateFlag: true,
},
proxy: {
honorsAllowlist: false,
@@ -144,7 +136,6 @@ const SOURCE_NAMES = {
interface DeploymentConfig {
readonly hosts: string | undefined
readonly ranges: string | undefined
- readonly legacyPrivate: boolean
readonly hosted: boolean
}
@@ -152,7 +143,6 @@ function readDeploymentConfig(): DeploymentConfig {
return {
hosts: getEgressAllowedHosts(),
ranges: getEgressAllowedIpRanges(),
- legacyPrivate: isLegacyPrivateDatabaseAccessAllowed(),
hosted: isHosted,
}
}
@@ -176,7 +166,6 @@ function buildPolicies(config: DeploymentConfig): Record {
})
})
- describe('deprecated ALLOW_PRIVATE_DATABASE_HOSTS alias', () => {
- afterEach(() => {
- envFlagsMock.legacyPrivateDatabaseAccess = false
- })
-
- it.each([
- ['localhost', 'loopback by name'],
- ['100.64.0.1', 'CGNAT, where a Tailscale host lives'],
- ])('keeps %s reachable for a deployment still on the old flag — %s', async (host) => {
- envFlagsMock.legacyPrivateDatabaseAccess = true
- expect((await validateDatabaseHost(host)).isValid).toBe(true)
- })
-
- it('still cannot reach cloud metadata through the alias', async () => {
- envFlagsMock.legacyPrivateDatabaseAccess = true
- const result = await validateDatabaseHost('169.254.169.254')
- expect(result.isValid).toBe(false)
- expect(result.error).toContain('cloud metadata endpoint')
- })
-
- it('does not widen HTTP destinations, which the flag never governed', async () => {
- envFlagsMock.legacyPrivateDatabaseAccess = true
- expect(
- (await validateUrlWithDNS('https://10.0.0.5/api', 'url', 'requestTarget')).isValid
- ).toBe(false)
- expect(
- (await validateUrlWithDNS('https://10.0.0.5/api', 'url', 'configuredEndpoint')).isValid
- ).toBe(false)
- })
- })
-
describe('self-host opt-in (EGRESS_ALLOWED_HOSTS / EGRESS_ALLOWED_IP_RANGES)', () => {
beforeEach(() => {
envFlagsMock.egressAllowedHosts = 'localhost'
diff --git a/apps/sim/lib/mothership/agent-cli/saved-run-read.live.test.ts b/apps/sim/lib/mothership/agent-cli/saved-run-read.live.test.ts
index 64950ef7624..71801fffbca 100644
--- a/apps/sim/lib/mothership/agent-cli/saved-run-read.live.test.ts
+++ b/apps/sim/lib/mothership/agent-cli/saved-run-read.live.test.ts
@@ -162,7 +162,7 @@ import { calculateNextRunTime, getScheduleTimeValues } from '@/lib/workflows/sch
import { fileOperations } from '@/lib/workspace-files/application/operations'
import { readWorkspaceFileArtifact } from '@/lib/workspace-files/application/read-workspace-file-artifact'
import { readWorkspaceFileText } from '@/lib/workspace-files/application/read-workspace-file-text'
-import { POST as abortChatRoute } from '@/app/api/copilot/chat/abort/route'
+import { POST as abortChatRoute } from '@/app/api/mothership/chat/abort/route'
import {
POST as addChatResourceRoute,
DELETE as removeChatResourceRoute,
@@ -3809,7 +3809,7 @@ describe.skipIf(!process.env.MSHIP_TEST_DATABASE_URL)(
stoppedAt = Date.now()
// The Stop button's request: it stops the run, not just the stream.
const response = await abortChatRoute(
- new NextRequest('https://sim.test/api/copilot/chat/abort', {
+ new NextRequest('https://sim.test/api/mothership/chat/abort', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ chatId, streamId: messageId, workspaceId }),
diff --git a/apps/sim/lib/mothership/chat/persisted-message.test.ts b/apps/sim/lib/mothership/chat/persisted-message.test.ts
index 00c1aeb8d56..51cc24c92ae 100644
--- a/apps/sim/lib/mothership/chat/persisted-message.test.ts
+++ b/apps/sim/lib/mothership/chat/persisted-message.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { copilotChatStopBodySchema } from '@/lib/api/contracts/copilot'
import type { PersistedToolState } from '@/lib/api/contracts/copilot-messages'
+import { mothershipChatStopBodySchema } from '@/lib/api/contracts/mothership-chats'
import { isChatContext } from '@/lib/mothership/chat/context'
import { toDisplayMessage } from '@/lib/mothership/chat/display-message'
import { getLiveAssistantMessageId } from '@/lib/mothership/chat/live-message-id'
@@ -83,7 +83,7 @@ describe('persisted-message', () => {
],
}
const persisted = buildPersistedAssistantMessage(result)
- const stopped = copilotChatStopBodySchema.parse({
+ const stopped = mothershipChatStopBodySchema.parse({
chatId: 'chat-1',
streamId: 'stream-1',
content: '',
diff --git a/apps/sim/lib/mothership/chat/project-file-context.integration.ts b/apps/sim/lib/mothership/chat/project-file-context.integration.ts
index 3984333c8e6..f6dee625455 100644
--- a/apps/sim/lib/mothership/chat/project-file-context.integration.ts
+++ b/apps/sim/lib/mothership/chat/project-file-context.integration.ts
@@ -29,10 +29,9 @@ import { type MothershipResource, sanitizeChatResources } from '@/lib/mothership
import { executeTool, registerHandler } from '@/lib/mothership/tool-executor/executor'
import { createServerToolHandler } from '@/lib/mothership/tools/registry/server-tool-adapter'
import {
- POST as addCopilotResource,
- DELETE as removeCopilotResource,
-} from '@/app/api/copilot/chat/resources/route'
-import { DELETE as removeMothershipResource } from '@/app/api/mothership/chat/resources/route'
+ POST as addMothershipResource,
+ DELETE as removeMothershipResource,
+} from '@/app/api/mothership/chat/resources/route'
import { GET as readMothershipChat } from '@/app/api/mothership/chats/[chatId]/route'
vi.mock('@/lib/core/config/feature-flags', () => featureFlagsMock)
@@ -492,7 +491,7 @@ describe('canonical file panel ownership compatibility', () => {
)
identityCheck(
- 'rejects conflicting or unsupported file removal owners at both HTTP route boundaries',
+ 'rejects conflicting or unsupported file removal owners at the HTTP route boundary',
async () => {
const f = await fixture()
authMockFns.mockGetSession.mockResolvedValue({
@@ -509,37 +508,29 @@ describe('canonical file panel ownership compatibility', () => {
.update(copilotChats)
.set({ resources: [resource] })
.where(eq(copilotChats.id, f.chatId))
- for (const [path, handler] of [
- ['/api/copilot/chat/resources', removeCopilotResource],
- ['/api/mothership/chat/resources', removeMothershipResource],
- ] as const) {
- for (const address of [
- { owner: f.owner, workspaceId: f.workspaceId },
- {
- owner: { entityType: 'workspace', entityId: generateId() },
- workspaceId: f.workspaceId,
- },
- { owner: { entityType: 'organization', entityId: generateId() } },
- { owner: f.owner, resourceType: 'table' },
- ]) {
- const response = await handler(
- createMockRequest({
- method: 'DELETE',
- url: `http://localhost${path}`,
- body: {
- chatId: f.chatId,
- resourceType: 'file',
- resourceId: f.fileId,
- ...address,
- },
- }),
- undefined
- )
- expect(
- response.status,
- JSON.stringify({ path, address, body: await response.json() })
- ).toBe(400)
- }
+ for (const address of [
+ { owner: f.owner, workspaceId: f.workspaceId },
+ {
+ owner: { entityType: 'workspace', entityId: generateId() },
+ workspaceId: f.workspaceId,
+ },
+ { owner: { entityType: 'organization', entityId: generateId() } },
+ { owner: f.owner, resourceType: 'table' },
+ ]) {
+ const response = await removeMothershipResource(
+ createMockRequest({
+ method: 'DELETE',
+ url: 'http://localhost/api/mothership/chat/resources',
+ body: {
+ chatId: f.chatId,
+ resourceType: 'file',
+ resourceId: f.fileId,
+ ...address,
+ },
+ }),
+ undefined
+ )
+ expect(response.status, JSON.stringify({ address, body: await response.json() })).toBe(400)
}
const [stored] = await db
.select({ resources: copilotChats.resources })
@@ -807,10 +798,10 @@ describe('legacy browser file address compatibility', () => {
{ type: 'filefolder', id: folderId, title: 'Project folder', owner: f.owner },
]
for (const resource of resources) {
- const response = await addCopilotResource(
+ const response = await addMothershipResource(
createMockRequest({
method: 'POST',
- url: 'http://localhost/api/copilot/chat/resources',
+ url: 'http://localhost/api/mothership/chat/resources',
body: { chatId: f.chatId, resource },
}),
undefined
@@ -850,10 +841,10 @@ describe('legacy browser file address compatibility', () => {
.where(eq(copilotChats.id, f.chatId))
expect(stored.resources).toEqual([resources[0]])
- const conflicting = await addCopilotResource(
+ const conflicting = await addMothershipResource(
createMockRequest({
method: 'POST',
- url: 'http://localhost/api/copilot/chat/resources',
+ url: 'http://localhost/api/mothership/chat/resources',
body: { chatId: f.chatId, resource: { ...resources[1], workspaceId: f.workspaceId } },
}),
undefined
@@ -914,10 +905,10 @@ describe('legacy browser file address compatibility', () => {
expect(history.status).toBe(200)
const historyBody = toRecord(await history.json())
expect(toRecord(historyBody.chat).resources).toEqual(expectedWire)
- const mutation = await addCopilotResource(
+ const mutation = await addMothershipResource(
createMockRequest({
method: 'POST',
- url: 'http://localhost/api/copilot/chat/resources',
+ url: 'http://localhost/api/mothership/chat/resources',
body: { chatId: f.chatId, resource: workspaceFile },
}),
undefined
diff --git a/apps/sim/lib/mothership/request/application/abandoned-runs.integration.ts b/apps/sim/lib/mothership/request/application/abandoned-runs.integration.ts
index 0c129e80cb0..cd59f1c6831 100644
--- a/apps/sim/lib/mothership/request/application/abandoned-runs.integration.ts
+++ b/apps/sim/lib/mothership/request/application/abandoned-runs.integration.ts
@@ -131,7 +131,7 @@ import {
} from '@/lib/mothership/request/go/tool-call-identity'
import { chatStreamLockKey } from '@/lib/mothership/request/session/controller-lease'
import { chatSandboxSessionKey } from '@/lib/mothership/tools/sandbox-session-key'
-import { GET as streamGET } from '@/app/api/copilot/chat/stream/route'
+import { GET as streamGET } from '@/app/api/mothership/chat/stream/route'
const ownerId = generateId()
const userId = generateId()
@@ -457,7 +457,7 @@ describe.runIf(Boolean(redisUrl))('taking over a run whose controller died', ()
const [reconnect] = await Promise.all([
streamGET(
new NextRequest(
- `http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=0`
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=0`
),
{ params: Promise.resolve({}) }
),
diff --git a/apps/sim/lib/mothership/request/http.ts b/apps/sim/lib/mothership/request/http.ts
index b9f278abaef..5443fef0777 100644
--- a/apps/sim/lib/mothership/request/http.ts
+++ b/apps/sim/lib/mothership/request/http.ts
@@ -111,16 +111,16 @@ export function checkInternalApiKey(req: NextRequest) {
}
/**
- * Shim-route envelope pre-validation (the /api/mothership/* aliases): clone the body,
- * and when it parses as JSON, check it against the envelope schema before delegating to
- * the copilot handler that actually consumes the request. Returns the 400 to send, or
- * null to proceed. A non-JSON body proceeds — the delegate owns that failure mode.
+ * Pre-validates the `/api/mothership/chat` POST envelope before `handleUnifiedChatPost` reads
+ * the body: clones the request and, when it parses as JSON, checks it against the envelope
+ * schema. Returns the 400 to send, or null to proceed. A non-JSON body proceeds, since the
+ * handler owns that failure mode.
*/
-export async function validateShimEnvelope(
+export async function validateChatPostEnvelope(
request: NextRequest,
schema: z.ZodType
): Promise {
- // boundary-raw-json: shim pre-validates the mothership envelope before delegating to the copilot handler that consumes the body
+ // boundary-raw-json: pre-validates the chat POST envelope on a clone so handleUnifiedChatPost can still read the body
const body = await request
.clone()
.json()
diff --git a/apps/sim/lib/mothership/request/session/recovery-storm.integration.ts b/apps/sim/lib/mothership/request/session/recovery-storm.integration.ts
index 8653273b06b..30446bad33b 100644
--- a/apps/sim/lib/mothership/request/session/recovery-storm.integration.ts
+++ b/apps/sim/lib/mothership/request/session/recovery-storm.integration.ts
@@ -174,7 +174,7 @@ import { appendEvents } from '@/lib/mothership/request/session/buffer'
import { chatStreamLockKey } from '@/lib/mothership/request/session/controller-lease'
import { createEvent } from '@/lib/mothership/request/session/event'
import { StreamRecoveryExhaustedError } from '@/lib/mothership/request/session/turn-failure'
-import { GET as streamGET } from '@/app/api/copilot/chat/stream/route'
+import { GET as streamGET } from '@/app/api/mothership/chat/stream/route'
const userId = generateId()
const workspaceId = generateId()
@@ -315,7 +315,7 @@ async function reconnect(
const drains = controllers.map(async (controller) => {
const response = await streamGET(
new NextRequest(
- `http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=2`,
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=2`,
{ signal: controller.signal }
),
{ params: Promise.resolve({}) }
diff --git a/apps/sim/lib/mothership/request/session/replay-budget.integration.ts b/apps/sim/lib/mothership/request/session/replay-budget.integration.ts
index 270bf37d5a4..c3e5f49e109 100644
--- a/apps/sim/lib/mothership/request/session/replay-budget.integration.ts
+++ b/apps/sim/lib/mothership/request/session/replay-budget.integration.ts
@@ -172,7 +172,7 @@ import {
type PendingFileIntent,
storeFileIntent,
} from '@/lib/mothership/tools/server/files/intent-store'
-import { GET as streamGET } from '@/app/api/copilot/chat/stream/route'
+import { GET as streamGET } from '@/app/api/mothership/chat/stream/route'
import { GET as mothershipChatGET } from '@/app/api/mothership/chats/[chatId]/route'
const MB = 1024 * 1024
@@ -619,7 +619,9 @@ describe.runIf(Boolean(redisUrl))('a turn whose stream exhausts its replay budge
expect(await redis().get(chatStreamLockKey(chatId))).toBeNull()
const reconnect = await streamGET(
- new NextRequest(`http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=0`),
+ new NextRequest(
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=0`
+ ),
{ params: Promise.resolve({}) }
)
const replayed = dataFrames(await reconnect.text())
@@ -834,7 +836,7 @@ describe.runIf(Boolean(redisUrl))('a turn whose stream exhausts its replay budge
await (
await streamGET(
new NextRequest(
- `http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=${after}`
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=${after}`
),
{ params: Promise.resolve({}) }
)
@@ -944,7 +946,7 @@ describe.runIf(Boolean(redisUrl))('a turn whose stream exhausts its replay budge
const resume = async (streamId: string, query: string) =>
streamGET(
new NextRequest(
- `http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&${query}`
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&${query}`
),
{ params: Promise.resolve({}) }
)
diff --git a/apps/sim/lib/mothership/request/session/replay-gap.integration.ts b/apps/sim/lib/mothership/request/session/replay-gap.integration.ts
index e9d23055b67..6adf931fe58 100644
--- a/apps/sim/lib/mothership/request/session/replay-gap.integration.ts
+++ b/apps/sim/lib/mothership/request/session/replay-gap.integration.ts
@@ -59,7 +59,7 @@ import { closeRedisConnection, getRedisClient } from '@/lib/core/config/redis'
import { MOTHERSHIP_STREAM_REPLAY_HEADER } from '@/lib/mothership/constants'
import { allocateCursor, appendEvents } from '@/lib/mothership/request/session/buffer'
import { createEvent } from '@/lib/mothership/request/session/event'
-import { GET as streamGET } from '@/app/api/copilot/chat/stream/route'
+import { GET as streamGET } from '@/app/api/mothership/chat/stream/route'
const userId = generateId()
const workspaceId = generateId()
@@ -117,7 +117,7 @@ async function liveRunWithTrimmedRing(): Promise<{ streamId: string; runId: stri
function reconnect(streamId: string, after: string, batch = false, extra = '') {
return streamGET(
new NextRequest(
- `http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=${after}${batch ? '&batch=true' : ''}${extra}`
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=${after}${batch ? '&batch=true' : ''}${extra}`
),
{ params: Promise.resolve({}) }
)
diff --git a/apps/sim/lib/mothership/request/session/stream-recovery.integration.ts b/apps/sim/lib/mothership/request/session/stream-recovery.integration.ts
index 8103bd78a62..96983f03d13 100644
--- a/apps/sim/lib/mothership/request/session/stream-recovery.integration.ts
+++ b/apps/sim/lib/mothership/request/session/stream-recovery.integration.ts
@@ -73,7 +73,7 @@ import {
import { appendEvents, readEvents } from '@/lib/mothership/request/session/buffer'
import { chatStreamLockKey } from '@/lib/mothership/request/session/controller-lease'
import { createEvent } from '@/lib/mothership/request/session/event'
-import { GET as streamGET } from '@/app/api/copilot/chat/stream/route'
+import { GET as streamGET } from '@/app/api/mothership/chat/stream/route'
const userId = generateId()
const workspaceId = generateId()
@@ -152,7 +152,9 @@ async function orphanedRunWithTrimmedRing() {
/** Opens a reconnect, which recovers the run, and waits for the recovered turn to finish. */
async function recoverAndFinish(streamId: string, runId: string) {
const reconnect = await streamGET(
- new NextRequest(`http://localhost:3000/api/copilot/chat/stream?streamId=${streamId}&after=4`),
+ new NextRequest(
+ `http://localhost:3000/api/mothership/chat/stream?streamId=${streamId}&after=4`
+ ),
{ params: Promise.resolve({}) }
)
await reconnect.body?.cancel()
diff --git a/apps/sim/lib/mothership/resources/types.test.ts b/apps/sim/lib/mothership/resources/types.test.ts
index 445398a0a49..d9ead4916ca 100644
--- a/apps/sim/lib/mothership/resources/types.test.ts
+++ b/apps/sim/lib/mothership/resources/types.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { addCopilotChatResourceBodySchema } from '@/lib/api/contracts/copilot'
+import { addMothershipChatResourceBodySchema } from '@/lib/api/contracts/mothership-chats'
import {
getChatResourceKey,
getChatResourceSelectionId,
@@ -65,7 +65,7 @@ describe('desktop session resource identity', () => {
*/
describe('client and server agree on what can be persisted', () => {
it.each(PERSISTED_RESOURCE_TYPES)('the API accepts a %s resource', (type) => {
- const parsed = addCopilotChatResourceBodySchema.safeParse({
+ const parsed = addMothershipChatResourceBodySchema.safeParse({
chatId: 'chat-1',
resource: {
type,
@@ -86,7 +86,7 @@ describe('client and server agree on what can be persisted', () => {
)
expect(ephemeral.length).toBeGreaterThan(0)
for (const type of ephemeral) {
- const parsed = addCopilotChatResourceBodySchema.safeParse({
+ const parsed = addMothershipChatResourceBodySchema.safeParse({
chatId: 'chat-1',
resource: { type, id: 'r1', title: 'Thing' },
})
@@ -96,21 +96,21 @@ describe('client and server agree on what can be persisted', () => {
it('accepts an explicit table pin clear and rejects ambiguous or non-table clears', () => {
expect(
- addCopilotChatResourceBodySchema.safeParse({
+ addMothershipChatResourceBodySchema.safeParse({
chatId: 'chat-1',
resource: { type: 'table', id: 'tbl-1', title: 'Invoices' },
clearViewId: true,
}).success
).toBe(true)
expect(
- addCopilotChatResourceBodySchema.safeParse({
+ addMothershipChatResourceBodySchema.safeParse({
chatId: 'chat-1',
resource: { type: 'table', id: 'tbl-1', title: 'Invoices', viewId: 'view-1' },
clearViewId: true,
}).success
).toBe(false)
expect(
- addCopilotChatResourceBodySchema.safeParse({
+ addMothershipChatResourceBodySchema.safeParse({
chatId: 'chat-1',
resource: { type: 'file', id: 'file-1', title: 'report.csv' },
clearViewId: true,
@@ -143,7 +143,7 @@ describe('unaddressable resources', () => {
})
it('refuses a blank id at the write boundary, matching the send path', () => {
- const parsed = addCopilotChatResourceBodySchema.safeParse({
+ const parsed = addMothershipChatResourceBodySchema.safeParse({
chatId: 'chat-1',
resource: { type: 'file', id: '', title: 'reporte-russell.md' },
})
diff --git a/apps/sim/lib/navigation/paths.ts b/apps/sim/lib/navigation/paths.ts
index 18f18ae0afd..8cc4dc03d9a 100644
--- a/apps/sim/lib/navigation/paths.ts
+++ b/apps/sim/lib/navigation/paths.ts
@@ -89,8 +89,7 @@ export function isAppSurfacePath(pathname: string): boolean {
/**
* Non-app routes that must never appear in search results: deployed chats,
* paused-run resume links, invitations, unsubscribe links, shared files, the
- * legacy `/w` redirects, the design playground, and account, self-host, and
- * upgrade utility pages.
+ * legacy `/w` redirects, and account, self-host, and upgrade utility pages.
*/
const NOINDEX_PATH_ROOTS = [
'/sim',
@@ -101,7 +100,6 @@ const NOINDEX_PATH_ROOTS = [
'/unsubscribe',
'/f',
'/w',
- '/playground',
'/account',
'/selfhost',
'/upgrade',
diff --git a/apps/sim/lib/uploads/contexts/workspace/__integration__/storage-lock-order.integration.ts b/apps/sim/lib/uploads/contexts/workspace/__integration__/storage-lock-order.integration.ts
index 2ed98fff31a..895bd2efb94 100644
--- a/apps/sim/lib/uploads/contexts/workspace/__integration__/storage-lock-order.integration.ts
+++ b/apps/sim/lib/uploads/contexts/workspace/__integration__/storage-lock-order.integration.ts
@@ -1,6 +1,6 @@
/**
* Real PostgreSQL lock ordering between new-file finalization and concurrent writers in the same
- * workspace. They reach the workspace row, the file directory lock, and the per-workspace search
+ * workspace. They reach the workspace row, the file directory lock, and the workspace's search
* dispatch queue row (through the `workspace_files` search-index trigger), so every writer must
* take them in the same order.
*/
@@ -10,16 +10,16 @@ import { tmpdir } from 'node:os'
import path from 'node:path'
import { db, dbFor } from '@sim/db'
import {
+ fileSearchDispatchQueue,
organization,
user,
workspace,
- workspaceFileSearchDispatchQueue,
workspaceFiles,
} from '@sim/db/schema'
import { deleteWorkspaceFixture } from '@sim/db/testing/workspace-fixtures'
import { createDeferred } from '@sim/testing/helpers/deferred'
import { generateId } from '@sim/utils/id'
-import { eq, inArray, sql } from 'drizzle-orm'
+import { and, eq, inArray, sql } from 'drizzle-orm'
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
const fixtureStorage = vi.hoisted(() => ({ root: '' }))
@@ -113,9 +113,14 @@ describe.skipIf(!migrated)('workspace file storage lock order in PostgreSQL', ()
{ notifyWorkspaceChange: false }
)
const queued = await db
- .select({ workspaceId: workspaceFileSearchDispatchQueue.workspaceId })
- .from(workspaceFileSearchDispatchQueue)
- .where(eq(workspaceFileSearchDispatchQueue.workspaceId, ids.workspaceId))
+ .select({ entityId: fileSearchDispatchQueue.entityId })
+ .from(fileSearchDispatchQueue)
+ .where(
+ and(
+ eq(fileSearchDispatchQueue.entityType, 'workspace'),
+ eq(fileSearchDispatchQueue.entityId, ids.workspaceId)
+ )
+ )
expect(queued).toHaveLength(1)
return { ...ids, existingFileId: existing.id }
}
diff --git a/apps/sim/lib/workspace-files/search/README.md b/apps/sim/lib/workspace-files/search/README.md
index 64e27ad598a..7e14d8597e2 100644
--- a/apps/sim/lib/workspace-files/search/README.md
+++ b/apps/sim/lib/workspace-files/search/README.md
@@ -45,11 +45,9 @@ Search results retain `fileId`, 1-based `lineNumber`, and bounded `text` preview
1. Deploy the additive migration and new application/Trigger worker versions. Legacy index tables remain readable for the old deployment. The file trigger queues current revisions in the new table; this cutover intentionally allows temporary search unavailability while the new index builds.
2. The dispatcher uses a separate `workspace-file-search-chunks-v2` backfill cursor. It walks at most 1,000 active files per pass without locking them, and seeds only the files still missing a revision, under a shared lock on just those files, with idempotent inserts. Normal dispatch caps remain two outstanding jobs per workspace, 100 outstanding globally, and ten running workers. Reconciliation repeats hourly after a complete pass to repair missing metadata. Failed revisions remain visible as failed; they are not silently declared covered.
3. Before retiring legacy storage, verify the new app and Trigger workers are fully deployed, old runs/retries have drained, the backfill cursor has completed, and scoped coverage is ready or explicitly excluded. Investigate failed or stale pending revisions. Check cleanup backlog and run representative exact/regex searches, including long lines and folder scopes.
-4. After the rollback window, ship a separate contract PR removing the legacy schema and dropping `workspace_file_search_segment` / `workspace_file_search_index` with a short lock timeout. Do not delete the entire old index row-by-row or backfill it inside the schema migration. Dropping obsolete tables reclaims their heap, indexes, and TOAST together. The `contract-pending` marker in `packages/db/schema.ts` tracks this step.
+4. After the rollback window, a separate contract migration (`0468_retire_legacy_search_and_contracts.sql`) dropped `workspace_file_search_segment` and `workspace_file_search_index` with a short lock timeout, without deleting or backfilling old rows inside the schema migration. Dropping obsolete tables reclaims their heap, indexes, and TOAST together.
-Until that contract deploy, legacy foreign-key cascades can still make a hard file/workspace deletion expensive. New-index cleanup is bounded; retaining the old schema cannot erase that legacy cost. The earlier timestamp-repair script detects the chunk schema and leaves obsolete legacy text for this contract step instead of deleting it in bulk. Legacy-table retirement remains a separate contract migration.
-
-Rollback before retirement requires restoring the old trigger function as well as the old app/worker version, and reconciling legacy revisions written during the cutover. Do not assume retained tables are automatically up to date. Canonical revision joins prevent stale content from being returned.
+The legacy index is gone, so rolling back to a pre-chunk-search app version is no longer possible.
### Direct GIN writes
@@ -71,6 +69,6 @@ The design uses PostgreSQL's documented [TOAST behavior](https://www.postgresql.
Migration `0426_file_search_owner_scope.sql` adds canonical workspace/Project ownership to the existing build, revision, and chunk pipeline. Legacy workspace inserts are translated by triggers, and the existing workspace trigram index remains usable. Project rows use a separate owner-scoped trigram index on the same chunk table. Organizations and personal users are not enabled search owners.
-The new `file_search_dispatch_queue` replaces the workspace-keyed scheduler because older workers cannot decode a Project without a workspace. During expansion, workspace mutations enqueue both queues, while the new dispatcher reads the owner queue. Both deployments share the dispatcher lock, revision claim token, build lease, and publication fence. Drain old app dispatchers and Trigger workers/retries before enabling Project dispatch. Retire the legacy queue and its dual enqueue in a later contract deploy; they are not a second indexing pipeline. The `file-search-owners-v3` cursor performs bounded owner/file keyset backfill and hourly reconciliation without rewriting extracted text in the migration. Each pass selects owners woken since their last dispatch that still have a free slot first (`wokenSinceDispatch` in `dispatcher.ts`), then the rest by dispatch age, and fills its capacity owner by owner in that order. Backfill wake-ups enter as if just dispatched and never touch an owner already queued, so a page of them rotates in behind owners woken for work.
+The new `file_search_dispatch_queue` replaces the workspace-keyed scheduler because older workers cannot decode a Project without a workspace. During expansion, workspace mutations enqueued both queues while the new dispatcher read the owner queue. Migration `0468_retire_legacy_search_and_contracts.sql` retired that dual enqueue and dropped `workspace_file_search_dispatch_queue`; the file trigger now wakes only `file_search_dispatch_queue`. The `file-search-owners-v3` cursor performs bounded owner/file keyset backfill and hourly reconciliation without rewriting extracted text in the migration. Each pass selects owners woken since their last dispatch that still have a free slot first (`wokenSinceDispatch` in `dispatcher.ts`), then the rest by dispatch age, and fills its capacity owner by owner in that order. Backfill wake-ups enter as if just dispatched and never touch an owner already queued, so a page of them rotates in behind owners woken for work.
Generated document indexing never executes source. A cached artifact must match its owner and current input manifest. Each published build stores at most 500 input identities. Queries exclude a build when any input is changed, archived, deleted, or outside the owner, and report it as pending coverage. Input mutations wake their owner queue; the dispatcher retires stale manifests in bounded batches before rebuilding. Expired build cleanup also removes its dependency records. A cache miss indexes the stored generation source as text until an authorized rendering path creates a current artifact.
diff --git a/apps/sim/lib/workspace-files/search/chunks.integration.ts b/apps/sim/lib/workspace-files/search/chunks.integration.ts
index 3f6495f759c..27a828635f4 100644
--- a/apps/sim/lib/workspace-files/search/chunks.integration.ts
+++ b/apps/sim/lib/workspace-files/search/chunks.integration.ts
@@ -89,7 +89,10 @@ describe('chunked workspace file search on PostgreSQL', () => {
)
const ginWriteMigration = '0364_workspace_file_search_direct_gin.sql'
- async function applyMigration(migration: string) {
+ async function applyMigration(
+ migration: string,
+ matches: (statement: string) => boolean = () => true
+ ) {
const source = readFileSync(
resolve(process.cwd(), '../../packages/db/migrations', migration),
'utf8'
@@ -98,7 +101,7 @@ describe('chunked workspace file search on PostgreSQL', () => {
try {
await session`BEGIN`
for (const statement of source.split('--> statement-breakpoint'))
- if (statement.trim()) await session.unsafe(statement)
+ if (statement.trim() && matches(statement)) await session.unsafe(statement)
await session`COMMIT`
} finally {
await session`ROLLBACK`
@@ -178,6 +181,13 @@ describe('chunked workspace file search on PostgreSQL', () => {
]) {
await applyMigration(migration)
}
+ // Take only the trigger redefinition and the legacy search-table drops: any other unqualified DROP falls through search_path to public.
+ await applyMigration(
+ '0468_retire_legacy_search_and_contracts.sql',
+ (statement) =>
+ /\bCREATE OR REPLACE FUNCTION workspace_file_search_mark_pending\b/.test(statement) ||
+ /\bDROP TABLE IF EXISTS "workspace_file_search_/.test(statement)
+ )
database.current = drizzle(connection)
database.search = drizzle(searchConnection, {
logger: {
@@ -196,7 +206,7 @@ describe('chunked workspace file search on PostgreSQL', () => {
})
beforeEach(async () => {
await connection`TRUNCATE workspace, workspace_files, workspace_file_search_revision, workspace_file_search_build,
- workspace_file_search_chunk, workspace_file_search_index, workspace_file_search_segment, workspace_file_search_dispatch_queue, workspace_file_search_backfill, file_search_dependency, file_search_dispatch_queue`
+ workspace_file_search_chunk, workspace_file_search_backfill, file_search_dependency, file_search_dispatch_queue`
await connection`INSERT INTO workspace_file_search_backfill (id, completed_at) VALUES ('file-search-owners-v3', now())`
await addFile('file-1')
})
diff --git a/apps/sim/lib/workspace-files/search/dispatcher.integration.ts b/apps/sim/lib/workspace-files/search/dispatcher.integration.ts
index 454152d1653..c6f9631a456 100644
--- a/apps/sim/lib/workspace-files/search/dispatcher.integration.ts
+++ b/apps/sim/lib/workspace-files/search/dispatcher.integration.ts
@@ -72,10 +72,21 @@ describe('workspace file search dispatch PostgreSQL deadlines', () => {
},
})
)
- const migration = ['0426_file_search_owner_scope.sql', '0428_file_search_dependency_owner.sql']
- .map((file) =>
- readFileSync(resolve(process.cwd(), '../../packages/db/migrations', file), 'utf8')
+ const readMigration = (file: string) =>
+ readFileSync(resolve(process.cwd(), '../../packages/db/migrations', file), 'utf8')
+ /** 0468 redefines the file trigger without the retired workspace-queue enqueue. */
+ const currentMarkPending = readMigration('0468_retire_legacy_search_and_contracts.sql')
+ .split('--> statement-breakpoint')
+ .find((statement) =>
+ statement.includes('CREATE OR REPLACE FUNCTION workspace_file_search_mark_pending()')
)
+ if (!currentMarkPending)
+ throw new Error('0468 no longer defines workspace_file_search_mark_pending')
+ const migration = [
+ readMigration('0426_file_search_owner_scope.sql'),
+ readMigration('0428_file_search_dependency_owner.sql'),
+ currentMarkPending,
+ ]
.join('\n--> statement-breakpoint\n')
.replaceAll('"public".', `"${schemaName}".`)
const ownerIndexes = [
@@ -136,10 +147,6 @@ describe('workspace file search dispatch PostgreSQL deadlines', () => {
dispatched_at timestamp, handoff_expires_at timestamp,
updated_at timestamp NOT NULL DEFAULT now()
)`
- await connection`CREATE TABLE workspace_file_search_dispatch_queue (
- workspace_id text PRIMARY KEY, enqueued_at timestamp NOT NULL,
- updated_at timestamp NOT NULL, last_dispatched_at timestamp
- )`
await connection`CREATE INDEX workspace_files_workspace_active_keyset_idx
ON workspace_files (workspace_id, id)
WHERE deleted_at IS NULL AND context = 'workspace' AND workspace_id IS NOT NULL`
@@ -165,7 +172,7 @@ describe('workspace file search dispatch PostgreSQL deadlines', () => {
beforeEach(async () => {
mocks.batchTrigger.mockReset()
await connection`DROP TRIGGER IF EXISTS slow_backfill ON workspace_file_search_backfill`
- await connection`TRUNCATE workspace_files, workspace_file_search_revision, workspace_file_search_dispatch_queue, file_search_dispatch_queue, workspace_file_search_build, workspace_file_search_chunk CASCADE`
+ await connection`TRUNCATE workspace_files, workspace_file_search_revision, file_search_dispatch_queue, workspace_file_search_build, workspace_file_search_chunk CASCADE`
await connection`INSERT INTO workspace_file_search_backfill (id, updated_at)
VALUES ('file-search-owners-v3', '2026-09-16 00:00:00')
ON CONFLICT (id) DO UPDATE SET updated_at = EXCLUDED.updated_at, completed_at = NULL,
diff --git a/apps/sim/lib/workspace-files/search/owners.integration.ts b/apps/sim/lib/workspace-files/search/owners.integration.ts
index f019ffd7eed..def7dd6a7b0 100644
--- a/apps/sim/lib/workspace-files/search/owners.integration.ts
+++ b/apps/sim/lib/workspace-files/search/owners.integration.ts
@@ -1318,9 +1318,6 @@ afterAll(async () => {
await db.execute(
sql`DELETE FROM file_search_dispatch_queue WHERE (entity_type = 'project' AND entity_id = ${f.projectId}) OR (entity_type = 'workspace' AND entity_id = ${f.workspaceId})`
)
- await db.execute(
- sql`DELETE FROM workspace_file_search_dispatch_queue WHERE workspace_id = ${f.workspaceId}`
- )
await db.delete(folder).where(eq(folder.projectId, f.projectId))
await deleteWorkspaceFixture(db, eq(workspace.id, f.workspaceId))
await db.delete(project).where(eq(project.id, f.projectId))
diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts
index 310096ac276..0cd864a0635 100644
--- a/apps/sim/next.config.ts
+++ b/apps/sim/next.config.ts
@@ -196,7 +196,6 @@ const nextConfig: NextConfig = {
'@radix-ui/react-dropdown-menu',
'@radix-ui/react-popover',
'@radix-ui/react-select',
- '@radix-ui/react-tabs',
'@radix-ui/react-checkbox',
'@radix-ui/react-switch',
'@radix-ui/react-slider',
@@ -686,6 +685,8 @@ const nextConfig: NextConfig = {
source: '/favicon.ico',
destination: '/icon.svg',
},
+ /** Serves Stop from browser tabs loaded before the abort route moved; remove after the next release. */
+ { source: '/api/copilot/chat/abort', destination: '/api/mothership/chat/abort' },
],
/**
* Fallback rewrites run only after every page and dynamic route has failed to match, so
diff --git a/apps/sim/package.json b/apps/sim/package.json
index 73fc667c6bd..91fc2807b81 100644
--- a/apps/sim/package.json
+++ b/apps/sim/package.json
@@ -153,7 +153,6 @@
"@radix-ui/react-slider": "1.6.1",
"@radix-ui/react-slot": "1.5.0",
"@radix-ui/react-switch": "1.4.1",
- "@radix-ui/react-tabs": "1.2.1",
"@react-email/components": "1.0.12",
"@react-email/render": "2.2.0",
"@sim/audit": "workspace:*",
diff --git a/bun.lock b/bun.lock
index 79802077575..6dd21b68169 100644
--- a/bun.lock
+++ b/bun.lock
@@ -297,7 +297,6 @@
"@radix-ui/react-slider": "1.6.1",
"@radix-ui/react-slot": "1.5.0",
"@radix-ui/react-switch": "1.4.1",
- "@radix-ui/react-tabs": "1.2.1",
"@react-email/components": "1.0.12",
"@react-email/render": "2.2.0",
"@sim/audit": "workspace:*",
@@ -646,7 +645,6 @@
"@radix-ui/react-slider": "1.6.1",
"@radix-ui/react-slot": "1.5.0",
"@radix-ui/react-switch": "1.4.1",
- "@radix-ui/react-tabs": "1.2.1",
"@sim/tsconfig": "workspace:*",
"@tanstack/react-virtual": "3.14.26",
"@types/prismjs": "^1.26.5",
@@ -674,7 +672,6 @@
"@radix-ui/react-slider": "^1.6.1",
"@radix-ui/react-slot": "^1.2.2",
"@radix-ui/react-switch": "^1.4.1",
- "@radix-ui/react-tabs": "^1.2.1",
"@tanstack/react-virtual": "^3.13.24",
"class-variance-authority": "^0.7.1",
"framer-motion": "^12.5.0",
diff --git a/docker-compose.ollama.yml b/docker-compose.ollama.yml
index 501a16032ee..589ce0cd87e 100644
--- a/docker-compose.ollama.yml
+++ b/docker-compose.ollama.yml
@@ -1,133 +1,39 @@
-name: sim-with-ollama
+# Bundled Ollama, layered on top of docker-compose.prod.yml. The base file
+# supplies the app, realtime, migrations, Redis, cron and Postgres (with their
+# required .env secrets); this file only adds an Ollama server and points the
+# app at it. Add OLLAMA_URL=http://ollama:11434 to .env, then pick exactly one
+# of the cpu or gpu profiles:
+#
+# docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile cpu up -d
+# docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile gpu up -d
+#
+# Pull the starter model once (Ollama must already be running):
+#
+# docker compose -f docker-compose.prod.yml -f docker-compose.ollama.yml --profile setup run --rm model-setup
+#
+# Ollama is not published to the host: only the app reaches it, over the
+# Compose network as ollama:11434.
services:
- # Main Sim Application
simstudio:
- env_file:
- - path: .env
- required: false
- build:
- context: .
- dockerfile: docker/app.Dockerfile
- ports:
- - '3000:3000'
- deploy:
- resources:
- limits:
- memory: 8G
environment:
- - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
- - BETTER_AUTH_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
- - NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
- - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-sim_auth_secret_$(openssl rand -hex 16)}
- - ENCRYPTION_KEY=${ENCRYPTION_KEY:-$(openssl rand -hex 32)}
- - COPILOT_API_KEY=${COPILOT_API_KEY}
- - MSHIP_SYSPROMPT_OVERRIDE=${MSHIP_SYSPROMPT_OVERRIDE:-}
- - NEXT_PUBLIC_CHAT_DISABLED=${NEXT_PUBLIC_CHAT_DISABLED:-}
- - SIM_AGENT_API_URL=${SIM_AGENT_API_URL}
- - OLLAMA_URL=http://ollama:11434
- - NEXT_PUBLIC_SOCKET_URL=${NEXT_PUBLIC_SOCKET_URL:-}
- # Lets a workflow reach a service on the Docker host. Reaching it also
- # requires naming it in EGRESS_ALLOWED_HOSTS; this only makes the name
- # resolve, which it does not on Linux by default.
- extra_hosts:
- - 'host.docker.internal:host-gateway'
- depends_on:
- db:
- condition: service_healthy
- migrations:
- condition: service_completed_successfully
- realtime:
- condition: service_healthy
- healthcheck:
- test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3000']
- interval: 90s
- timeout: 5s
- retries: 3
- start_period: 10s
- restart: unless-stopped
+ # Required in .env rather than hardcoded here, so a run of the base file
+ # alone (the sim CLI's `update`) still points the app at Ollama. Both
+ # Ollama services answer to the network name `ollama`.
+ - 'OLLAMA_URL=${OLLAMA_URL:?set OLLAMA_URL=http://ollama:11434 in .env}'
- # Realtime Socket Server
- realtime:
- build:
- context: .
- dockerfile: docker/realtime.Dockerfile
- environment:
- - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
- - NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
- - BETTER_AUTH_URL=${BETTER_AUTH_URL:-http://localhost:3000}
- - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-sim_auth_secret_$(openssl rand -hex 16)}
- depends_on:
- db:
- condition: service_healthy
- restart: unless-stopped
- ports:
- - '3002:3002'
- deploy:
- resources:
- limits:
- memory: 1G
- healthcheck:
- test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3002/health']
- interval: 90s
- timeout: 5s
- retries: 3
- start_period: 10s
-
- # Database Migrations
- migrations:
- build:
- context: .
- dockerfile: docker/db.Dockerfile
- environment:
- - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
- # Seals account tokens stored before sealing was on; a no-op until ENCRYPTION_KEY is
- # 64 hex characters. ENCRYPT_ACCOUNT_TOKENS=false opts out here and on the app.
- - ENCRYPTION_KEY=${ENCRYPTION_KEY:-}
- - ENCRYPT_ACCOUNT_TOKENS=${ENCRYPT_ACCOUNT_TOKENS:-}
- depends_on:
- db:
- condition: service_healthy
- command: ['bun', 'run', 'db:migrate']
- restart: 'no'
-
- # PostgreSQL Database with Vector Extension.
- # Not published to the host: the other services reach it over the Compose
- # network as db:5432. A host `ports:` mapping binds every interface, and the
- # password below defaults to a well-known value. For host access use
- # `docker compose exec db psql -U postgres simstudio`.
- db:
- image: pgvector/pgvector:pg17
- restart: always
- environment:
- - POSTGRES_USER=${POSTGRES_USER:-postgres}
- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- - POSTGRES_DB=${POSTGRES_DB:-simstudio}
- volumes:
- - postgres_data:/var/lib/postgresql/data
- healthcheck:
- test: ['CMD-SHELL', 'pg_isready -U postgres']
- interval: 5s
- timeout: 5s
- retries: 5
-
- # Ollama with GPU support (default)
+ # NVIDIA GPU (needs the NVIDIA Container Toolkit on the host).
ollama:
profiles:
- gpu
image: ollama/ollama:latest
- pull_policy: always
+ restart: unless-stopped
volumes:
- ollama_data:/root/.ollama
- ports:
- - '11434:11434'
environment:
- - NVIDIA_DRIVER_CAPABILITIES=all
- - OLLAMA_LOAD_TIMEOUT=-1
- - OLLAMA_KEEP_ALIVE=-1
- - OLLAMA_DEBUG=1
- OLLAMA_HOST=0.0.0.0:11434
- command: 'serve'
+ - OLLAMA_KEEP_ALIVE=-1
+ - NVIDIA_DRIVER_CAPABILITIES=all
deploy:
resources:
reservations:
@@ -141,57 +47,39 @@ services:
timeout: 5s
retries: 5
start_period: 30s
- restart: unless-stopped
- # Ollama CPU-only version (use with --profile cpu profile)
ollama-cpu:
profiles:
- cpu
image: ollama/ollama:latest
- pull_policy: always
+ restart: unless-stopped
volumes:
- ollama_data:/root/.ollama
- ports:
- - '11434:11434'
environment:
- - OLLAMA_LOAD_TIMEOUT=-1
- - OLLAMA_KEEP_ALIVE=-1
- - OLLAMA_DEBUG=1
- OLLAMA_HOST=0.0.0.0:11434
- command: 'serve'
+ - OLLAMA_KEEP_ALIVE=-1
healthcheck:
test: ['CMD', 'ollama', 'list']
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
- restart: unless-stopped
networks:
default:
aliases:
- ollama
- # Helper container to pull models automatically
+ # One-shot: waits for the running Ollama server and pulls the starter model
+ # into its volume through the API.
model-setup:
- image: ollama/ollama:latest
profiles:
- setup
- volumes:
- - ollama_data:/root/.ollama
+ image: ollama/ollama:latest
+ restart: 'no'
environment:
- OLLAMA_HOST=ollama:11434
- entrypoint: ["/bin/sh", "-lc"]
- command: >
- sh -c "
- echo 'Waiting for Ollama to be ready...' &&
- until ollama list >/dev/null 2>&1; do echo 'Waiting for Ollama...'; sleep 2; done &&
- echo 'Pulling gemma3:4b model (recommended starter model)...' &&
- ollama pull gemma3:4b &&
- echo 'Model setup complete! You can now use gemma3:4b in Sim.' &&
- echo 'To add more models, run: docker compose -f docker-compose.ollama.yml exec ollama ollama pull '
- "
- restart: 'no'
+ entrypoint: ['/bin/sh', '-c']
+ command: ['until ollama list >/dev/null 2>&1; do sleep 2; done && ollama pull gemma3:4b']
volumes:
- postgres_data:
ollama_data:
diff --git a/helm/sim/Chart.yaml b/helm/sim/Chart.yaml
index 68c47a6aecc..ce00115776d 100644
--- a/helm/sim/Chart.yaml
+++ b/helm/sim/Chart.yaml
@@ -2,7 +2,7 @@ apiVersion: v2
name: sim
description: A Helm chart for Sim - the open-source AI workspace where teams build, deploy, and manage AI agents
type: application
-version: 1.12.0
+version: 1.13.0
appVersion: "v0.8.26"
kubeVersion: ">=1.25.0-0"
home: https://sim.ai
diff --git a/helm/sim/README.md b/helm/sim/README.md
index cf263134c45..7c013d3a3b5 100644
--- a/helm/sim/README.md
+++ b/helm/sim/README.md
@@ -57,7 +57,6 @@ Optional components (off by default):
* **`networkPolicy`** — east-west and egress isolation (blocks cloud metadata endpoints by default).
* **`hpa`** — HorizontalPodAutoscaler for `app` and `realtime`.
* **`podDisruptionBudget`** — auto-activates when `replicaCount > 1`.
-* **`servicemonitor`** — Prometheus Operator integration.
---
@@ -72,7 +71,6 @@ Optional components (off by default):
| cert-manager | Only if you want auto-issued TLS certificates. See [cert-manager docs](https://cert-manager.io/docs/). |
| metrics-server | Only if `autoscaling.enabled=true` (HPA needs metrics). |
| External Secrets Operator | Only if `externalSecrets.enabled=true`. See [ESO docs](https://external-secrets.io/). |
-| Prometheus Operator | Only if `monitoring.serviceMonitor.enabled=true`. |
| Namespace PSS labels | Recommended: `pod-security.kubernetes.io/enforce=restricted`. The chart's pod and container security contexts are PSS-restricted by default. |
---
@@ -235,12 +233,14 @@ helm upgrade sim oci://ghcr.io/simstudioai/charts/sim --version 1.9.5 --namespac
helm uninstall sim --namespace sim
```
-**PVCs are not deleted by `helm uninstall`.** If you want to wipe data too:
+**The Postgres PVCs are not deleted by `helm uninstall`** (they come from StatefulSet volume claim templates). The Ollama PVC is a chart-managed resource, so `helm uninstall` deletes it along with its downloaded models. If you want to wipe the remaining data too:
```bash
-# WARNING: this destroys all Postgres, Ollama, and shared-storage data.
+# WARNING: this destroys all remaining Postgres data. The second selector term
+# spares shared-storage PVCs kept with helm.sh/resource-policy=keep when
+# upgrading past chart 1.13; drop it to delete those too.
kubectl delete pvc --namespace sim \
- -l app.kubernetes.io/instance=sim
+ -l 'app.kubernetes.io/instance=sim,sim.ai/volume-type!=shared-storage'
# Or list and delete by name
kubectl get pvc --namespace sim
@@ -259,7 +259,7 @@ Pre-built values files for common scenarios live in [`helm/sim/examples/`](https
| File | When to use |
|---|---|
| `values-development.yaml` | Local dev / `kind` / `minikube`. Minimal resources, no TLS. |
-| `values-production.yaml` | Generic production: HA, network policy, autoscaling, monitoring. |
+| `values-production.yaml` | Generic production: HA, network policy, autoscaling. |
| `values-aws.yaml` | EKS — EBS GP3 storage, ALB ingress, IRSA-friendly. |
| `values-aws-marketplace.yaml` | EKS from the AWS Marketplace listing — Sim's images only, RDS + ElastiCache, Enterprise from the Marketplace license. |
| `values-gcp.yaml` | GKE — Persistent Disk storage, GCP managed certs, Workload Identity. |
@@ -436,14 +436,13 @@ See `examples/values-external-secrets.yaml`.
## Persistence
-Postgres, Ollama, and any configured `sharedStorage.volumes[]` use PersistentVolumeClaims. PVCs **survive `helm uninstall`** — see [Uninstalling](#uninstalling) for full cleanup.
+Postgres and Ollama use PersistentVolumeClaims. The Postgres PVCs (from StatefulSet volume claim templates) **survive `helm uninstall`**; the Ollama PVC does not, so `helm uninstall` deletes it and its downloaded models. See [Uninstalling](#uninstalling) for full cleanup.
| Component | Default size | Access mode | Storage class |
|---|---|---|---|
| `postgresql` | 10Gi | `ReadWriteOnce` | `global.storageClass` |
| `copilot.postgresql` | 10Gi | `ReadWriteOnce` | `global.storageClass` |
| `ollama` | 100Gi | `ReadWriteOnce` | `global.storageClass` |
-| `sharedStorage.volumes[]` | user-defined | `ReadWriteMany` recommended | `sharedStorage.storageClass` |
For production, use a `StorageClass` with `reclaimPolicy: Retain` on database volumes.
@@ -514,19 +513,6 @@ When `autoscaling.enabled=true`, the chart omits `spec.replicas` from the Deploy
---
-## Monitoring
-
-```yaml
-monitoring:
- serviceMonitor:
- enabled: true
- interval: 30s
-```
-
-Requires the Prometheus Operator CRDs. Scrapes `/metrics` on the app and realtime services — note the default images do not currently expose a `/metrics` endpoint, so enable this only with a build that does.
-
----
-
## PII redaction
Sim can redact personally identifiable information using a [Presidio](https://microsoft.github.io/presidio/) service (analyzer + anonymizer combined into one image listening on port 5001). Enable it with:
diff --git a/helm/sim/ci/full-values.yaml b/helm/sim/ci/full-values.yaml
index bc74f63339a..1b53066ce26 100644
--- a/helm/sim/ci/full-values.yaml
+++ b/helm/sim/ci/full-values.yaml
@@ -34,10 +34,6 @@ networkPolicy:
autoscaling:
enabled: true
-monitoring:
- serviceMonitor:
- enabled: true
-
telemetry:
enabled: true
jaeger:
@@ -47,9 +43,6 @@ telemetry:
otlp:
enabled: true
-sharedStorage:
- enabled: true
-
ollama:
enabled: true
diff --git a/helm/sim/examples/values-external-db.yaml b/helm/sim/examples/values-external-db.yaml
index a7c8bef2d55..a70f7a19271 100644
--- a/helm/sim/examples/values-external-db.yaml
+++ b/helm/sim/examples/values-external-db.yaml
@@ -150,7 +150,7 @@ ingress:
enabled: true
secretName: simstudio-tls-secret
-# Production-ready features (autoscaling, monitoring, etc.)
+# Production-ready features (autoscaling, disruption budgets, network policy)
autoscaling:
enabled: true
# Realtime scales with the app because Redis is available by default. Set this
@@ -168,13 +168,6 @@ podDisruptionBudget:
minAvailable: null
maxUnavailable: 1
unhealthyPodEvictionPolicy: AlwaysAllow
-monitoring:
- serviceMonitor:
- enabled: true
- labels:
- monitoring: "prometheus"
- interval: 15s
-
networkPolicy:
enabled: true
# `networkPolicy.egress` is a LIST of NetworkPolicy egress rules. With the
diff --git a/helm/sim/examples/values-production.yaml b/helm/sim/examples/values-production.yaml
index a6f2bc51cb1..b8b50570dcb 100644
--- a/helm/sim/examples/values-production.yaml
+++ b/helm/sim/examples/values-production.yaml
@@ -1,15 +1,14 @@
# values-production.yaml
#
# When to use: generic production deployment on any cluster. Enables HA
-# (replicaCount > 1, PDB), NetworkPolicy, HPA, ServiceMonitor, and
-# PSS-restricted security defaults.
+# (replicaCount > 1, PDB), NetworkPolicy, HPA, and PSS-restricted security
+# defaults.
#
# Prerequisites:
# - A premium StorageClass with reclaimPolicy: Retain
# - cert-manager (for TLS) or pre-provisioned certs
# - ingress-nginx (or equivalent) for ingress
# - metrics-server in the cluster (HPA)
-# - (recommended) Prometheus Operator for ServiceMonitor
# - (recommended) External Secrets Operator — see values-external-secrets.yaml
#
# Install:
@@ -216,33 +215,10 @@ podDisruptionBudget:
maxUnavailable: 1
unhealthyPodEvictionPolicy: AlwaysAllow
-# Monitoring integration with Prometheus
-monitoring:
- serviceMonitor:
- enabled: true
- labels:
- monitoring: "prometheus"
- interval: 15s
- scrapeTimeout: 10s
-
# Network policies (restricts pod-to-pod communication for security)
networkPolicy:
enabled: true
-# Shared storage for data sharing between pods (enterprise feature)
-sharedStorage:
- enabled: true
- storageClass: "managed-csi-premium"
- volumes:
- - name: output-share
- size: 100Gi
- accessModes:
- - ReadWriteMany
- - name: model-share
- size: 200Gi
- accessModes:
- - ReadWriteMany
-
# Telemetry and observability (comprehensive monitoring and tracing)
telemetry:
enabled: true
diff --git a/helm/sim/templates/removed-values.yaml b/helm/sim/templates/removed-values.yaml
new file mode 100644
index 00000000000..e119b607bdf
--- /dev/null
+++ b/helm/sim/templates/removed-values.yaml
@@ -0,0 +1,8 @@
+{{- /*
+Fail fast on values for features removed from the chart, when silently
+ignoring them would destroy data on upgrade.
+*/ -}}
+{{- $sharedStorage := .Values.sharedStorage | default dict }}
+{{- if and (dig "enabled" false $sharedStorage) (not (empty (dig "volumes" list $sharedStorage))) }}
+{{- fail (printf "sharedStorage was removed in chart 1.13: the chart created these PVCs but never mounted them, and upgrading would delete them. If you mount them through extraVolumes, first run: kubectl annotate pvc -n %s -l app.kubernetes.io/instance=%s,sim.ai/volume-type=shared-storage helm.sh/resource-policy=keep, then set sharedStorage.enabled=false." .Release.Namespace .Release.Name) }}
+{{- end }}
diff --git a/helm/sim/templates/servicemonitor.yaml b/helm/sim/templates/servicemonitor.yaml
deleted file mode 100644
index 5afeca19f51..00000000000
--- a/helm/sim/templates/servicemonitor.yaml
+++ /dev/null
@@ -1,79 +0,0 @@
-{{- if .Values.monitoring.serviceMonitor.enabled }}
----
-# ServiceMonitor for main application
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- name: {{ include "sim.fullname" . }}-app
- namespace: {{ .Release.Namespace }}
- labels:
- {{- include "sim.app.labels" . | nindent 4 }}
- {{- with .Values.monitoring.serviceMonitor.labels }}
- {{- toYaml . | nindent 4 }}
- {{- end }}
- {{- with .Values.monitoring.serviceMonitor.annotations }}
- annotations:
- {{- toYaml . | nindent 4 }}
- {{- end }}
-spec:
- selector:
- matchLabels:
- {{- include "sim.app.selectorLabels" . | nindent 6 }}
- endpoints:
- - port: http
- path: {{ .Values.monitoring.serviceMonitor.path }}
- interval: {{ .Values.monitoring.serviceMonitor.interval }}
- scrapeTimeout: {{ .Values.monitoring.serviceMonitor.scrapeTimeout }}
- {{- with .Values.monitoring.serviceMonitor.metricRelabelings }}
- metricRelabelings:
- {{- toYaml . | nindent 6 }}
- {{- end }}
- {{- with .Values.monitoring.serviceMonitor.relabelings }}
- relabelings:
- {{- toYaml . | nindent 6 }}
- {{- end }}
- {{- if .Values.monitoring.serviceMonitor.targetLabels }}
- targetLabels:
- {{- toYaml .Values.monitoring.serviceMonitor.targetLabels | nindent 4 }}
- {{- end }}
-{{- end }}
-
-{{- if and .Values.monitoring.serviceMonitor.enabled .Values.realtime.enabled }}
----
-# ServiceMonitor for realtime service
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- name: {{ include "sim.fullname" . }}-realtime
- namespace: {{ .Release.Namespace }}
- labels:
- {{- include "sim.realtime.labels" . | nindent 4 }}
- {{- with .Values.monitoring.serviceMonitor.labels }}
- {{- toYaml . | nindent 4 }}
- {{- end }}
- {{- with .Values.monitoring.serviceMonitor.annotations }}
- annotations:
- {{- toYaml . | nindent 4 }}
- {{- end }}
-spec:
- selector:
- matchLabels:
- {{- include "sim.realtime.selectorLabels" . | nindent 6 }}
- endpoints:
- - port: http
- path: {{ .Values.monitoring.serviceMonitor.path }}
- interval: {{ .Values.monitoring.serviceMonitor.interval }}
- scrapeTimeout: {{ .Values.monitoring.serviceMonitor.scrapeTimeout }}
- {{- with .Values.monitoring.serviceMonitor.metricRelabelings }}
- metricRelabelings:
- {{- toYaml . | nindent 6 }}
- {{- end }}
- {{- with .Values.monitoring.serviceMonitor.relabelings }}
- relabelings:
- {{- toYaml . | nindent 6 }}
- {{- end }}
- {{- if .Values.monitoring.serviceMonitor.targetLabels }}
- targetLabels:
- {{- toYaml .Values.monitoring.serviceMonitor.targetLabels | nindent 4 }}
- {{- end }}
-{{- end }}
\ No newline at end of file
diff --git a/helm/sim/templates/shared-storage.yaml b/helm/sim/templates/shared-storage.yaml
deleted file mode 100644
index 509af403c5a..00000000000
--- a/helm/sim/templates/shared-storage.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
-{{- if .Values.sharedStorage.enabled }}
-{{- range .Values.sharedStorage.volumes }}
----
-# Shared Storage PVC for {{ .name }}
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: {{ include "sim.fullname" $ }}-{{ .name }}
- namespace: {{ $.Release.Namespace }}
- labels:
- {{- include "sim.labels" $ | nindent 4 }}
- sim.ai/volume-type: shared-storage
- sim.ai/volume-name: {{ .name }}
- {{- with .annotations }}
- annotations:
- {{- toYaml . | nindent 4 }}
- {{- end }}
-spec:
- {{- if .storageClass }}
- {{- if (eq "-" .storageClass) }}
- storageClassName: ""
- {{- else }}
- storageClassName: {{ .storageClass | quote }}
- {{- end }}
- {{- else if $.Values.sharedStorage.storageClass }}
- storageClassName: {{ $.Values.sharedStorage.storageClass | quote }}
- {{- else if $.Values.global.storageClass }}
- storageClassName: {{ $.Values.global.storageClass | quote }}
- {{- end }}
- accessModes:
- {{- if .accessModes }}
- {{- range .accessModes }}
- - {{ . | quote }}
- {{- end }}
- {{- else }}
- {{- range $.Values.sharedStorage.defaultAccessModes }}
- - {{ . | quote }}
- {{- end }}
- {{- end }}
- resources:
- requests:
- storage: {{ .size | quote }}
- {{- if .selector }}
- selector:
- {{- toYaml .selector | nindent 4 }}
- {{- end }}
-{{- end }}
-{{- end }}
\ No newline at end of file
diff --git a/helm/sim/tests/removed-values_test.yaml b/helm/sim/tests/removed-values_test.yaml
new file mode 100644
index 00000000000..f354e662f5e
--- /dev/null
+++ b/helm/sim/tests/removed-values_test.yaml
@@ -0,0 +1,37 @@
+suite: removed values — fail before an upgrade deletes data
+templates:
+ - removed-values.yaml
+release:
+ name: t
+ namespace: sim
+
+tests:
+ - it: fails when sharedStorage is still enabled, naming the PVC selector to protect
+ set:
+ sharedStorage:
+ enabled: true
+ volumes:
+ - name: output-share
+ size: 100Gi
+ asserts:
+ - failedTemplate:
+ errorMessage: "sharedStorage was removed in chart 1.13: the chart created these PVCs but never mounted them, and upgrading would delete them. If you mount them through extraVolumes, first run: kubectl annotate pvc -n sim -l app.kubernetes.io/instance=t,sim.ai/volume-type=shared-storage helm.sh/resource-policy=keep, then set sharedStorage.enabled=false."
+
+ - it: renders when an older values file keeps sharedStorage disabled
+ set:
+ sharedStorage:
+ enabled: false
+ storageClass: ""
+ volumes: []
+ asserts:
+ - hasDocuments:
+ count: 0
+
+ - it: renders when sharedStorage is enabled but declares no volumes, since no PVCs exist to lose
+ set:
+ sharedStorage:
+ enabled: true
+ volumes: []
+ asserts:
+ - hasDocuments:
+ count: 0
diff --git a/helm/sim/values.schema.json b/helm/sim/values.schema.json
index 3ca3c103166..c0b49a44c17 100644
--- a/helm/sim/values.schema.json
+++ b/helm/sim/values.schema.json
@@ -885,34 +885,6 @@
"resources": { "type": "object" }
}
},
- "sharedStorage": {
- "type": "object",
- "properties": {
- "enabled": {
- "type": "boolean",
- "description": "Enable shared storage"
- },
- "volumes": {
- "type": "array",
- "items": {
- "type": "object",
- "required": ["name", "size"],
- "properties": {
- "name": {
- "type": "string",
- "minLength": 1,
- "description": "Volume name"
- },
- "size": {
- "type": "string",
- "pattern": "^[0-9]+[KMGT]i$",
- "description": "Volume size (e.g., 100Gi)"
- }
- }
- }
- }
- }
- },
"copilot": {
"type": "object",
"properties": {
@@ -1262,7 +1234,7 @@
},
"monitoring": {
"type": "object",
- "description": "Prometheus Operator ServiceMonitor configuration"
+ "description": "Removed in chart 1.13 and ignored; still accepted so older values files validate."
},
"networkPolicy": {
"type": "object",
@@ -1284,6 +1256,10 @@
"type": "object",
"description": "ServiceAccount creation, name, and annotations (e.g. Workload Identity)"
},
+ "sharedStorage": {
+ "type": "object",
+ "description": "Removed in chart 1.13; still accepted so older values files validate, but enabled=true with volumes fails the render (see templates/removed-values.yaml)."
+ },
"tolerations": {
"type": "array",
"description": "Tolerations applied to app and realtime pods"
diff --git a/helm/sim/values.yaml b/helm/sim/values.yaml
index 72ef1268632..5d1ac9cafed 100644
--- a/helm/sim/values.yaml
+++ b/helm/sim/values.yaml
@@ -1160,31 +1160,6 @@ podDisruptionBudget:
# Set to null to use K8s default (IfHealthyBudget)
unhealthyPodEvictionPolicy: null
-# Prometheus monitoring integration.
-# Creates a ServiceMonitor CR scraped by the Prometheus Operator. Requires
-# the kube-prometheus-stack (or prometheus-operator) CRDs to be installed
-# in the cluster — otherwise the manifest is rejected by the API server.
-monitoring:
- # ServiceMonitor for Prometheus
- serviceMonitor:
- enabled: false
- # Additional labels for ServiceMonitor
- labels: {}
- # Additional annotations for ServiceMonitor
- annotations: {}
- # Metrics path
- path: /metrics
- # Scrape interval
- interval: 30s
- # Scrape timeout
- scrapeTimeout: 10s
- # Target labels to be added to scraped metrics
- targetLabels: []
- # Metric relabeling configurations
- metricRelabelings: []
- # Relabeling configurations
- relabelings: []
-
# NetworkPolicy for east-west and egress isolation.
# When enabled, the chart creates policies that allow Sim components to talk
# to each other and to required external services (DNS, HTTPS) while blocking
@@ -1233,36 +1208,6 @@ networkPolicy:
# selector and do not need it.
allowExternalEgress: false
-# Shared storage for enterprise workflows requiring data sharing between pods
-sharedStorage:
- enabled: false
- # Storage class for shared volumes (must support ReadWriteMany access)
- storageClass: ""
- # Default access modes for shared volumes (ReadWriteMany required for multi-pod access)
- defaultAccessModes:
- - ReadWriteMany
- # Define shared volumes for your workflows (uncomment and customize as needed)
- # Example volume configurations:
- # volumes:
- # - name: output-share
- # size: 100Gi
- # accessModes:
- # - ReadWriteMany
- # annotations: {}
- # - name: rawdata-share
- # size: 500Gi
- # accessModes:
- # - ReadWriteMany
- # - name: model-share
- # size: 200Gi
- # accessModes:
- # - ReadWriteMany
- # - name: logs-share
- # size: 50Gi
- # accessModes:
- # - ReadWriteMany
- volumes: []
-
# Additional volumes for custom configurations (advanced users)
extraVolumes: []
extraVolumeMounts: []
diff --git a/packages/db/migrations/0468_retire_legacy_search_and_contracts.sql b/packages/db/migrations/0468_retire_legacy_search_and_contracts.sql
new file mode 100644
index 00000000000..0efd7c9e6cc
--- /dev/null
+++ b/packages/db/migrations/0468_retire_legacy_search_and_contracts.sql
@@ -0,0 +1,86 @@
+-- Contracts expand/contract migrations whose readers and writers are gone from every deployed release.
+-- workspace_file_search_mark_pending() is redefined first, without its legacy enqueue, so no trigger
+-- writes workspace_file_search_dispatch_queue once that table is dropped. Each drop then autocommits
+-- under a short lock timeout: a table drop takes ACCESS EXCLUSIVE on every FK parent, so a busy parent
+-- fails fast for migrate.ts to retry rather than queue traffic behind it. organization.whitelabel_settings
+-- is only un-declared here; its DROP COLUMN waits for the next release (contract-pending marker in schema.ts).
+CREATE OR REPLACE FUNCTION workspace_file_search_mark_pending()
+RETURNS trigger LANGUAGE plpgsql AS $$
+DECLARE owner_type text; owner_id text;
+BEGIN
+ IF TG_OP = 'DELETE' THEN
+ UPDATE workspace_file_search_build SET expires_at = now()
+ WHERE id = (SELECT build_id FROM workspace_file_search_revision WHERE file_id = OLD.id);
+ owner_type := CASE WHEN OLD.project_id IS NOT NULL THEN 'project' WHEN OLD.context IN ('workspace', 'test', 'changelog') THEN 'workspace' END;
+ owner_id := coalesce(OLD.project_id, OLD.workspace_id);
+ IF owner_type IN ('workspace', 'project') AND (OLD.context = owner_type OR (owner_type = 'workspace' AND OLD.context IN ('test', 'changelog'))) AND owner_id IS NOT NULL THEN
+ INSERT INTO file_search_dispatch_queue (entity_type, entity_id) VALUES (owner_type, owner_id)
+ ON CONFLICT (entity_type, entity_id) DO UPDATE SET updated_at = now();
+ END IF;
+ RETURN OLD;
+ END IF;
+ IF TG_OP = 'UPDATE' THEN
+ IF ROW(NEW.content_updated_at, NEW.deleted_at, NEW.context, NEW.workspace_id, NEW.project_id)
+ IS NOT DISTINCT FROM ROW(OLD.content_updated_at, OLD.deleted_at, OLD.context, OLD.workspace_id, OLD.project_id) THEN
+ RETURN NEW;
+ END IF;
+ UPDATE workspace_file_search_build SET expires_at = now()
+ WHERE id = (SELECT build_id FROM workspace_file_search_revision WHERE file_id = NEW.id);
+ DELETE FROM workspace_file_search_revision WHERE file_id = NEW.id;
+ IF ROW(NEW.context, NEW.workspace_id, NEW.project_id)
+ IS DISTINCT FROM ROW(OLD.context, OLD.workspace_id, OLD.project_id) THEN
+ owner_type := CASE WHEN OLD.project_id IS NOT NULL THEN 'project' WHEN OLD.context IN ('workspace', 'test', 'changelog') THEN 'workspace' END;
+ owner_id := coalesce(OLD.project_id, OLD.workspace_id);
+ IF owner_type IN ('workspace', 'project') AND (OLD.context = owner_type OR (owner_type = 'workspace' AND OLD.context IN ('test', 'changelog'))) AND owner_id IS NOT NULL THEN
+ INSERT INTO file_search_dispatch_queue (entity_type, entity_id) VALUES (owner_type, owner_id)
+ ON CONFLICT (entity_type, entity_id) DO UPDATE SET updated_at = now();
+ END IF;
+ END IF;
+ END IF;
+ owner_type := CASE WHEN NEW.project_id IS NOT NULL THEN 'project' WHEN NEW.context IN ('workspace', 'test', 'changelog') THEN 'workspace' END;
+ owner_id := coalesce(NEW.project_id, NEW.workspace_id);
+ IF owner_type IN ('workspace', 'project') AND (NEW.context = owner_type OR (owner_type = 'workspace' AND NEW.context IN ('test', 'changelog'))) AND owner_id IS NOT NULL THEN
+ -- Waking the owner also reconciles bounded dependent builds without rewriting their sources here.
+ INSERT INTO file_search_dispatch_queue (entity_type, entity_id) VALUES (owner_type, owner_id)
+ ON CONFLICT (entity_type, entity_id) DO UPDATE SET updated_at = now();
+ IF NEW.deleted_at IS NULL AND NEW.context = owner_type THEN
+ INSERT INTO workspace_file_search_revision (file_id, workspace_id, entity_type, entity_id, source_content_updated_at)
+ VALUES (NEW.id, NEW.workspace_id, owner_type, owner_id, NEW.content_updated_at)
+ ON CONFLICT (file_id) DO NOTHING;
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$;--> statement-breakpoint
+COMMIT;--> statement-breakpoint
+SET lock_timeout = '100ms';--> statement-breakpoint
+-- migration-safe: contract of 0409 (shipped in v0.9.20): settings.show_training_controls and copilot_enabled_models are declared by no released schema and read by no code.
+ALTER TABLE "settings" DROP COLUMN IF EXISTS "show_training_controls";--> statement-breakpoint
+-- migration-safe: contract of 0409 (shipped in v0.9.20): settings.copilot_enabled_models is declared by no released schema and read by no code.
+ALTER TABLE "settings" DROP COLUMN IF EXISTS "copilot_enabled_models";--> statement-breakpoint
+-- migration-safe: contract of 0409 (shipped in v0.9.20): copilot_chats.plan_artifact is declared by no released schema; the plan artifact lives in the message transcript.
+ALTER TABLE "copilot_chats" DROP COLUMN IF EXISTS "plan_artifact";--> statement-breakpoint
+-- migration-safe: contract of 0409 (shipped in v0.9.20): copilot_messages.parent_message_id is declared by no released schema and was never read or written.
+ALTER TABLE "copilot_messages" DROP COLUMN IF EXISTS "parent_message_id";--> statement-breakpoint
+-- migration-safe: contract of 0409 (shipped in v0.9.20): copilot_messages.tokens_in is declared by no released schema and was never read or written.
+ALTER TABLE "copilot_messages" DROP COLUMN IF EXISTS "tokens_in";--> statement-breakpoint
+-- migration-safe: contract of 0409 (shipped in v0.9.20): copilot_messages.tokens_out is declared by no released schema and was never read or written.
+ALTER TABLE "copilot_messages" DROP COLUMN IF EXISTS "tokens_out";--> statement-breakpoint
+-- migration-safe: no released app code reads or writes the waitlist table.
+DROP TABLE IF EXISTS "waitlist";--> statement-breakpoint
+-- migration-safe: contract of 0426 (shipped in v0.9.22): released dispatchers read only file_search_dispatch_queue, and the trigger redefined above no longer enqueues here.
+DROP TABLE IF EXISTS "workspace_file_search_dispatch_queue";--> statement-breakpoint
+-- migration-safe: contract of 0359 (shipped in v0.8.43): chunk search (workspace_file_search_revision/chunk) replaced the legacy index; no released app code or trigger reads or writes it.
+DROP TABLE IF EXISTS "workspace_file_search_index";--> statement-breakpoint
+-- migration-safe: contract of 0359 (shipped in v0.8.43): chunk search replaced the legacy segments; no released app code or trigger reads or writes them.
+DROP TABLE IF EXISTS "workspace_file_search_segment";--> statement-breakpoint
+SET lock_timeout = 0;--> statement-breakpoint
+ALTER TABLE "workspace_file_search_build" VALIDATE CONSTRAINT "file_search_build_owner_check";--> statement-breakpoint
+ALTER TABLE "workspace_file_search_revision" VALIDATE CONSTRAINT "file_search_revision_owner_check";--> statement-breakpoint
+ALTER TABLE "workspace_file_search_chunk" VALIDATE CONSTRAINT "file_search_chunk_owner_check";--> statement-breakpoint
+ALTER TABLE "public_share" VALIDATE CONSTRAINT "public_share_entity_binding_check";--> statement-breakpoint
+ALTER TABLE "oauth_refresh_token" VALIDATE CONSTRAINT "oauth_refresh_token_search_resource_check";--> statement-breakpoint
+ALTER TABLE "oauth_access_token" VALIDATE CONSTRAINT "oauth_access_token_search_resource_check";--> statement-breakpoint
+-- migration-safe: personal-token inserts conflict on the organization-scoped identity index; no released query relies on the workspace-scoped one.
+DROP INDEX CONCURRENTLY IF EXISTS "credential_personal_token_identity_unique";--> statement-breakpoint
+SET lock_timeout = '5s';
diff --git a/packages/db/migrations/meta/0468_snapshot.json b/packages/db/migrations/meta/0468_snapshot.json
new file mode 100644
index 00000000000..47ad7d825dd
--- /dev/null
+++ b/packages/db/migrations/meta/0468_snapshot.json
@@ -0,0 +1,33836 @@
+{
+ "id": "a1b3663b-3dfd-49e3-827c-0fd434224001",
+ "prevId": "290a9786-74fe-45a6-83f4-654ec9be5d6f",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_config": {
+ "name": "oauth_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_revoked_at": {
+ "name": "refresh_revoked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_revoked_code": {
+ "name": "refresh_revoked_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_revoked_token_hash": {
+ "name": "refresh_revoked_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_user_id_idx": {
+ "name": "account_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_account_on_account_id_provider_id": {
+ "name": "idx_account_on_account_id_provider_id",
+ "columns": [
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity_rollup_blocked": {
+ "name": "activity_rollup_blocked",
+ "schema": "",
+ "columns": {
+ "bucket_start": {
+ "name": "bucket_start",
+ "type": "timestamp",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "retry_at": {
+ "name": "retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity_rollup_dirty": {
+ "name": "activity_rollup_dirty",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bucket_start": {
+ "name": "bucket_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "due_at": {
+ "name": "due_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "activity_rollup_dirty_due_at_idx": {
+ "name": "activity_rollup_dirty_due_at_idx",
+ "columns": [
+ {
+ "expression": "due_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "activity_rollup_dirty_workspace_id_bucket_start_pk": {
+ "name": "activity_rollup_dirty_workspace_id_bucket_start_pk",
+ "columns": ["workspace_id", "bucket_start"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity_rollup_inflight": {
+ "name": "activity_rollup_inflight",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bucket_start": {
+ "name": "bucket_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "next_check_at": {
+ "name": "next_check_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "activity_rollup_inflight_next_check_at_idx": {
+ "name": "activity_rollup_inflight_next_check_at_idx",
+ "columns": [
+ {
+ "expression": "next_check_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "activity_rollup_inflight_workspace_id_bucket_start_pk": {
+ "name": "activity_rollup_inflight_workspace_id_bucket_start_pk",
+ "columns": ["workspace_id", "bucket_start"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity_rollup_state": {
+ "name": "activity_rollup_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "coverage_start": {
+ "name": "coverage_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fresh_through": {
+ "name": "fresh_through",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backfill_completed_at": {
+ "name": "backfill_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_end_scan": {
+ "name": "last_end_scan",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_owner": {
+ "name": "lease_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "housekeeping_at": {
+ "name": "housekeeping_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "maintained_at": {
+ "name": "maintained_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_passes": {
+ "name": "failed_passes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "corrections_at": {
+ "name": "corrections_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_memory_turn": {
+ "name": "agent_memory_turn",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "memory_id": {
+ "name": "memory_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "block_id": {
+ "name": "block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "node_id": {
+ "name": "node_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_order": {
+ "name": "execution_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_state": {
+ "name": "encrypted_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_memory_turn_invocation_unique": {
+ "name": "agent_memory_turn_invocation_unique",
+ "columns": [
+ {
+ "expression": "memory_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "node_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_order",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_memory_turn_workflow_idx": {
+ "name": "agent_memory_turn_workflow_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_memory_turn_memory_id_memory_id_fk": {
+ "name": "agent_memory_turn_memory_id_memory_id_fk",
+ "tableFrom": "agent_memory_turn",
+ "tableTo": "memory",
+ "columnsFrom": ["memory_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_memory_turn_workflow_id_workflow_id_fk": {
+ "name": "agent_memory_turn_workflow_id_workflow_id_fk",
+ "tableFrom": "agent_memory_turn",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.api_key": {
+ "name": "api_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'personal'"
+ },
+ "access": {
+ "name": "access",
+ "type": "api_key_access",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'write'"
+ },
+ "last_used": {
+ "name": "last_used",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "api_key_workspace_type_idx": {
+ "name": "api_key_workspace_type_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "api_key_user_type_idx": {
+ "name": "api_key_user_type_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "api_key_key_hash_idx": {
+ "name": "api_key_key_hash_idx",
+ "columns": [
+ {
+ "expression": "key_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "api_key_user_id_user_id_fk": {
+ "name": "api_key_user_id_user_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "api_key_workspace_id_workspace_id_fk": {
+ "name": "api_key_workspace_id_workspace_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "api_key_created_by_user_id_fk": {
+ "name": "api_key_created_by_user_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "api_key_key_unique": {
+ "name": "api_key_key_unique",
+ "nullsNotDistinct": false,
+ "columns": ["key"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "workspace_type_check": {
+ "name": "workspace_type_check",
+ "value": "(type = 'workspace' AND workspace_id IS NOT NULL) OR (type = 'personal' AND workspace_id IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.assistant_tool_permission": {
+ "name": "assistant_tool_permission",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "read_policy": {
+ "name": "read_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'allow'"
+ },
+ "write_policy": {
+ "name": "write_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ask'"
+ },
+ "overrides": {
+ "name": "overrides",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "assistant_tool_permission_credential_idx": {
+ "name": "assistant_tool_permission_credential_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "assistant_tool_permission_user_idx": {
+ "name": "assistant_tool_permission_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "assistant_tool_permission_organization_id_organization_id_fk": {
+ "name": "assistant_tool_permission_organization_id_organization_id_fk",
+ "tableFrom": "assistant_tool_permission",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "assistant_tool_permission_user_id_user_id_fk": {
+ "name": "assistant_tool_permission_user_id_user_id_fk",
+ "tableFrom": "assistant_tool_permission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "assistant_tool_permission_credential_id_credential_id_fk": {
+ "name": "assistant_tool_permission_credential_id_credential_id_fk",
+ "tableFrom": "assistant_tool_permission",
+ "tableTo": "credential",
+ "columnsFrom": ["credential_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "assistant_tool_permission_organization_id_user_id_credential_id_pk": {
+ "name": "assistant_tool_permission_organization_id_user_id_credential_id_pk",
+ "columns": ["organization_id", "user_id", "credential_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "assistant_tool_permission_policy_check": {
+ "name": "assistant_tool_permission_policy_check",
+ "value": "\"assistant_tool_permission\".\"read_policy\" IN ('allow', 'ask', 'block') AND \"assistant_tool_permission\".\"write_policy\" IN ('allow', 'ask', 'block')"
+ },
+ "assistant_tool_permission_revision_check": {
+ "name": "assistant_tool_permission_revision_check",
+ "value": "\"assistant_tool_permission\".\"revision\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.async_jobs": {
+ "name": "async_jobs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_at": {
+ "name": "run_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "max_attempts": {
+ "name": "max_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 3
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output": {
+ "name": "output",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "async_jobs_status_started_at_idx": {
+ "name": "async_jobs_status_started_at_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "async_jobs_status_completed_at_idx": {
+ "name": "async_jobs_status_completed_at_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "completed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "async_jobs_schedule_pending_run_at_idx": {
+ "name": "async_jobs_schedule_pending_run_at_idx",
+ "columns": [
+ {
+ "expression": "run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "async_jobs_schedule_processing_started_at_idx": {
+ "name": "async_jobs_schedule_processing_started_at_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'processing'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "async_jobs_schedule_unreconciled_terminal_idx": {
+ "name": "async_jobs_schedule_unreconciled_terminal_idx",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" IN ('completed', 'failed', 'cancelled') AND COALESCE(\"async_jobs\".\"metadata\" ->> 'scheduleReconciled', 'false') <> 'true'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.audit_log": {
+ "name": "audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_email": {
+ "name": "actor_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_name": {
+ "name": "resource_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "audit_log_workspace_created_idx": {
+ "name": "audit_log_workspace_created_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_log_workspace_created_at_id_idx": {
+ "name": "audit_log_workspace_created_at_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date_trunc('milliseconds', \"created_at\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_log_actor_created_idx": {
+ "name": "audit_log_actor_created_idx",
+ "columns": [
+ {
+ "expression": "actor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_log_org_level_created_at_id_idx": {
+ "name": "audit_log_org_level_created_at_id_idx",
+ "columns": [
+ {
+ "expression": "(\"metadata\"->>'organizationId')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date_trunc('milliseconds', \"created_at\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"audit_log\".\"workspace_id\" IS NULL AND (\"audit_log\".\"metadata\"->>'organizationId') IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_log_resource_idx": {
+ "name": "audit_log_resource_idx",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_log_action_idx": {
+ "name": "audit_log_action_idx",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "audit_log_workspace_id_workspace_id_fk": {
+ "name": "audit_log_workspace_id_workspace_id_fk",
+ "tableFrom": "audit_log",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "audit_log_actor_id_user_id_fk": {
+ "name": "audit_log_actor_id_user_id_fk",
+ "tableFrom": "audit_log",
+ "tableTo": "user",
+ "columnsFrom": ["actor_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.aws_marketplace_license": {
+ "name": "aws_marketplace_license",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "license_arn": {
+ "name": "license_arn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "product_code": {
+ "name": "product_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "customer_aws_account_id": {
+ "name": "customer_aws_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agreement_id": {
+ "name": "agreement_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agreement_seen_at": {
+ "name": "agreement_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "renewed_agreement_id": {
+ "name": "renewed_agreement_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "aws_marketplace_license_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "dimension": {
+ "name": "dimension",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_verified_at": {
+ "name": "last_verified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_verification_attempt_at": {
+ "name": "last_verification_attempt_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "license_event_received_at": {
+ "name": "license_event_received_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_token_hash": {
+ "name": "claim_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_expires_at": {
+ "name": "claim_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_by_user_id": {
+ "name": "linked_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_linked_at": {
+ "name": "organization_linked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "company_name": {
+ "name": "company_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "aws_marketplace_license_arn_unique": {
+ "name": "aws_marketplace_license_arn_unique",
+ "columns": [
+ {
+ "expression": "license_arn",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_claim_token_hash_unique": {
+ "name": "aws_marketplace_license_claim_token_hash_unique",
+ "columns": [
+ {
+ "expression": "claim_token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_agreement_id_idx": {
+ "name": "aws_marketplace_license_agreement_id_idx",
+ "columns": [
+ {
+ "expression": "agreement_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_renewed_agreement_id_idx": {
+ "name": "aws_marketplace_license_renewed_agreement_id_idx",
+ "columns": [
+ {
+ "expression": "renewed_agreement_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_account_product_idx": {
+ "name": "aws_marketplace_license_account_product_idx",
+ "columns": [
+ {
+ "expression": "customer_aws_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "product_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_last_attempt_idx": {
+ "name": "aws_marketplace_license_last_attempt_idx",
+ "columns": [
+ {
+ "expression": "last_verification_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_organization_id_idx": {
+ "name": "aws_marketplace_license_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_license_linked_by_user_id_idx": {
+ "name": "aws_marketplace_license_linked_by_user_id_idx",
+ "columns": [
+ {
+ "expression": "linked_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "aws_marketplace_license_organization_id_organization_id_fk": {
+ "name": "aws_marketplace_license_organization_id_organization_id_fk",
+ "tableFrom": "aws_marketplace_license",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "aws_marketplace_license_linked_by_user_id_user_id_fk": {
+ "name": "aws_marketplace_license_linked_by_user_id_user_id_fk",
+ "tableFrom": "aws_marketplace_license",
+ "tableTo": "user",
+ "columnsFrom": ["linked_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.aws_marketplace_usage_report": {
+ "name": "aws_marketplace_usage_report",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "license_id": {
+ "name": "license_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dimension": {
+ "name": "dimension",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hour_start": {
+ "name": "hour_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "aws_marketplace_usage_report_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metering_record_id": {
+ "name": "metering_record_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reported_at": {
+ "name": "reported_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "aws_marketplace_usage_report_license_dimension_hour_unique": {
+ "name": "aws_marketplace_usage_report_license_dimension_hour_unique",
+ "columns": [
+ {
+ "expression": "license_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "dimension",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "hour_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_usage_report_status_hour_idx": {
+ "name": "aws_marketplace_usage_report_status_hour_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "hour_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "aws_marketplace_usage_report_organization_id_idx": {
+ "name": "aws_marketplace_usage_report_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "aws_marketplace_usage_report_organization_id_organization_id_fk": {
+ "name": "aws_marketplace_usage_report_organization_id_organization_id_fk",
+ "tableFrom": "aws_marketplace_usage_report",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "aws_marketplace_usage_report_license_id_aws_marketplace_license_id_fk": {
+ "name": "aws_marketplace_usage_report_license_id_aws_marketplace_license_id_fk",
+ "tableFrom": "aws_marketplace_usage_report",
+ "tableTo": "aws_marketplace_license",
+ "columnsFrom": ["license_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.aws_marketplace_usage_tally": {
+ "name": "aws_marketplace_usage_tally",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dimension": {
+ "name": "dimension",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_start": {
+ "name": "period_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counted_from": {
+ "name": "counted_from",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "units": {
+ "name": "units",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "aws_marketplace_usage_tally_organization_id_organization_id_fk": {
+ "name": "aws_marketplace_usage_tally_organization_id_organization_id_fk",
+ "tableFrom": "aws_marketplace_usage_tally",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "aws_marketplace_usage_tally_organization_id_dimension_period_start_pk": {
+ "name": "aws_marketplace_usage_tally_organization_id_dimension_period_start_pk",
+ "columns": ["organization_id", "dimension", "period_start"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.background_work_status": {
+ "name": "background_work_status",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "background_work_kind",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "background_work_status_value",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "background_work_status_workspace_status_idx": {
+ "name": "background_work_status_workspace_status_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "background_work_status_workflow_status_idx": {
+ "name": "background_work_status_workflow_status_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "background_work_status_meta_child_ws_idx": {
+ "name": "background_work_status_meta_child_ws_idx",
+ "columns": [
+ {
+ "expression": "(\"metadata\" ->> 'childWorkspaceId')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "background_work_status_meta_other_ws_idx": {
+ "name": "background_work_status_meta_other_ws_idx",
+ "columns": [
+ {
+ "expression": "(\"metadata\" ->> 'otherWorkspaceId')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "background_work_status_workspace_id_workspace_id_fk": {
+ "name": "background_work_status_workspace_id_workspace_id_fk",
+ "tableFrom": "background_work_status",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "background_work_status_workflow_id_workflow_id_fk": {
+ "name": "background_work_status_workflow_id_workflow_id_fk",
+ "tableFrom": "background_work_status",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.changelog_change": {
+ "name": "changelog_change",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "release_id": {
+ "name": "release_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "changelog_change_release_position_unique": {
+ "name": "changelog_change_release_position_unique",
+ "columns": [
+ {
+ "expression": "release_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "changelog_change_release_id_changelog_release_id_fk": {
+ "name": "changelog_change_release_id_changelog_release_id_fk",
+ "tableFrom": "changelog_change",
+ "tableTo": "changelog_release",
+ "columnsFrom": ["release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "changelog_change_workflow_id_workflow_id_fk": {
+ "name": "changelog_change_workflow_id_workflow_id_fk",
+ "tableFrom": "changelog_change",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "changelog_change_deployment_version_id_workflow_deployment_version_id_fk": {
+ "name": "changelog_change_deployment_version_id_workflow_deployment_version_id_fk",
+ "tableFrom": "changelog_change",
+ "tableTo": "workflow_deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "changelog_change_chat_id_copilot_chats_id_fk": {
+ "name": "changelog_change_chat_id_copilot_chats_id_fk",
+ "tableFrom": "changelog_change",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.changelog_release": {
+ "name": "changelog_release",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version_major": {
+ "name": "version_major",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version_minor": {
+ "name": "version_minor",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version_patch": {
+ "name": "version_patch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bump_reason": {
+ "name": "bump_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body_file_id": {
+ "name": "body_file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "changelog_release_workspace_version_unique": {
+ "name": "changelog_release_workspace_version_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version_major",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version_minor",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version_patch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "changelog_release_body_file_unique": {
+ "name": "changelog_release_body_file_unique",
+ "columns": [
+ {
+ "expression": "body_file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "changelog_release_workspace_published_idx": {
+ "name": "changelog_release_workspace_published_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "published_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "changelog_release_workspace_id_workspace_id_fk": {
+ "name": "changelog_release_workspace_id_workspace_id_fk",
+ "tableFrom": "changelog_release",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "changelog_release_body_file_id_workspace_files_id_fk": {
+ "name": "changelog_release_body_file_id_workspace_files_id_fk",
+ "tableFrom": "changelog_release",
+ "tableTo": "workspace_files",
+ "columnsFrom": ["body_file_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "changelog_release_created_by_user_id_fk": {
+ "name": "changelog_release_created_by_user_id_fk",
+ "tableFrom": "changelog_release",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "changelog_release_updated_by_user_id_fk": {
+ "name": "changelog_release_updated_by_user_id_fk",
+ "tableFrom": "changelog_release",
+ "tableTo": "user",
+ "columnsFrom": ["updated_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "changelog_release_version_check": {
+ "name": "changelog_release_version_check",
+ "value": "\"changelog_release\".\"version_major\" >= 0 AND \"changelog_release\".\"version_minor\" >= 0 AND \"changelog_release\".\"version_patch\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat": {
+ "name": "chat",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "customizations": {
+ "name": "customizations",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "auth_type": {
+ "name": "auth_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'public'"
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allowed_emails": {
+ "name": "allowed_emails",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'"
+ },
+ "output_configs": {
+ "name": "output_configs",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'"
+ },
+ "include_thinking": {
+ "name": "include_thinking",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "include_tool_calls": {
+ "name": "include_tool_calls",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "identifier_idx": {
+ "name": "identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"chat\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "chat_archived_at_partial_idx": {
+ "name": "chat_archived_at_partial_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"chat\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_chat_on_workflow_id_archived_at": {
+ "name": "idx_chat_on_workflow_id_archived_at",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "chat_user_id_idx": {
+ "name": "chat_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "chat_workflow_id_workflow_id_fk": {
+ "name": "chat_workflow_id_workflow_id_fk",
+ "tableFrom": "chat",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_user_id_user_id_fk": {
+ "name": "chat_user_id_user_id_fk",
+ "tableFrom": "chat",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.client_credential_token": {
+ "name": "client_credential_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "encrypted_value": {
+ "name": "encrypted_value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_digest": {
+ "name": "access_token_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "client_credential_token_expires_at_idx": {
+ "name": "client_credential_token_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"client_credential_token\".\"access_token_digest\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "client_credential_token_access_token_digest_idx": {
+ "name": "client_credential_token_access_token_digest_idx",
+ "columns": [
+ {
+ "expression": "access_token_digest",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"client_credential_token\".\"access_token_digest\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_async_tool_calls": {
+ "name": "copilot_async_tool_calls",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "checkpoint_id": {
+ "name": "checkpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_call_id": {
+ "name": "tool_call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "args": {
+ "name": "args",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "executable_name": {
+ "name": "executable_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_workspace_id": {
+ "name": "target_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_args": {
+ "name": "approved_args",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assistant_action": {
+ "name": "assistant_action",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_retryable": {
+ "name": "execution_retryable",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "status": {
+ "name": "status",
+ "type": "copilot_async_tool_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_decision": {
+ "name": "permission_decision",
+ "type": "copilot_tool_permission_decision",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_decided_at": {
+ "name": "permission_decided_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_requested_at": {
+ "name": "permission_requested_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pickup_deadline_at": {
+ "name": "pickup_deadline_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "persist_seq": {
+ "name": "persist_seq",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "nextval('copilot_async_tool_calls_persist_seq')"
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_by": {
+ "name": "claimed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "browser_download_started_at": {
+ "name": "browser_download_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_started_at": {
+ "name": "execution_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_settled_at": {
+ "name": "execution_settled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_owner_token": {
+ "name": "execution_owner_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_lease_expires_at": {
+ "name": "execution_lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_revoked_at": {
+ "name": "execution_revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_attempts": {
+ "name": "execution_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "execution_deadline_at": {
+ "name": "execution_deadline_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_workflow_execution_id": {
+ "name": "client_workflow_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sandbox_processes": {
+ "name": "sandbox_processes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "copilot_async_tool_calls_checkpoint_id_idx": {
+ "name": "copilot_async_tool_calls_checkpoint_id_idx",
+ "columns": [
+ {
+ "expression": "checkpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_async_tool_calls_status_idx": {
+ "name": "copilot_async_tool_calls_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_async_tool_calls_run_status_idx": {
+ "name": "copilot_async_tool_calls_run_status_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_async_tool_calls_tool_call_id_unique": {
+ "name": "copilot_async_tool_calls_tool_call_id_unique",
+ "columns": [
+ {
+ "expression": "tool_call_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "copilot_async_tool_calls_run_id_copilot_runs_id_fk": {
+ "name": "copilot_async_tool_calls_run_id_copilot_runs_id_fk",
+ "tableFrom": "copilot_async_tool_calls",
+ "tableTo": "copilot_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk": {
+ "name": "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk",
+ "tableFrom": "copilot_async_tool_calls",
+ "tableTo": "copilot_run_checkpoints",
+ "columnsFrom": ["checkpoint_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_chats": {
+ "name": "copilot_chats",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_space_id": {
+ "name": "memory_space_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "chat_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'copilot'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'claude-3-7-sonnet-latest'"
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_conversation_key": {
+ "name": "external_conversation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_conversation_metadata": {
+ "name": "external_conversation_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "preview_yaml": {
+ "name": "preview_yaml",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'"
+ },
+ "auto_allowed_tools": {
+ "name": "auto_allowed_tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pinned": {
+ "name": "pinned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "copilot_chats_organization_id_idx": {
+ "name": "copilot_chats_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_external_conversation_unique": {
+ "name": "copilot_chats_external_conversation_unique",
+ "columns": [
+ {
+ "expression": "external_conversation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"copilot_chats\".\"external_conversation_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_user_org_created_idx": {
+ "name": "copilot_chats_user_org_created_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_workflow_id_idx": {
+ "name": "copilot_chats_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_user_workflow_idx": {
+ "name": "copilot_chats_user_workflow_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_user_workspace_idx": {
+ "name": "copilot_chats_user_workspace_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_created_at_idx": {
+ "name": "copilot_chats_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_updated_at_idx": {
+ "name": "copilot_chats_updated_at_idx",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_workspace_created_at_id_idx": {
+ "name": "copilot_chats_workspace_created_at_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date_trunc('milliseconds', \"created_at\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_chats_user_workspace_deleted_partial_idx": {
+ "name": "copilot_chats_user_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"copilot_chats\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "copilot_chats_user_id_user_id_fk": {
+ "name": "copilot_chats_user_id_user_id_fk",
+ "tableFrom": "copilot_chats",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_chats_workflow_id_workflow_id_fk": {
+ "name": "copilot_chats_workflow_id_workflow_id_fk",
+ "tableFrom": "copilot_chats",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_chats_workspace_id_workspace_id_fk": {
+ "name": "copilot_chats_workspace_id_workspace_id_fk",
+ "tableFrom": "copilot_chats",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_chats_organization_id_organization_id_fk": {
+ "name": "copilot_chats_organization_id_organization_id_fk",
+ "tableFrom": "copilot_chats",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "copilot_chats_owner_check": {
+ "name": "copilot_chats_owner_check",
+ "value": "num_nonnulls(\"copilot_chats\".\"workspace_id\", \"copilot_chats\".\"organization_id\") <= 1"
+ },
+ "copilot_chats_organization_workflow_check": {
+ "name": "copilot_chats_organization_workflow_check",
+ "value": "\"copilot_chats\".\"organization_id\" IS NULL OR \"copilot_chats\".\"workflow_id\" IS NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.copilot_feedback": {
+ "name": "copilot_feedback",
+ "schema": "",
+ "columns": {
+ "feedback_id": {
+ "name": "feedback_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_query": {
+ "name": "user_query",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_response": {
+ "name": "agent_response",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_positive": {
+ "name": "is_positive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback": {
+ "name": "feedback",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workflow_yaml": {
+ "name": "workflow_yaml",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "copilot_feedback_user_id_idx": {
+ "name": "copilot_feedback_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_feedback_chat_id_idx": {
+ "name": "copilot_feedback_chat_id_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_feedback_user_chat_idx": {
+ "name": "copilot_feedback_user_chat_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_feedback_is_positive_idx": {
+ "name": "copilot_feedback_is_positive_idx",
+ "columns": [
+ {
+ "expression": "is_positive",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_feedback_created_at_idx": {
+ "name": "copilot_feedback_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "copilot_feedback_user_id_user_id_fk": {
+ "name": "copilot_feedback_user_id_user_id_fk",
+ "tableFrom": "copilot_feedback",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_feedback_chat_id_copilot_chats_id_fk": {
+ "name": "copilot_feedback_chat_id_copilot_chats_id_fk",
+ "tableFrom": "copilot_feedback",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_messages": {
+ "name": "copilot_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_content": {
+ "name": "display_content",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stream_id": {
+ "name": "stream_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seq": {
+ "name": "seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "copilot_messages_chat_message_unique": {
+ "name": "copilot_messages_chat_message_unique",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_messages_chat_created_at_idx": {
+ "name": "copilot_messages_chat_created_at_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"copilot_messages\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_messages_chat_seq_idx": {
+ "name": "copilot_messages_chat_seq_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "seq",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"copilot_messages\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_messages_chat_stream_idx": {
+ "name": "copilot_messages_chat_stream_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stream_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"copilot_messages\".\"stream_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_messages_user_created_at_idx": {
+ "name": "copilot_messages_user_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"copilot_messages\".\"role\" = 'user' AND \"copilot_messages\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "copilot_messages_chat_id_copilot_chats_id_fk": {
+ "name": "copilot_messages_chat_id_copilot_chats_id_fk",
+ "tableFrom": "copilot_messages",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_organization_request_stops": {
+ "name": "copilot_organization_request_stops",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stream_id": {
+ "name": "stream_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stopped_at": {
+ "name": "stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "copilot_organization_request_stops_user_id_user_id_fk": {
+ "name": "copilot_organization_request_stops_user_id_user_id_fk",
+ "tableFrom": "copilot_organization_request_stops",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_organization_request_stops_organization_id_organization_id_fk": {
+ "name": "copilot_organization_request_stops_organization_id_organization_id_fk",
+ "tableFrom": "copilot_organization_request_stops",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "copilot_organization_request_stops_user_id_organization_id_stream_id_pk": {
+ "name": "copilot_organization_request_stops_user_id_organization_id_stream_id_pk",
+ "columns": ["user_id", "organization_id", "stream_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_request_stops": {
+ "name": "copilot_request_stops",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stream_id": {
+ "name": "stream_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stopped_at": {
+ "name": "stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "copilot_request_stops_user_id_user_id_fk": {
+ "name": "copilot_request_stops_user_id_user_id_fk",
+ "tableFrom": "copilot_request_stops",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_request_stops_workspace_id_workspace_id_fk": {
+ "name": "copilot_request_stops_workspace_id_workspace_id_fk",
+ "tableFrom": "copilot_request_stops",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "copilot_request_stops_user_id_workspace_id_stream_id_pk": {
+ "name": "copilot_request_stops_user_id_workspace_id_stream_id_pk",
+ "columns": ["user_id", "workspace_id", "stream_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_run_checkpoints": {
+ "name": "copilot_run_checkpoints",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pending_tool_call_id": {
+ "name": "pending_tool_call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_snapshot": {
+ "name": "conversation_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "agent_state": {
+ "name": "agent_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "provider_request": {
+ "name": "provider_request",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "copilot_run_checkpoints_pending_tool_call_id_idx": {
+ "name": "copilot_run_checkpoints_pending_tool_call_id_idx",
+ "columns": [
+ {
+ "expression": "pending_tool_call_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_run_checkpoints_run_pending_tool_unique": {
+ "name": "copilot_run_checkpoints_run_pending_tool_unique",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pending_tool_call_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "copilot_run_checkpoints_run_id_copilot_runs_id_fk": {
+ "name": "copilot_run_checkpoints_run_id_copilot_runs_id_fk",
+ "tableFrom": "copilot_run_checkpoints",
+ "tableTo": "copilot_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_runs": {
+ "name": "copilot_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_execution_version": {
+ "name": "tool_execution_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "tool_admission_closed_at": {
+ "name": "tool_admission_closed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_run_id": {
+ "name": "parent_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stream_id": {
+ "name": "stream_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent": {
+ "name": "agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "copilot_run_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "request_context": {
+ "name": "request_context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "desktop_device_id": {
+ "name": "desktop_device_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "copilot_runs_parent_run_id_idx": {
+ "name": "copilot_runs_parent_run_id_idx",
+ "columns": [
+ {
+ "expression": "parent_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_chat_started_at_idx": {
+ "name": "copilot_runs_chat_started_at_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_user_id_idx": {
+ "name": "copilot_runs_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_workflow_id_idx": {
+ "name": "copilot_runs_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_status_idx": {
+ "name": "copilot_runs_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_chat_execution_idx": {
+ "name": "copilot_runs_chat_execution_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_execution_started_at_idx": {
+ "name": "copilot_runs_execution_started_at_idx",
+ "columns": [
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_workspace_completed_at_id_idx": {
+ "name": "copilot_runs_workspace_completed_at_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date_trunc('milliseconds', \"completed_at\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_stream_id_unique": {
+ "name": "copilot_runs_stream_id_unique",
+ "columns": [
+ {
+ "expression": "stream_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "copilot_runs_desktop_device_started_at_idx": {
+ "name": "copilot_runs_desktop_device_started_at_idx",
+ "columns": [
+ {
+ "expression": "desktop_device_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"copilot_runs\".\"desktop_device_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "copilot_runs_chat_id_copilot_chats_id_fk": {
+ "name": "copilot_runs_chat_id_copilot_chats_id_fk",
+ "tableFrom": "copilot_runs",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_runs_user_id_user_id_fk": {
+ "name": "copilot_runs_user_id_user_id_fk",
+ "tableFrom": "copilot_runs",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_runs_workflow_id_workflow_id_fk": {
+ "name": "copilot_runs_workflow_id_workflow_id_fk",
+ "tableFrom": "copilot_runs",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_runs_workspace_id_workspace_id_fk": {
+ "name": "copilot_runs_workspace_id_workspace_id_fk",
+ "tableFrom": "copilot_runs",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_runs_organization_id_organization_id_fk": {
+ "name": "copilot_runs_organization_id_organization_id_fk",
+ "tableFrom": "copilot_runs",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "copilot_runs_desktop_device_id_desktop_devices_id_fk": {
+ "name": "copilot_runs_desktop_device_id_desktop_devices_id_fk",
+ "tableFrom": "copilot_runs",
+ "tableTo": "desktop_devices",
+ "columnsFrom": ["desktop_device_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.copilot_service_usage": {
+ "name": "copilot_service_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "stream_id": {
+ "name": "stream_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_call_id": {
+ "name": "tool_call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "service": {
+ "name": "service",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "numeric(12, 8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "worker_origin": {
+ "name": "worker_origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "copilot_service_usage_pending_idx": {
+ "name": "copilot_service_usage_pending_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "delivered_at IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.credential": {
+ "name": "credential",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_app_id": {
+ "name": "slack_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "credential_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unredacted": {
+ "name": "unredacted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "env_key": {
+ "name": "env_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "env_owner_user_id": {
+ "name": "env_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_service_account_key": {
+ "name": "encrypted_service_account_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_personal_token": {
+ "name": "encrypted_personal_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_app_id": {
+ "name": "authorization_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_group_enrollment_id": {
+ "name": "credential_group_enrollment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_group_option_id": {
+ "name": "credential_group_option_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_server_id": {
+ "name": "mcp_server_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_oauth_config_version": {
+ "name": "mcp_oauth_config_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "managed_oauth_scope_version": {
+ "name": "managed_oauth_scope_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_subject_id": {
+ "name": "provider_subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_tenant_id": {
+ "name": "provider_tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "managed_oauth_status": {
+ "name": "managed_oauth_status",
+ "type": "managed_oauth_credential_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_scopes": {
+ "name": "granted_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_metadata": {
+ "name": "provider_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_oauth_token_set": {
+ "name": "encrypted_oauth_token_set",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_tools": {
+ "name": "mcp_tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_tools_refreshed_at": {
+ "name": "mcp_tools_refreshed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_at": {
+ "name": "granted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refreshed_at": {
+ "name": "last_refreshed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "credential_organization_id_idx": {
+ "name": "credential_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_organization_account_unique": {
+ "name": "credential_organization_account_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"credential\".\"account_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_org_personal_token_unique": {
+ "name": "credential_org_personal_token_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"credential\".\"type\" = 'personal_token'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_workspace_id_idx": {
+ "name": "credential_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_type_idx": {
+ "name": "credential_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_provider_id_idx": {
+ "name": "credential_provider_id_idx",
+ "columns": [
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_account_id_idx": {
+ "name": "credential_account_id_idx",
+ "columns": [
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_env_owner_user_id_idx": {
+ "name": "credential_env_owner_user_id_idx",
+ "columns": [
+ {
+ "expression": "env_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_enrollment_idx": {
+ "name": "credential_group_enrollment_idx",
+ "columns": [
+ {
+ "expression": "credential_group_enrollment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_mcp_server_idx": {
+ "name": "credential_mcp_server_idx",
+ "columns": [
+ {
+ "expression": "mcp_server_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_option_identity_unique": {
+ "name": "credential_group_option_identity_unique",
+ "columns": [
+ {
+ "expression": "credential_group_enrollment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "credential_group_option_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"provider_tenant_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"credential\".\"type\" = 'managed_oauth'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_managed_mcp_enrollment_server_identity_unique": {
+ "name": "credential_managed_mcp_enrollment_server_identity_unique",
+ "columns": [
+ {
+ "expression": "credential_group_enrollment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "mcp_server_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"provider_subject_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"provider_tenant_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"credential\".\"type\" = 'managed_mcp'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_workspace_account_unique": {
+ "name": "credential_workspace_account_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "account_id IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_workspace_env_unique": {
+ "name": "credential_workspace_env_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "env_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "type = 'env_workspace'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_workspace_personal_env_unique": {
+ "name": "credential_workspace_personal_env_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "env_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "env_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "type = 'env_personal'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "credential_workspace_id_workspace_id_fk": {
+ "name": "credential_workspace_id_workspace_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_organization_id_organization_id_fk": {
+ "name": "credential_organization_id_organization_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_slack_app_id_slack_app_id_fk": {
+ "name": "credential_slack_app_id_slack_app_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "slack_app",
+ "columnsFrom": ["slack_app_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "credential_account_id_account_id_fk": {
+ "name": "credential_account_id_account_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "account",
+ "columnsFrom": ["account_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_env_owner_user_id_user_id_fk": {
+ "name": "credential_env_owner_user_id_user_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "user",
+ "columnsFrom": ["env_owner_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk": {
+ "name": "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "credential_group_enrollment",
+ "columnsFrom": ["credential_group_enrollment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_mcp_server_id_mcp_servers_id_fk": {
+ "name": "credential_mcp_server_id_mcp_servers_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "mcp_servers",
+ "columnsFrom": ["mcp_server_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_created_by_user_id_fk": {
+ "name": "credential_created_by_user_id_fk",
+ "tableFrom": "credential",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "credential_owner_check": {
+ "name": "credential_owner_check",
+ "value": "num_nonnulls(\"credential\".\"workspace_id\", \"credential\".\"organization_id\") = 1"
+ },
+ "credential_organization_type_check": {
+ "name": "credential_organization_type_check",
+ "value": "\"credential\".\"organization_id\" IS NULL OR \"credential\".\"type\" IN ('oauth', 'managed_oauth', 'managed_mcp', 'service_account', 'personal_token')"
+ },
+ "credential_personal_token_source_check": {
+ "name": "credential_personal_token_source_check",
+ "value": "(type::text <> 'personal_token') OR (\n created_by IS NOT NULL\n AND provider_id IS NOT NULL\n AND provider_id = 'gitlab'\n AND provider_subject_id IS NOT NULL\n AND provider_tenant_id IS NOT NULL\n AND encrypted_personal_token IS NOT NULL\n AND granted_scopes IS NOT NULL\n AND cardinality(granted_scopes) > 0\n AND account_id IS NULL\n AND env_key IS NULL\n AND env_owner_user_id IS NULL\n AND authorization_app_id IS NULL\n AND encrypted_oauth_token_set IS NULL\n AND encrypted_service_account_key IS NULL\n AND unredacted = false\n )"
+ },
+ "credential_oauth_source_check": {
+ "name": "credential_oauth_source_check",
+ "value": "(type <> 'oauth') OR (account_id IS NOT NULL AND provider_id IS NOT NULL)"
+ },
+ "credential_managed_oauth_source_check": {
+ "name": "credential_managed_oauth_source_check",
+ "value": "(type::text <> 'managed_oauth') OR (\n account_id IS NULL\n AND provider_id IS NOT NULL\n AND authorization_app_id IS NOT NULL\n AND provider_subject_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND granted_scopes IS NOT NULL\n AND encrypted_oauth_token_set IS NOT NULL\n AND granted_at IS NOT NULL\n )"
+ },
+ "credential_managed_oauth_group_binding_check": {
+ "name": "credential_managed_oauth_group_binding_check",
+ "value": "(type::text <> 'managed_oauth') OR (\n credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NOT NULL\n AND managed_oauth_scope_version IS NOT NULL\n AND managed_oauth_scope_version > 0\n )"
+ },
+ "credential_managed_mcp_source_check": {
+ "name": "credential_managed_mcp_source_check",
+ "value": "(type::text <> 'managed_mcp') OR (\n id LIKE 'mcp-cg-%'\n AND account_id IS NULL\n AND provider_id IS NULL\n AND authorization_app_id IS NULL\n AND credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NULL\n AND mcp_server_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND (managed_oauth_status <> 'active' OR (\n encrypted_oauth_token_set IS NOT NULL\n AND mcp_tools IS NOT NULL\n ))\n AND granted_at IS NOT NULL\n AND managed_oauth_scope_version IS NULL\n AND granted_scopes IS NULL\n AND provider_metadata IS NULL\n AND created_by IS NULL\n AND env_key IS NULL\n AND env_owner_user_id IS NULL\n AND encrypted_service_account_key IS NULL\n AND unredacted = false\n )"
+ },
+ "credential_creator_source_check": {
+ "name": "credential_creator_source_check",
+ "value": "(type::text = 'managed_mcp') OR created_by IS NOT NULL"
+ },
+ "credential_workspace_env_source_check": {
+ "name": "credential_workspace_env_source_check",
+ "value": "(type <> 'env_workspace') OR (env_key IS NOT NULL AND env_owner_user_id IS NULL)"
+ },
+ "credential_personal_env_source_check": {
+ "name": "credential_personal_env_source_check",
+ "value": "(type <> 'env_personal') OR (env_key IS NOT NULL AND env_owner_user_id IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.credential_group": {
+ "name": "credential_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "options": {
+ "name": "options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_provider_configuration": {
+ "name": "encrypted_provider_configuration",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "credential_group_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "credential_group_organization_unique": {
+ "name": "credential_group_organization_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_public_id_unique": {
+ "name": "credential_group_public_id_unique",
+ "columns": [
+ {
+ "expression": "public_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_workspace_unique": {
+ "name": "credential_group_workspace_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "credential_group_workspace_id_workspace_id_fk": {
+ "name": "credential_group_workspace_id_workspace_id_fk",
+ "tableFrom": "credential_group",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_group_organization_id_organization_id_fk": {
+ "name": "credential_group_organization_id_organization_id_fk",
+ "tableFrom": "credential_group",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_group_created_by_user_id_fk": {
+ "name": "credential_group_created_by_user_id_fk",
+ "tableFrom": "credential_group",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "credential_group_owner_check": {
+ "name": "credential_group_owner_check",
+ "value": "num_nonnulls(\"credential_group\".\"workspace_id\", \"credential_group\".\"organization_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.credential_group_enrollment": {
+ "name": "credential_group_enrollment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "credential_group_id": {
+ "name": "credential_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "credential_group_enrollment_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invited'"
+ },
+ "invitation_token_hash": {
+ "name": "invitation_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invitation_expires_at": {
+ "name": "invitation_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invited_at": {
+ "name": "invited_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_delivery_error": {
+ "name": "last_delivery_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "credential_group_enrollment_group_user_unique": {
+ "name": "credential_group_enrollment_group_user_unique",
+ "columns": [
+ {
+ "expression": "credential_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"credential_group_enrollment\".\"user_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_enrollment_user_id_idx": {
+ "name": "credential_group_enrollment_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_enrollment_group_email_unique": {
+ "name": "credential_group_enrollment_group_email_unique",
+ "columns": [
+ {
+ "expression": "credential_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_enrollment_invitation_token_hash_unique": {
+ "name": "credential_group_enrollment_invitation_token_hash_unique",
+ "columns": [
+ {
+ "expression": "invitation_token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_enrollment_group_status_idx": {
+ "name": "credential_group_enrollment_group_status_idx",
+ "columns": [
+ {
+ "expression": "credential_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_group_enrollment_group_invited_at_id_idx": {
+ "name": "credential_group_enrollment_group_invited_at_id_idx",
+ "columns": [
+ {
+ "expression": "credential_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invited_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "credential_group_enrollment_credential_group_id_credential_group_id_fk": {
+ "name": "credential_group_enrollment_credential_group_id_credential_group_id_fk",
+ "tableFrom": "credential_group_enrollment",
+ "tableTo": "credential_group",
+ "columnsFrom": ["credential_group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_group_enrollment_user_id_user_id_fk": {
+ "name": "credential_group_enrollment_user_id_user_id_fk",
+ "tableFrom": "credential_group_enrollment",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_group_enrollment_created_by_user_id_fk": {
+ "name": "credential_group_enrollment_created_by_user_id_fk",
+ "tableFrom": "credential_group_enrollment",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "credential_group_enrollment_normalized_email_check": {
+ "name": "credential_group_enrollment_normalized_email_check",
+ "value": "\"credential_group_enrollment\".\"email\" = lower(btrim(\"credential_group_enrollment\".\"email\")) AND length(\"credential_group_enrollment\".\"email\") BETWEEN 3 AND 320"
+ },
+ "credential_group_enrollment_invitation_token_hash_length_check": {
+ "name": "credential_group_enrollment_invitation_token_hash_length_check",
+ "value": "length(\"credential_group_enrollment\".\"invitation_token_hash\") = 64"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.credential_member": {
+ "name": "credential_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "credential_member_role",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "status": {
+ "name": "status",
+ "type": "credential_member_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invited_by": {
+ "name": "invited_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "credential_member_user_id_idx": {
+ "name": "credential_member_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_member_role_idx": {
+ "name": "credential_member_role_idx",
+ "columns": [
+ {
+ "expression": "role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_member_status_idx": {
+ "name": "credential_member_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "credential_member_unique": {
+ "name": "credential_member_unique",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "credential_member_credential_id_credential_id_fk": {
+ "name": "credential_member_credential_id_credential_id_fk",
+ "tableFrom": "credential_member",
+ "tableTo": "credential",
+ "columnsFrom": ["credential_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_member_user_id_user_id_fk": {
+ "name": "credential_member_user_id_user_id_fk",
+ "tableFrom": "credential_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "credential_member_invited_by_user_id_fk": {
+ "name": "credential_member_invited_by_user_id_fk",
+ "tableFrom": "credential_member",
+ "tableTo": "user",
+ "columnsFrom": ["invited_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_block": {
+ "name": "custom_block",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inputs": {
+ "name": "inputs",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outputs": {
+ "name": "outputs",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "trace_child_runs": {
+ "name": "trace_child_runs",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "custom_block_workflow_id_idx": {
+ "name": "custom_block_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "custom_block_organization_type_unique": {
+ "name": "custom_block_organization_type_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "custom_block_organization_id_organization_id_fk": {
+ "name": "custom_block_organization_id_organization_id_fk",
+ "tableFrom": "custom_block",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_block_workflow_id_workflow_id_fk": {
+ "name": "custom_block_workflow_id_workflow_id_fk",
+ "tableFrom": "custom_block",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_block_created_by_user_id_fk": {
+ "name": "custom_block_created_by_user_id_fk",
+ "tableFrom": "custom_block",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_tools": {
+ "name": "custom_tools",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema": {
+ "name": "schema",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "custom_tools_workspace_title_unique": {
+ "name": "custom_tools_workspace_title_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "title",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "custom_tools_workspace_id_workspace_id_fk": {
+ "name": "custom_tools_workspace_id_workspace_id_fk",
+ "tableFrom": "custom_tools",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_tools_user_id_user_id_fk": {
+ "name": "custom_tools_user_id_user_id_fk",
+ "tableFrom": "custom_tools",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dashboard": {
+ "name": "dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dashboard_workspace_id_unique": {
+ "name": "dashboard_workspace_id_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dashboard_workspace_id_workspace_id_fk": {
+ "name": "dashboard_workspace_id_workspace_id_fk",
+ "tableFrom": "dashboard",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dashboard_created_by_user_id_fk": {
+ "name": "dashboard_created_by_user_id_fk",
+ "tableFrom": "dashboard",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "dashboard_updated_by_user_id_fk": {
+ "name": "dashboard_updated_by_user_id_fk",
+ "tableFrom": "dashboard",
+ "tableTo": "user",
+ "columnsFrom": ["updated_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.data_drain_runs": {
+ "name": "data_drain_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "drain_id": {
+ "name": "drain_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "data_drain_run_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "data_drain_run_trigger",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rows_exported": {
+ "name": "rows_exported",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "bytes_written": {
+ "name": "bytes_written",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cursor_before": {
+ "name": "cursor_before",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cursor_after": {
+ "name": "cursor_after",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locators": {
+ "name": "locators",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ }
+ },
+ "indexes": {
+ "data_drain_runs_drain_started_idx": {
+ "name": "data_drain_runs_drain_started_idx",
+ "columns": [
+ {
+ "expression": "drain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "data_drain_runs_drain_id_data_drains_id_fk": {
+ "name": "data_drain_runs_drain_id_data_drains_id_fk",
+ "tableFrom": "data_drain_runs",
+ "tableTo": "data_drains",
+ "columnsFrom": ["drain_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.data_drains": {
+ "name": "data_drains",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "data_drain_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "destination_type": {
+ "name": "destination_type",
+ "type": "data_drain_destination",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "destination_config": {
+ "name": "destination_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "destination_credentials": {
+ "name": "destination_credentials",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schedule_cadence": {
+ "name": "schedule_cadence",
+ "type": "data_drain_cadence",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_success_at": {
+ "name": "last_success_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "data_drains_due_idx": {
+ "name": "data_drains_due_idx",
+ "columns": [
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "data_drains_org_name_unique": {
+ "name": "data_drains_org_name_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "data_drains_organization_id_organization_id_fk": {
+ "name": "data_drains_organization_id_organization_id_fk",
+ "tableFrom": "data_drains",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "data_drains_created_by_user_id_fk": {
+ "name": "data_drains_created_by_user_id_fk",
+ "tableFrom": "data_drains",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deleted_account_identity": {
+ "name": "deleted_account_identity",
+ "schema": "",
+ "columns": {
+ "identity_hash": {
+ "name": "identity_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "deleted_account_identity_expires_at_idx": {
+ "name": "deleted_account_identity_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.desktop_devices": {
+ "name": "desktop_devices",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_version": {
+ "name": "app_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "desktop_devices_user_id_idx": {
+ "name": "desktop_devices_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "desktop_devices_session_id_idx": {
+ "name": "desktop_devices_session_id_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "desktop_devices_user_id_user_id_fk": {
+ "name": "desktop_devices_user_id_user_id_fk",
+ "tableFrom": "desktop_devices",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "desktop_devices_session_id_session_id_fk": {
+ "name": "desktop_devices_session_id_session_id_fk",
+ "tableFrom": "desktop_devices",
+ "tableTo": "session",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.docs_embeddings": {
+ "name": "docs_embeddings",
+ "schema": "",
+ "columns": {
+ "chunk_id": {
+ "name": "chunk_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "chunk_text": {
+ "name": "chunk_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_document": {
+ "name": "source_document",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_link": {
+ "name": "source_link",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "header_text": {
+ "name": "header_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "header_level": {
+ "name": "header_level",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_count": {
+ "name": "token_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "embedding": {
+ "name": "embedding",
+ "type": "vector(1536)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "embedding_model": {
+ "name": "embedding_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'text-embedding-3-small'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "chunk_text_tsv": {
+ "name": "chunk_text_tsv",
+ "type": "tsvector",
+ "primaryKey": false,
+ "notNull": false,
+ "generated": {
+ "as": "to_tsvector('english', \"docs_embeddings\".\"chunk_text\")",
+ "type": "stored"
+ }
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "docs_emb_source_document_idx": {
+ "name": "docs_emb_source_document_idx",
+ "columns": [
+ {
+ "expression": "source_document",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "docs_emb_header_level_idx": {
+ "name": "docs_emb_header_level_idx",
+ "columns": [
+ {
+ "expression": "header_level",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "docs_emb_source_header_idx": {
+ "name": "docs_emb_source_header_idx",
+ "columns": [
+ {
+ "expression": "source_document",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "header_level",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "docs_emb_model_idx": {
+ "name": "docs_emb_model_idx",
+ "columns": [
+ {
+ "expression": "embedding_model",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "docs_emb_created_at_idx": {
+ "name": "docs_emb_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "docs_embedding_vector_hnsw_idx": {
+ "name": "docs_embedding_vector_hnsw_idx",
+ "columns": [
+ {
+ "expression": "embedding",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "vector_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ },
+ "docs_emb_metadata_gin_idx": {
+ "name": "docs_emb_metadata_gin_idx",
+ "columns": [
+ {
+ "expression": "metadata",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ },
+ "docs_emb_chunk_text_fts_idx": {
+ "name": "docs_emb_chunk_text_fts_idx",
+ "columns": [
+ {
+ "expression": "chunk_text_tsv",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "docs_embedding_not_null_check": {
+ "name": "docs_embedding_not_null_check",
+ "value": "\"embedding\" IS NOT NULL"
+ },
+ "docs_header_level_check": {
+ "name": "docs_header_level_check",
+ "value": "\"header_level\" >= 1 AND \"header_level\" <= 6"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document": {
+ "name": "document",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_url": {
+ "name": "file_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_key": {
+ "name": "storage_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_sha256": {
+ "name": "file_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chunk_count": {
+ "name": "chunk_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "token_count": {
+ "name": "token_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "character_count": {
+ "name": "character_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "processing_status": {
+ "name": "processing_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "processing_attempts": {
+ "name": "processing_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "processing_queued_at": {
+ "name": "processing_queued_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_queue_token": {
+ "name": "processing_queue_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_started_at": {
+ "name": "processing_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_deferred_until": {
+ "name": "processing_deferred_until",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_completed_at": {
+ "name": "processing_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_error": {
+ "name": "processing_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_recovery_after": {
+ "name": "processing_recovery_after",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_excluded": {
+ "name": "user_excluded",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "tag1": {
+ "name": "tag1",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag2": {
+ "name": "tag2",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag3": {
+ "name": "tag3",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag4": {
+ "name": "tag4",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag5": {
+ "name": "tag5",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag6": {
+ "name": "tag6",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag7": {
+ "name": "tag7",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number1": {
+ "name": "number1",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number2": {
+ "name": "number2",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number3": {
+ "name": "number3",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number4": {
+ "name": "number4",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number5": {
+ "name": "number5",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "date1": {
+ "name": "date1",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "date2": {
+ "name": "date2",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boolean1": {
+ "name": "boolean1",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boolean2": {
+ "name": "boolean2",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boolean3": {
+ "name": "boolean3",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_url": {
+ "name": "source_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_provenance_version": {
+ "name": "secret_provenance_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_by": {
+ "name": "uploaded_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acl": {
+ "name": "acl",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{ws}'::text[]"
+ },
+ "acl_requirements": {
+ "name": "acl_requirements",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "acl_verified_at": {
+ "name": "acl_verified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_modified_at": {
+ "name": "source_modified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_seen_at": {
+ "name": "source_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "doc_uploaded_by_idx": {
+ "name": "doc_uploaded_by_idx",
+ "columns": [
+ {
+ "expression": "uploaded_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"uploaded_by\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_source_modified_idx": {
+ "name": "doc_kb_source_modified_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_modified_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"deleted_at\" IS NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_acl_gin_idx": {
+ "name": "doc_acl_gin_idx",
+ "columns": [
+ {
+ "expression": "acl",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "array_ops"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ },
+ "doc_filename_idx": {
+ "name": "doc_filename_idx",
+ "columns": [
+ {
+ "expression": "filename",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_processing_status_idx": {
+ "name": "doc_processing_status_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "processing_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_processing_recovery_idx": {
+ "name": "doc_connector_processing_recovery_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "uploaded_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"processing_status\" IN ('pending', 'processing', 'failed') AND \"document\".\"connector_id\" IS NOT NULL AND \"document\".\"content_hash\" IS NOT NULL AND \"document\".\"storage_key\" IS NOT NULL AND \"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_processing_status_idx": {
+ "name": "doc_connector_processing_status_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "processing_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"processing_status\" IN ('pending', 'processing', 'failed') AND \"document\".\"connector_id\" IS NOT NULL AND \"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_external_id_idx": {
+ "name": "doc_connector_external_id_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"document\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_source_lookup_idx": {
+ "name": "doc_connector_source_lookup_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_reconciliation_v2_idx": {
+ "name": "doc_connector_reconciliation_v2_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_active_kb_token_count_idx": {
+ "name": "doc_active_kb_token_count_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "token_count",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_storage_key_idx": {
+ "name": "doc_storage_key_idx",
+ "columns": [
+ {
+ "expression": "storage_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"storage_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_archived_at_partial_idx": {
+ "name": "doc_archived_at_partial_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_deleted_at_partial_idx": {
+ "name": "doc_deleted_at_partial_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_tombstone_idx": {
+ "name": "doc_connector_tombstone_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"archived_at\" IS NULL AND (\"document\".\"deleted_at\" IS NOT NULL OR \"document\".\"content_hash\" IS NULL)",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_connector_live_idx": {
+ "name": "doc_connector_live_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag1_lower_idx": {
+ "name": "doc_kb_tag1_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag1\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag2_lower_idx": {
+ "name": "doc_kb_tag2_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag2\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag3_lower_idx": {
+ "name": "doc_kb_tag3_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag3\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag4_lower_idx": {
+ "name": "doc_kb_tag4_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag4\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag5_lower_idx": {
+ "name": "doc_kb_tag5_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag5\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag6_lower_idx": {
+ "name": "doc_kb_tag6_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag6\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_kb_tag7_lower_idx": {
+ "name": "doc_kb_tag7_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag7\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_number1_idx": {
+ "name": "doc_number1_idx",
+ "columns": [
+ {
+ "expression": "number1",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_number2_idx": {
+ "name": "doc_number2_idx",
+ "columns": [
+ {
+ "expression": "number2",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_number3_idx": {
+ "name": "doc_number3_idx",
+ "columns": [
+ {
+ "expression": "number3",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_number4_idx": {
+ "name": "doc_number4_idx",
+ "columns": [
+ {
+ "expression": "number4",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_number5_idx": {
+ "name": "doc_number5_idx",
+ "columns": [
+ {
+ "expression": "number5",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_date1_idx": {
+ "name": "doc_date1_idx",
+ "columns": [
+ {
+ "expression": "date1",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_date2_idx": {
+ "name": "doc_date2_idx",
+ "columns": [
+ {
+ "expression": "date2",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_boolean1_idx": {
+ "name": "doc_boolean1_idx",
+ "columns": [
+ {
+ "expression": "boolean1",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_boolean2_idx": {
+ "name": "doc_boolean2_idx",
+ "columns": [
+ {
+ "expression": "boolean2",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "doc_boolean3_idx": {
+ "name": "doc_boolean3_idx",
+ "columns": [
+ {
+ "expression": "boolean3",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_knowledge_base_id_knowledge_base_id_fk": {
+ "name": "document_knowledge_base_id_knowledge_base_id_fk",
+ "tableFrom": "document",
+ "tableTo": "knowledge_base",
+ "columnsFrom": ["knowledge_base_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_connector_id_knowledge_connector_id_fk": {
+ "name": "document_connector_id_knowledge_connector_id_fk",
+ "tableFrom": "document",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "document_uploaded_by_user_id_fk": {
+ "name": "document_uploaded_by_user_id_fk",
+ "tableFrom": "document",
+ "tableTo": "user",
+ "columnsFrom": ["uploaded_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "doc_acl_token_shape_check": {
+ "name": "doc_acl_token_shape_check",
+ "value": "array_position(\"document\".\"acl\", NULL) IS NULL AND (cardinality(\"document\".\"acl\") = 0 OR (cardinality(\"document\".\"acl\") = array_length(string_to_array(array_to_string(\"document\".\"acl\", E'\\n'), E'\\n'), 1) AND array_to_string(\"document\".\"acl\", E'\\n') ~ '^((ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+)(\\n(ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+))*)$'))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document_secret_provenance": {
+ "name": "document_secret_provenance",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_hash": {
+ "name": "source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entries": {
+ "name": "entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_secret_provenance_document_id_document_id_fk": {
+ "name": "document_secret_provenance_document_id_document_id_fk",
+ "tableFrom": "document_secret_provenance",
+ "tableTo": "document",
+ "columnsFrom": ["document_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "document_secret_provenance_status_check": {
+ "name": "document_secret_provenance_status_check",
+ "value": "\"document_secret_provenance\".\"status\" IN ('exact', 'unknown')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.embedding": {
+ "name": "embedding",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chunk_hash": {
+ "name": "chunk_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_provenance_version": {
+ "name": "secret_provenance_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content_length": {
+ "name": "content_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_count": {
+ "name": "token_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "embedding": {
+ "name": "embedding",
+ "type": "vector(1536)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "embedding_384": {
+ "name": "embedding_384",
+ "type": "vector(384)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "embedding_768": {
+ "name": "embedding_768",
+ "type": "vector(768)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "embedding_1024": {
+ "name": "embedding_1024",
+ "type": "vector(1024)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "embedding_3072": {
+ "name": "embedding_3072",
+ "type": "vector(3072)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "embedding_model": {
+ "name": "embedding_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'text-embedding-3-small'"
+ },
+ "start_offset": {
+ "name": "start_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_offset": {
+ "name": "end_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag1": {
+ "name": "tag1",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag2": {
+ "name": "tag2",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag3": {
+ "name": "tag3",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag4": {
+ "name": "tag4",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag5": {
+ "name": "tag5",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag6": {
+ "name": "tag6",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag7": {
+ "name": "tag7",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number1": {
+ "name": "number1",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number2": {
+ "name": "number2",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number3": {
+ "name": "number3",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number4": {
+ "name": "number4",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "number5": {
+ "name": "number5",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "date1": {
+ "name": "date1",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "date2": {
+ "name": "date2",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boolean1": {
+ "name": "boolean1",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boolean2": {
+ "name": "boolean2",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "boolean3": {
+ "name": "boolean3",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "content_tsv": {
+ "name": "content_tsv",
+ "type": "tsvector",
+ "primaryKey": false,
+ "notNull": false,
+ "generated": {
+ "as": "to_tsvector('english', \"embedding\".\"content\")",
+ "type": "stored"
+ }
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "emb_doc_chunk_idx": {
+ "name": "emb_doc_chunk_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "chunk_index",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_model_idx": {
+ "name": "emb_kb_model_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "embedding_model",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_enabled_idx": {
+ "name": "emb_kb_enabled_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_doc_enabled_idx": {
+ "name": "emb_doc_enabled_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag1_lower_idx": {
+ "name": "emb_kb_tag1_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag1\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag2_lower_idx": {
+ "name": "emb_kb_tag2_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag2\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag3_lower_idx": {
+ "name": "emb_kb_tag3_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag3\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag4_lower_idx": {
+ "name": "emb_kb_tag4_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag4\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag5_lower_idx": {
+ "name": "emb_kb_tag5_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag5\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag6_lower_idx": {
+ "name": "emb_kb_tag6_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag6\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_kb_tag7_lower_idx": {
+ "name": "emb_kb_tag7_lower_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"tag7\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_number1_idx": {
+ "name": "emb_number1_idx",
+ "columns": [
+ {
+ "expression": "number1",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_number2_idx": {
+ "name": "emb_number2_idx",
+ "columns": [
+ {
+ "expression": "number2",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_number3_idx": {
+ "name": "emb_number3_idx",
+ "columns": [
+ {
+ "expression": "number3",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_number4_idx": {
+ "name": "emb_number4_idx",
+ "columns": [
+ {
+ "expression": "number4",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_number5_idx": {
+ "name": "emb_number5_idx",
+ "columns": [
+ {
+ "expression": "number5",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_date1_idx": {
+ "name": "emb_date1_idx",
+ "columns": [
+ {
+ "expression": "date1",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_date2_idx": {
+ "name": "emb_date2_idx",
+ "columns": [
+ {
+ "expression": "date2",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_boolean1_idx": {
+ "name": "emb_boolean1_idx",
+ "columns": [
+ {
+ "expression": "boolean1",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_boolean2_idx": {
+ "name": "emb_boolean2_idx",
+ "columns": [
+ {
+ "expression": "boolean2",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_boolean3_idx": {
+ "name": "emb_boolean3_idx",
+ "columns": [
+ {
+ "expression": "boolean3",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "emb_content_fts_idx": {
+ "name": "emb_content_fts_idx",
+ "columns": [
+ {
+ "expression": "content_tsv",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {
+ "fastupdate": "off"
+ }
+ }
+ },
+ "foreignKeys": {
+ "embedding_knowledge_base_id_knowledge_base_id_fk": {
+ "name": "embedding_knowledge_base_id_knowledge_base_id_fk",
+ "tableFrom": "embedding",
+ "tableTo": "knowledge_base",
+ "columnsFrom": ["knowledge_base_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "embedding_document_id_document_id_fk": {
+ "name": "embedding_document_id_document_id_fk",
+ "tableFrom": "embedding",
+ "tableTo": "document",
+ "columnsFrom": ["document_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "embedding_width_check": {
+ "name": "embedding_width_check",
+ "value": "num_nonnulls(\"embedding\", \"embedding_384\", \"embedding_768\", \"embedding_1024\", \"embedding_3072\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.embedding_search": {
+ "name": "embedding_search",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acl": {
+ "name": "acl",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "binary": {
+ "name": "binary",
+ "type": "bit(1536)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "binary_384": {
+ "name": "binary_384",
+ "type": "bit(384)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "binary_768": {
+ "name": "binary_768",
+ "type": "bit(768)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "binary_1024": {
+ "name": "binary_1024",
+ "type": "bit(1024)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "binary_3072": {
+ "name": "binary_3072",
+ "type": "bit(3072)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vector": {
+ "name": "vector",
+ "type": "halfvec(1536)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vector_384": {
+ "name": "vector_384",
+ "type": "halfvec(384)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vector_512": {
+ "name": "vector_512",
+ "type": "halfvec(512)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vector_768": {
+ "name": "vector_768",
+ "type": "halfvec(768)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vector_1024": {
+ "name": "vector_1024",
+ "type": "halfvec(1024)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vector_3072": {
+ "name": "vector_3072",
+ "type": "halfvec(3072)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "embedding_search_kb_idx": {
+ "name": "embedding_search_kb_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "embedding_search_document_lookup_idx": {
+ "name": "embedding_search_document_lookup_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"embedding_search\".\"enabled\"",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "embedding_search_cosine_hnsw_idx": {
+ "name": "embedding_search_cosine_hnsw_idx",
+ "columns": [
+ {
+ "expression": "vector",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "halfvec_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ },
+ "embedding_search_512_cosine_hnsw_idx": {
+ "name": "embedding_search_512_cosine_hnsw_idx",
+ "columns": [
+ {
+ "expression": "vector_512",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "halfvec_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ },
+ "embedding_search_384_cosine_hnsw_idx": {
+ "name": "embedding_search_384_cosine_hnsw_idx",
+ "columns": [
+ {
+ "expression": "vector_384",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "halfvec_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ },
+ "embedding_search_768_cosine_hnsw_idx": {
+ "name": "embedding_search_768_cosine_hnsw_idx",
+ "columns": [
+ {
+ "expression": "vector_768",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "halfvec_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ },
+ "embedding_search_1024_cosine_hnsw_idx": {
+ "name": "embedding_search_1024_cosine_hnsw_idx",
+ "columns": [
+ {
+ "expression": "vector_1024",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "halfvec_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ },
+ "embedding_search_3072_cosine_hnsw_idx": {
+ "name": "embedding_search_3072_cosine_hnsw_idx",
+ "columns": [
+ {
+ "expression": "vector_3072",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "halfvec_cosine_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "hnsw",
+ "with": {
+ "m": 16,
+ "ef_construction": 64
+ }
+ }
+ },
+ "foreignKeys": {
+ "embedding_search_id_embedding_id_fk": {
+ "name": "embedding_search_id_embedding_id_fk",
+ "tableFrom": "embedding_search",
+ "tableTo": "embedding",
+ "columnsFrom": ["id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "embedding_search_width_check": {
+ "name": "embedding_search_width_check",
+ "value": "num_nonnulls(\"binary\", \"binary_384\", \"binary_768\", \"binary_1024\", \"binary_3072\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.embedding_secret_provenance": {
+ "name": "embedding_secret_provenance",
+ "schema": "",
+ "columns": {
+ "embedding_id": {
+ "name": "embedding_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entries": {
+ "name": "entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "embedding_secret_provenance_embedding_id_embedding_id_fk": {
+ "name": "embedding_secret_provenance_embedding_id_embedding_id_fk",
+ "tableFrom": "embedding_secret_provenance",
+ "tableTo": "embedding",
+ "columnsFrom": ["embedding_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "embedding_secret_provenance_status_check": {
+ "name": "embedding_secret_provenance_status_check",
+ "value": "\"embedding_secret_provenance\".\"status\" IN ('exact', 'unknown')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.environment": {
+ "name": "environment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variables": {
+ "name": "variables",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "environment_user_id_user_id_fk": {
+ "name": "environment_user_id_user_id_fk",
+ "tableFrom": "environment",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "environment_user_id_unique": {
+ "name": "environment_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.execution_large_value_dependencies": {
+ "name": "execution_large_value_dependencies",
+ "schema": "",
+ "columns": {
+ "parent_key": {
+ "name": "parent_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "child_key": {
+ "name": "child_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "execution_large_value_dependencies_workspace_parent_key_idx": {
+ "name": "execution_large_value_dependencies_workspace_parent_key_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "execution_large_value_dependencies_workspace_child_key_idx": {
+ "name": "execution_large_value_dependencies_workspace_child_key_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "child_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "execution_large_value_dependencies_workspace_id_workspace_id_fk": {
+ "name": "execution_large_value_dependencies_workspace_id_workspace_id_fk",
+ "tableFrom": "execution_large_value_dependencies",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "execution_large_value_dependencies_parent_key_child_key_pk": {
+ "name": "execution_large_value_dependencies_parent_key_child_key_pk",
+ "columns": ["parent_key", "child_key"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.execution_large_value_references": {
+ "name": "execution_large_value_references",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "execution_large_value_reference_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "execution_large_value_references_workspace_execution_source_idx": {
+ "name": "execution_large_value_references_workspace_execution_source_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "execution_large_value_references_workflow_id_idx": {
+ "name": "execution_large_value_references_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "execution_large_value_references_workspace_id_workspace_id_fk": {
+ "name": "execution_large_value_references_workspace_id_workspace_id_fk",
+ "tableFrom": "execution_large_value_references",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "execution_large_value_references_workflow_id_workflow_id_fk": {
+ "name": "execution_large_value_references_workflow_id_workflow_id_fk",
+ "tableFrom": "execution_large_value_references",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "execution_large_value_references_key_execution_id_source_pk": {
+ "name": "execution_large_value_references_key_execution_id_source_pk",
+ "columns": ["key", "execution_id", "source"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.execution_large_values": {
+ "name": "execution_large_values",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_execution_id": {
+ "name": "owner_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "execution_large_values_owner_execution_id_idx": {
+ "name": "execution_large_values_owner_execution_id_idx",
+ "columns": [
+ {
+ "expression": "owner_execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "execution_large_values_cleanup_idx": {
+ "name": "execution_large_values_cleanup_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"execution_large_values\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "execution_large_values_tombstone_cleanup_idx": {
+ "name": "execution_large_values_tombstone_cleanup_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"execution_large_values\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "execution_large_values_workflow_id_idx": {
+ "name": "execution_large_values_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "execution_large_values_workspace_id_idx": {
+ "name": "execution_large_values_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "execution_large_values_workspace_id_workspace_id_fk": {
+ "name": "execution_large_values_workspace_id_workspace_id_fk",
+ "tableFrom": "execution_large_values",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "execution_large_values_workflow_id_workflow_id_fk": {
+ "name": "execution_large_values_workflow_id_workflow_id_fk",
+ "tableFrom": "execution_large_values",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.file_search_dependency": {
+ "name": "file_search_dependency",
+ "schema": "",
+ "columns": {
+ "build_id": {
+ "name": "build_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_id": {
+ "name": "file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_content_updated_at": {
+ "name": "source_content_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "file_search_dependency_file_idx": {
+ "name": "file_search_dependency_file_idx",
+ "columns": [
+ {
+ "expression": "file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "build_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "file_search_dependency_owner_idx": {
+ "name": "file_search_dependency_owner_idx",
+ "columns": [
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "build_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "file_search_dependency_build_id_workspace_file_search_build_id_fk": {
+ "name": "file_search_dependency_build_id_workspace_file_search_build_id_fk",
+ "tableFrom": "file_search_dependency",
+ "tableTo": "workspace_file_search_build",
+ "columnsFrom": ["build_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "file_search_dependency_build_id_file_id_pk": {
+ "name": "file_search_dependency_build_id_file_id_pk",
+ "columns": ["build_id", "file_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.file_search_dispatch_queue": {
+ "name": "file_search_dispatch_queue",
+ "schema": "",
+ "columns": {
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enqueued_at": {
+ "name": "enqueued_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_dispatched_at": {
+ "name": "last_dispatched_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "file_search_dispatch_schedule_idx": {
+ "name": "file_search_dispatch_schedule_idx",
+ "columns": [
+ {
+ "expression": "last_dispatched_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "first"
+ },
+ {
+ "expression": "enqueued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "file_search_dispatch_queue_entity_type_entity_id_pk": {
+ "name": "file_search_dispatch_queue_entity_type_entity_id_pk",
+ "columns": ["entity_type", "entity_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "file_search_dispatch_owner_check": {
+ "name": "file_search_dispatch_owner_check",
+ "value": "\"file_search_dispatch_queue\".\"entity_type\" IN ('workspace', 'project') AND length(\"file_search_dispatch_queue\".\"entity_id\") > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.folder": {
+ "name": "folder",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "folder_resource_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locked": {
+ "name": "locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "folder_project_id_idx": {
+ "name": "folder_project_id_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_project_resource_parent_name_active_unique": {
+ "name": "folder_project_resource_parent_name_active_unique",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"parent_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"folder\".\"deleted_at\" IS NULL AND \"folder\".\"project_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_user_idx": {
+ "name": "folder_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_workspace_resource_parent_idx": {
+ "name": "folder_workspace_resource_parent_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_parent_sort_idx": {
+ "name": "folder_parent_sort_idx",
+ "columns": [
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sort_order",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_deleted_at_idx": {
+ "name": "folder_deleted_at_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_workspace_deleted_partial_idx": {
+ "name": "folder_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"folder\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "folder_workspace_resource_parent_name_active_unique": {
+ "name": "folder_workspace_resource_parent_name_active_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"parent_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"folder\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "folder_project_id_project_id_fk": {
+ "name": "folder_project_id_project_id_fk",
+ "tableFrom": "folder",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "folder_user_id_user_id_fk": {
+ "name": "folder_user_id_user_id_fk",
+ "tableFrom": "folder",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "folder_workspace_id_workspace_id_fk": {
+ "name": "folder_workspace_id_workspace_id_fk",
+ "tableFrom": "folder",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "folder_parent_id_folder_id_fk": {
+ "name": "folder_parent_id_folder_id_fk",
+ "tableFrom": "folder",
+ "tableTo": "folder",
+ "columnsFrom": ["parent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "folder_workspace_parent_owner_fk": {
+ "name": "folder_workspace_parent_owner_fk",
+ "tableFrom": "folder",
+ "tableTo": "folder",
+ "columnsFrom": ["parent_id", "workspace_id", "resource_type"],
+ "columnsTo": ["id", "workspace_id", "resource_type"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "folder_project_parent_owner_fk": {
+ "name": "folder_project_parent_owner_fk",
+ "tableFrom": "folder",
+ "tableTo": "folder",
+ "columnsFrom": ["parent_id", "project_id", "resource_type"],
+ "columnsTo": ["id", "project_id", "resource_type"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "folder_workspace_owner_type_unique": {
+ "name": "folder_workspace_owner_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["id", "workspace_id", "resource_type"]
+ },
+ "folder_project_owner_type_unique": {
+ "name": "folder_project_owner_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["id", "project_id", "resource_type"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "folder_owner_check": {
+ "name": "folder_owner_check",
+ "value": "num_nonnulls(\"folder\".\"workspace_id\", \"folder\".\"project_id\") = 1 AND (\"folder\".\"project_id\" IS NULL OR \"folder\".\"resource_type\" = 'file')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.idempotency_key": {
+ "name": "idempotency_key",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "result": {
+ "name": "result",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idempotency_key_created_at_idx": {
+ "name": "idempotency_key_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "invitation_kind",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'organization'"
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "membership_intent": {
+ "name": "membership_intent",
+ "type": "invitation_membership_intent",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'internal'"
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "invitation_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_organization_id_idx": {
+ "name": "invitation_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_status_idx": {
+ "name": "invitation_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_pending_email_org_unique": {
+ "name": "invitation_pending_email_org_unique",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"invitation\".\"status\" = 'pending' AND \"invitation\".\"organization_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_organization_id_organization_id_fk": {
+ "name": "invitation_organization_id_organization_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "invitation_token_unique": {
+ "name": "invitation_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation_workspace_grant": {
+ "name": "invitation_workspace_grant",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "invitation_id": {
+ "name": "invitation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "permission_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "invitation_workspace_grant_unique": {
+ "name": "invitation_workspace_grant_unique",
+ "columns": [
+ {
+ "expression": "invitation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_workspace_grant_workspace_id_idx": {
+ "name": "invitation_workspace_grant_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_grant_invitation_id_invitation_id_fk": {
+ "name": "invitation_workspace_grant_invitation_id_invitation_id_fk",
+ "tableFrom": "invitation_workspace_grant",
+ "tableTo": "invitation",
+ "columnsFrom": ["invitation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_workspace_grant_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_grant_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation_workspace_grant",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.job_execution_logs": {
+ "name": "job_execution_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "level": {
+ "name": "level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_duration_ms": {
+ "name": "total_duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_data": {
+ "name": "execution_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "cost": {
+ "name": "cost",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "occurrence_at": {
+ "name": "occurrence_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_request_id": {
+ "name": "billing_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "job_execution_logs_schedule_occurrence_unique": {
+ "name": "job_execution_logs_schedule_occurrence_unique",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurrence_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_execution_logs_billing_request_unique": {
+ "name": "job_execution_logs_billing_request_unique",
+ "columns": [
+ {
+ "expression": "billing_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"job_execution_logs\".\"billing_request_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_execution_logs_open_idx": {
+ "name": "job_execution_logs_open_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"job_execution_logs\".\"status\" IN ('queued', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_execution_logs_workspace_started_at_idx": {
+ "name": "job_execution_logs_workspace_started_at_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_execution_logs_workspace_ended_at_id_idx": {
+ "name": "job_execution_logs_workspace_ended_at_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date_trunc('milliseconds', \"ended_at\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_execution_logs_execution_id_unique": {
+ "name": "job_execution_logs_execution_id_unique",
+ "columns": [
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_execution_logs_trigger_idx": {
+ "name": "job_execution_logs_trigger_idx",
+ "columns": [
+ {
+ "expression": "trigger",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_execution_logs_schedule_id_workflow_schedule_id_fk": {
+ "name": "job_execution_logs_schedule_id_workflow_schedule_id_fk",
+ "tableFrom": "job_execution_logs",
+ "tableTo": "workflow_schedule",
+ "columnsFrom": ["schedule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "job_execution_logs_workspace_id_workspace_id_fk": {
+ "name": "job_execution_logs_workspace_id_workspace_id_fk",
+ "tableFrom": "job_execution_logs",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_base": {
+ "name": "knowledge_base",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "folder_id": {
+ "name": "folder_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_search_index": {
+ "name": "is_search_index",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "token_count": {
+ "name": "token_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "embedding_model": {
+ "name": "embedding_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'text-embedding-3-small'"
+ },
+ "embedding_dimension": {
+ "name": "embedding_dimension",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1536
+ },
+ "chunking_config": {
+ "name": "chunking_config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"maxSize\": 1024, \"minSize\": 1, \"overlap\": 200}'"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "kb_organization_id_idx": {
+ "name": "kb_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_organization_search_index_unique": {
+ "name": "kb_organization_search_index_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"knowledge_base\".\"is_search_index\" = true AND \"knowledge_base\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_organization_name_active_unique": {
+ "name": "kb_organization_name_active_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"knowledge_base\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_workspace_id_idx": {
+ "name": "kb_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_user_workspace_idx": {
+ "name": "kb_user_workspace_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_folder_id_idx": {
+ "name": "kb_folder_id_idx",
+ "columns": [
+ {
+ "expression": "folder_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_deleted_at_idx": {
+ "name": "kb_deleted_at_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_workspace_deleted_partial_idx": {
+ "name": "kb_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_base\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_workspace_name_active_unique": {
+ "name": "kb_workspace_name_active_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"knowledge_base\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_workspace_search_index_unique": {
+ "name": "kb_workspace_search_index_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"knowledge_base\".\"is_search_index\" = true AND \"knowledge_base\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_base_user_id_user_id_fk": {
+ "name": "knowledge_base_user_id_user_id_fk",
+ "tableFrom": "knowledge_base",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_base_workspace_id_workspace_id_fk": {
+ "name": "knowledge_base_workspace_id_workspace_id_fk",
+ "tableFrom": "knowledge_base",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_base_organization_id_organization_id_fk": {
+ "name": "knowledge_base_organization_id_organization_id_fk",
+ "tableFrom": "knowledge_base",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_base_folder_id_folder_id_fk": {
+ "name": "knowledge_base_folder_id_folder_id_fk",
+ "tableFrom": "knowledge_base",
+ "tableTo": "folder",
+ "columnsFrom": ["folder_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kb_owner_check": {
+ "name": "kb_owner_check",
+ "value": "num_nonnulls(\"knowledge_base\".\"workspace_id\", \"knowledge_base\".\"organization_id\") = 1"
+ },
+ "kb_organization_search_index_check": {
+ "name": "kb_organization_search_index_check",
+ "value": "\"knowledge_base\".\"organization_id\" IS NULL OR \"knowledge_base\".\"is_search_index\""
+ },
+ "kb_organization_folder_check": {
+ "name": "kb_organization_folder_check",
+ "value": "\"knowledge_base\".\"organization_id\" IS NULL OR \"knowledge_base\".\"folder_id\" IS NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_base_import": {
+ "name": "knowledge_base_import",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_key": {
+ "name": "source_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "documents_total": {
+ "name": "documents_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "documents_imported": {
+ "name": "documents_imported",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "documents_failed": {
+ "name": "documents_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "vectors_reused": {
+ "name": "vectors_reused",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "failures": {
+ "name": "failures",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "knowledge_base_import_watchdog_idx": {
+ "name": "knowledge_base_import_watchdog_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "knowledge_base_import_knowledge_base_id_idx": {
+ "name": "knowledge_base_import_knowledge_base_id_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_base_import_workspace_id_workspace_id_fk": {
+ "name": "knowledge_base_import_workspace_id_workspace_id_fk",
+ "tableFrom": "knowledge_base_import",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_base_import_knowledge_base_id_knowledge_base_id_fk": {
+ "name": "knowledge_base_import_knowledge_base_id_knowledge_base_id_fk",
+ "tableFrom": "knowledge_base_import",
+ "tableTo": "knowledge_base",
+ "columnsFrom": ["knowledge_base_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_base_tag_definitions": {
+ "name": "knowledge_base_tag_definitions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_slot": {
+ "name": "tag_slot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_type": {
+ "name": "field_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'text'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "kb_tag_definitions_kb_slot_idx": {
+ "name": "kb_tag_definitions_kb_slot_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tag_slot",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kb_tag_definitions_kb_display_name_idx": {
+ "name": "kb_tag_definitions_kb_display_name_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "display_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk": {
+ "name": "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk",
+ "tableFrom": "knowledge_base_tag_definitions",
+ "tableTo": "knowledge_base",
+ "columnsFrom": ["knowledge_base_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector": {
+ "name": "knowledge_connector",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connector_type": {
+ "name": "connector_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_config": {
+ "name": "source_config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sync_mode": {
+ "name": "sync_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'full'"
+ },
+ "sync_interval_minutes": {
+ "name": "sync_interval_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1440
+ },
+ "access_mode": {
+ "name": "access_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'workspace'"
+ },
+ "credential_group_id": {
+ "name": "credential_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_group_option_id": {
+ "name": "credential_group_option_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "member_sync_status": {
+ "name": "member_sync_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'idle'"
+ },
+ "member_sync_lock_token": {
+ "name": "member_sync_lock_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "member_sync_lock_lease_at": {
+ "name": "member_sync_lock_lease_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_member_sync_at": {
+ "name": "next_member_sync_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_member_sync_at": {
+ "name": "last_member_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_member_sync_error": {
+ "name": "last_member_sync_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "member_sync_consecutive_failures": {
+ "name": "member_sync_consecutive_failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "access_rewrite_pending": {
+ "name": "access_rewrite_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image_removal_pending": {
+ "name": "image_removal_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "member_tombstone_cursor": {
+ "name": "member_tombstone_cursor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "member_resurrection_cursor": {
+ "name": "member_resurrection_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "last_sync_at": {
+ "name": "last_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_sync_error": {
+ "name": "last_sync_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_sync_doc_count": {
+ "name": "last_sync_doc_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "listing_checkpoint": {
+ "name": "listing_checkpoint",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "directory_checkpoint": {
+ "name": "directory_checkpoint",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_sync_at": {
+ "name": "next_sync_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_directory_sync_at": {
+ "name": "next_directory_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "consecutive_failures": {
+ "name": "consecutive_failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "sync_lock_token": {
+ "name": "sync_lock_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sync_lock_lease_at": {
+ "name": "sync_lock_lease_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "detached_at": {
+ "name": "detached_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "detach_reserved_bytes": {
+ "name": "detach_reserved_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "kc_knowledge_base_id_idx": {
+ "name": "kc_knowledge_base_id_idx",
+ "columns": [
+ {
+ "expression": "knowledge_base_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kc_status_next_sync_idx": {
+ "name": "kc_status_next_sync_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_sync_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kc_archived_at_partial_idx": {
+ "name": "kc_archived_at_partial_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kc_deleted_at_partial_idx": {
+ "name": "kc_deleted_at_partial_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kc_member_sync_due_idx": {
+ "name": "kc_member_sync_due_idx",
+ "columns": [
+ {
+ "expression": "member_sync_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_member_sync_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector\".\"access_mode\" = 'members' AND \"knowledge_connector\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kc_directory_sync_due_idx": {
+ "name": "kc_directory_sync_due_idx",
+ "columns": [
+ {
+ "expression": "next_directory_sync_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector\".\"access_mode\" = 'admin' AND \"knowledge_connector\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_knowledge_base_id_knowledge_base_id_fk": {
+ "name": "knowledge_connector_knowledge_base_id_knowledge_base_id_fk",
+ "tableFrom": "knowledge_connector",
+ "tableTo": "knowledge_base",
+ "columnsFrom": ["knowledge_base_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_connector_credential_group_id_credential_group_id_fk": {
+ "name": "knowledge_connector_credential_group_id_credential_group_id_fk",
+ "tableFrom": "knowledge_connector",
+ "tableTo": "credential_group",
+ "columnsFrom": ["credential_group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kc_access_mode_check": {
+ "name": "kc_access_mode_check",
+ "value": "\"knowledge_connector\".\"access_mode\" IN ('workspace', 'members', 'admin')"
+ },
+ "kc_member_sync_status_check": {
+ "name": "kc_member_sync_status_check",
+ "value": "\"knowledge_connector\".\"member_sync_status\" IN ('idle', 'pending', 'running', 'error', 'disabled')"
+ },
+ "kc_sync_lock_exclusive_check": {
+ "name": "kc_sync_lock_exclusive_check",
+ "value": "NOT (\"knowledge_connector\".\"sync_lock_token\" IS NOT NULL AND \"knowledge_connector\".\"member_sync_lock_token\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_member": {
+ "name": "knowledge_connector_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_token": {
+ "name": "subject_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "consecutive_failures": {
+ "name": "consecutive_failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_started_at": {
+ "name": "last_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_complete_listing_at": {
+ "name": "last_complete_listing_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_listed_count": {
+ "name": "last_listed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "member_synced_through": {
+ "name": "member_synced_through",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope_renewed_at": {
+ "name": "scope_renewed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope_renewal_cursor": {
+ "name": "scope_renewal_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope_renewal_started_at": {
+ "name": "scope_renewal_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "change_cursor": {
+ "name": "change_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "listing_checkpoint": {
+ "name": "listing_checkpoint",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "kcm_organization_id_idx": {
+ "name": "kcm_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcm_connector_credential_unique": {
+ "name": "kcm_connector_credential_unique",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcm_connector_queue_idx": {
+ "name": "kcm_connector_queue_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "first"
+ },
+ {
+ "expression": "last_started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "first"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcm_credential_idx": {
+ "name": "kcm_credential_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_member_workspace_id_workspace_id_fk": {
+ "name": "knowledge_connector_member_workspace_id_workspace_id_fk",
+ "tableFrom": "knowledge_connector_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_connector_member_organization_id_organization_id_fk": {
+ "name": "knowledge_connector_member_organization_id_organization_id_fk",
+ "tableFrom": "knowledge_connector_member",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_connector_member_connector_id_knowledge_connector_id_fk": {
+ "name": "knowledge_connector_member_connector_id_knowledge_connector_id_fk",
+ "tableFrom": "knowledge_connector_member",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_connector_member_credential_id_credential_id_fk": {
+ "name": "knowledge_connector_member_credential_id_credential_id_fk",
+ "tableFrom": "knowledge_connector_member",
+ "tableTo": "credential",
+ "columnsFrom": ["credential_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcm_owner_check": {
+ "name": "kcm_owner_check",
+ "value": "num_nonnulls(\"knowledge_connector_member\".\"workspace_id\", \"knowledge_connector_member\".\"organization_id\") = 1"
+ },
+ "kcm_status_check": {
+ "name": "kcm_status_check",
+ "value": "\"knowledge_connector_member\".\"status\" IN ('active', 'suspended', 'disabled')"
+ },
+ "kcm_subject_token_shape_check": {
+ "name": "kcm_subject_token_shape_check",
+ "value": "\"knowledge_connector_member\".\"subject_token\" ~ '^s:[^:]+:[^:]+:.+$'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_member_sync_log": {
+ "name": "knowledge_connector_member_sync_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "members_claimed": {
+ "name": "members_claimed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "members_completed": {
+ "name": "members_completed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "members_incomplete": {
+ "name": "members_incomplete",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "members_failed": {
+ "name": "members_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_failed": {
+ "name": "docs_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_dispatch_failed": {
+ "name": "processing_dispatch_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "docs_listed": {
+ "name": "docs_listed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_added": {
+ "name": "docs_added",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_updated": {
+ "name": "docs_updated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_unchanged": {
+ "name": "docs_unchanged",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_hydrated_once": {
+ "name": "docs_hydrated_once",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "observations_added": {
+ "name": "observations_added",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "observations_renewed": {
+ "name": "observations_renewed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "observations_removed": {
+ "name": "observations_removed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_tombstoned": {
+ "name": "docs_tombstoned",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_resurrected": {
+ "name": "docs_resurrected",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_purged": {
+ "name": "docs_purged",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "credentials_audited": {
+ "name": "credentials_audited",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "database_failure_class": {
+ "name": "database_failure_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "kcmsl_connector_started_at_idx": {
+ "name": "kcmsl_connector_started_at_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "\"started_at\" DESC",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcmsl_started_at_partial_idx": {
+ "name": "kcmsl_started_at_partial_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector_member_sync_log\".\"status\" = 'started'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk": {
+ "name": "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk",
+ "tableFrom": "knowledge_connector_member_sync_log",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcmsl_status_check": {
+ "name": "kcmsl_status_check",
+ "value": "\"knowledge_connector_member_sync_log\".\"status\" IN ('started', 'partial', 'completed', 'failed')"
+ },
+ "kcmsl_database_failure_class_check": {
+ "name": "kcmsl_database_failure_class_check",
+ "value": "\"knowledge_connector_member_sync_log\".\"database_failure_class\" IN ('capacity', 'conflict', 'connection')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_partition": {
+ "name": "knowledge_connector_partition",
+ "schema": "",
+ "columns": {
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "partition_key": {
+ "name": "partition_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generation_id": {
+ "name": "generation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "context": {
+ "name": "context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "retry_at": {
+ "name": "retry_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_served_at": {
+ "name": "last_served_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure": {
+ "name": "failure",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_cursor": {
+ "name": "permission_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_attempts": {
+ "name": "permission_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "permission_retry_at": {
+ "name": "permission_retry_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_last_served_at": {
+ "name": "permission_last_served_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_started_at": {
+ "name": "permission_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_failure": {
+ "name": "permission_failure",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "kcp_content_due_idx": {
+ "name": "kcp_content_due_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "generation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "retry_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_served_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcp_permission_due_idx": {
+ "name": "kcp_permission_due_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "generation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission_retry_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission_last_served_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_partition_connector_id_knowledge_connector_id_fk": {
+ "name": "knowledge_connector_partition_connector_id_knowledge_connector_id_fk",
+ "tableFrom": "knowledge_connector_partition",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "kcp_pk": {
+ "name": "kcp_pk",
+ "columns": ["connector_id", "partition_key"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcp_partition_key_check": {
+ "name": "kcp_partition_key_check",
+ "value": "octet_length(\"knowledge_connector_partition\".\"partition_key\") BETWEEN 1 AND 1024"
+ },
+ "kcp_context_check": {
+ "name": "kcp_context_check",
+ "value": "jsonb_typeof(\"knowledge_connector_partition\".\"context\") = 'object' AND octet_length(\"knowledge_connector_partition\".\"context\"::text) <= 16384"
+ },
+ "kcp_status_check": {
+ "name": "kcp_status_check",
+ "value": "\"knowledge_connector_partition\".\"status\" IN ('pending', 'complete', 'blocked')"
+ },
+ "kcp_cursor_check": {
+ "name": "kcp_cursor_check",
+ "value": "(\"knowledge_connector_partition\".\"cursor\" IS NULL OR octet_length(\"knowledge_connector_partition\".\"cursor\") <= 393216) AND (\"knowledge_connector_partition\".\"permission_cursor\" IS NULL OR octet_length(\"knowledge_connector_partition\".\"permission_cursor\") <= 393216)"
+ },
+ "kcp_attempts_check": {
+ "name": "kcp_attempts_check",
+ "value": "\"knowledge_connector_partition\".\"attempts\" >= 0 AND \"knowledge_connector_partition\".\"permission_attempts\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_permission_grant": {
+ "name": "knowledge_connector_permission_grant",
+ "schema": "",
+ "columns": {
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_key": {
+ "name": "group_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_token": {
+ "name": "subject_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "kcpg_subject_idx": {
+ "name": "kcpg_subject_idx",
+ "columns": [
+ {
+ "expression": "subject_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "group_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kcpg_snapshot_fk": {
+ "name": "kcpg_snapshot_fk",
+ "tableFrom": "knowledge_connector_permission_grant",
+ "tableTo": "knowledge_connector_permission_snapshot",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["connector_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "kcpg_pk": {
+ "name": "kcpg_pk",
+ "columns": ["connector_id", "group_key", "subject_token"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcpg_group_check": {
+ "name": "kcpg_group_check",
+ "value": "length(\"knowledge_connector_permission_grant\".\"group_key\") BETWEEN 1 AND 255"
+ },
+ "kcpg_subject_check": {
+ "name": "kcpg_subject_check",
+ "value": "\"knowledge_connector_permission_grant\".\"subject_token\" ~ '^u:[^[:space:]A-Z]+@[^[:space:]A-Z]+$'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_permission_import": {
+ "name": "knowledge_connector_permission_import",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_binding": {
+ "name": "credential_binding",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expected_revision": {
+ "name": "expected_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "manifest": {
+ "name": "manifest",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "part_digests": {
+ "name": "part_digests",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "user_rows": {
+ "name": "user_rows",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "project_rows": {
+ "name": "project_rows",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "completed_revision": {
+ "name": "completed_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "kcpi_connector_idx": {
+ "name": "kcpi_connector_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcpi_expires_idx": {
+ "name": "kcpi_expires_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_permission_import_connector_id_knowledge_connector_id_fk": {
+ "name": "knowledge_connector_permission_import_connector_id_knowledge_connector_id_fk",
+ "tableFrom": "knowledge_connector_permission_import",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcpi_revision_check": {
+ "name": "kcpi_revision_check",
+ "value": "\"knowledge_connector_permission_import\".\"expected_revision\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_permission_import_grant": {
+ "name": "knowledge_connector_permission_import_grant",
+ "schema": "",
+ "columns": {
+ "import_id": {
+ "name": "import_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_path": {
+ "name": "project_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_key": {
+ "name": "group_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "kcpig_subject_idx": {
+ "name": "kcpig_subject_idx",
+ "columns": [
+ {
+ "expression": "import_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "group_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_permission_import_grant_import_id_knowledge_connector_permission_import_id_fk": {
+ "name": "knowledge_connector_permission_import_grant_import_id_knowledge_connector_permission_import_id_fk",
+ "tableFrom": "knowledge_connector_permission_import_grant",
+ "tableTo": "knowledge_connector_permission_import",
+ "columnsFrom": ["import_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "kcpig_pk": {
+ "name": "kcpig_pk",
+ "columns": ["import_id", "project_path", "user_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_permission_import_identity": {
+ "name": "knowledge_connector_permission_import_identity",
+ "schema": "",
+ "columns": {
+ "import_id": {
+ "name": "import_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_token": {
+ "name": "subject_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "kcpii_subject_import_idx": {
+ "name": "kcpii_subject_import_idx",
+ "columns": [
+ {
+ "expression": "subject_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "import_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_permission_import_identity_import_id_knowledge_connector_permission_import_id_fk": {
+ "name": "knowledge_connector_permission_import_identity_import_id_knowledge_connector_permission_import_id_fk",
+ "tableFrom": "knowledge_connector_permission_import_identity",
+ "tableTo": "knowledge_connector_permission_import",
+ "columnsFrom": ["import_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "kcpii_pk": {
+ "name": "kcpii_pk",
+ "columns": ["import_id", "user_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_permission_snapshot": {
+ "name": "knowledge_connector_permission_snapshot",
+ "schema": "",
+ "columns": {
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kcps_connector_fk": {
+ "name": "kcps_connector_fk",
+ "tableFrom": "knowledge_connector_permission_snapshot",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcps_revision_check": {
+ "name": "kcps_revision_check",
+ "value": "\"knowledge_connector_permission_snapshot\".\"revision\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_connector_sync_log": {
+ "name": "knowledge_connector_sync_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connector_id": {
+ "name": "connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "docs_added": {
+ "name": "docs_added",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_updated": {
+ "name": "docs_updated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_deleted": {
+ "name": "docs_deleted",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_unchanged": {
+ "name": "docs_unchanged",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_skipped": {
+ "name": "docs_skipped",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "docs_failed": {
+ "name": "docs_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "listed_count": {
+ "name": "listed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "database_failure_class": {
+ "name": "database_failure_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "kcsl_connector_started_at_idx": {
+ "name": "kcsl_connector_started_at_idx",
+ "columns": [
+ {
+ "expression": "connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "\"started_at\" DESC",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcsl_started_at_partial_idx": {
+ "name": "kcsl_started_at_partial_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector_sync_log\".\"status\" = 'started'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "kcsl_terminal_started_at_idx": {
+ "name": "kcsl_terminal_started_at_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"knowledge_connector_sync_log\".\"status\" IN ('completed', 'failed')",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk": {
+ "name": "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk",
+ "tableFrom": "knowledge_connector_sync_log",
+ "tableTo": "knowledge_connector",
+ "columnsFrom": ["connector_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kcsl_database_failure_class_check": {
+ "name": "kcsl_database_failure_class_check",
+ "value": "\"knowledge_connector_sync_log\".\"database_failure_class\" IN ('capacity', 'conflict', 'connection')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_document_observation": {
+ "name": "knowledge_document_observation",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member_id": {
+ "name": "member_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "kdo_member_idx": {
+ "name": "kdo_member_idx",
+ "columns": [
+ {
+ "expression": "member_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_document_observation_document_id_document_id_fk": {
+ "name": "knowledge_document_observation_document_id_document_id_fk",
+ "tableFrom": "knowledge_document_observation",
+ "tableTo": "document",
+ "columnsFrom": ["document_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_document_observation_member_id_knowledge_connector_member_id_fk": {
+ "name": "knowledge_document_observation_member_id_knowledge_connector_member_id_fk",
+ "tableFrom": "knowledge_document_observation",
+ "tableTo": "knowledge_connector_member",
+ "columnsFrom": ["member_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "knowledge_document_observation_document_id_member_id_pk": {
+ "name": "knowledge_document_observation_document_id_member_id_pk",
+ "columns": ["document_id", "member_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_external_directory": {
+ "name": "knowledge_external_directory",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sync_lock_token": {
+ "name": "sync_lock_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sync_lock_lease_at": {
+ "name": "sync_lock_lease_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_started_at": {
+ "name": "last_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_complete_sync_at": {
+ "name": "last_complete_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "ked_workspace_identity_unique": {
+ "name": "ked_workspace_identity_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ked_organization_identity_unique": {
+ "name": "ked_organization_identity_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_external_directory_workspace_id_workspace_id_fk": {
+ "name": "knowledge_external_directory_workspace_id_workspace_id_fk",
+ "tableFrom": "knowledge_external_directory",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_external_directory_organization_id_organization_id_fk": {
+ "name": "knowledge_external_directory_organization_id_organization_id_fk",
+ "tableFrom": "knowledge_external_directory",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "ked_owner_check": {
+ "name": "ked_owner_check",
+ "value": "num_nonnulls(\"knowledge_external_directory\".\"workspace_id\", \"knowledge_external_directory\".\"organization_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_external_group": {
+ "name": "knowledge_external_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_group_id": {
+ "name": "external_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_synced_at": {
+ "name": "last_synced_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "keg_organization_identity_unique": {
+ "name": "keg_organization_identity_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "keg_organization_synced_idx": {
+ "name": "keg_organization_synced_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_synced_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "first"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "keg_identity_unique": {
+ "name": "keg_identity_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "keg_workspace_synced_idx": {
+ "name": "keg_workspace_synced_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_synced_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "first"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_external_group_organization_id_organization_id_fk": {
+ "name": "knowledge_external_group_organization_id_organization_id_fk",
+ "tableFrom": "knowledge_external_group",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "keg_workspace_fk": {
+ "name": "keg_workspace_fk",
+ "tableFrom": "knowledge_external_group",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "keg_owner_check": {
+ "name": "keg_owner_check",
+ "value": "num_nonnulls(\"knowledge_external_group\".\"workspace_id\", \"knowledge_external_group\".\"organization_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.knowledge_external_group_member": {
+ "name": "knowledge_external_group_member",
+ "schema": "",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_token": {
+ "name": "subject_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "kegm_subject_token_idx": {
+ "name": "kegm_subject_token_idx",
+ "columns": [
+ {
+ "expression": "subject_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kegm_group_fk": {
+ "name": "kegm_group_fk",
+ "tableFrom": "knowledge_external_group_member",
+ "tableTo": "knowledge_external_group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "knowledge_external_group_member_group_id_subject_token_pk": {
+ "name": "knowledge_external_group_member_group_id_subject_token_pk",
+ "columns": ["group_id", "subject_token"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_projection_dirty": {
+ "name": "knowledge_projection_dirty",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "generation": {
+ "name": "generation",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "content": {
+ "name": "content",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "marked_at": {
+ "name": "marked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "knowledge_projection_dirty_marked_at_idx": {
+ "name": "knowledge_projection_dirty_marked_at_idx",
+ "columns": [
+ {
+ "expression": "marked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_projection_dirty_document_id_document_id_fk": {
+ "name": "knowledge_projection_dirty_document_id_document_id_fk",
+ "tableFrom": "knowledge_projection_dirty",
+ "tableTo": "document",
+ "columnsFrom": ["document_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_server_oauth": {
+ "name": "mcp_server_oauth",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "mcp_server_id": {
+ "name": "mcp_server_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_information": {
+ "name": "client_information",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tokens": {
+ "name": "tokens",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "code_verifier": {
+ "name": "code_verifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state_created_at": {
+ "name": "state_created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refreshed_at": {
+ "name": "last_refreshed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_server_oauth_server_unique": {
+ "name": "mcp_server_oauth_server_unique",
+ "columns": [
+ {
+ "expression": "mcp_server_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_server_oauth_state_idx": {
+ "name": "mcp_server_oauth_state_idx",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk": {
+ "name": "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk",
+ "tableFrom": "mcp_server_oauth",
+ "tableTo": "mcp_servers",
+ "columnsFrom": ["mcp_server_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_server_oauth_user_id_user_id_fk": {
+ "name": "mcp_server_oauth_user_id_user_id_fk",
+ "tableFrom": "mcp_server_oauth",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "mcp_server_oauth_workspace_id_workspace_id_fk": {
+ "name": "mcp_server_oauth_workspace_id_workspace_id_fk",
+ "tableFrom": "mcp_server_oauth",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_server_oauth_organization_id_organization_id_fk": {
+ "name": "mcp_server_oauth_organization_id_organization_id_fk",
+ "tableFrom": "mcp_server_oauth",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_server_oauth_owner_check": {
+ "name": "mcp_server_oauth_owner_check",
+ "value": "num_nonnulls(\"mcp_server_oauth\".\"workspace_id\", \"mcp_server_oauth\".\"organization_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_servers": {
+ "name": "mcp_servers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_group_id": {
+ "name": "credential_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "managed_connector_id": {
+ "name": "managed_connector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_config_version": {
+ "name": "oauth_config_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transport": {
+ "name": "transport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_type": {
+ "name": "auth_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'headers'"
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_client_secret": {
+ "name": "oauth_client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "headers": {
+ "name": "headers",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 30000
+ },
+ "retries": {
+ "name": "retries",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 3
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "last_connected": {
+ "name": "last_connected",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_status": {
+ "name": "connection_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'disconnected'"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_config": {
+ "name": "status_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "tool_count": {
+ "name": "tool_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "last_tools_refresh": {
+ "name": "last_tools_refresh",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_requests": {
+ "name": "total_requests",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "last_used": {
+ "name": "last_used",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_servers_organization_id_idx": {
+ "name": "mcp_servers_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_servers_workspace_enabled_idx": {
+ "name": "mcp_servers_workspace_enabled_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_servers_credential_group_idx": {
+ "name": "mcp_servers_credential_group_idx",
+ "columns": [
+ {
+ "expression": "credential_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_servers_credential_group_managed_connector_unique": {
+ "name": "mcp_servers_credential_group_managed_connector_unique",
+ "columns": [
+ {
+ "expression": "credential_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "managed_connector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_servers\".\"credential_group_id\" IS NOT NULL AND \"mcp_servers\".\"managed_connector_id\" IS NOT NULL AND \"mcp_servers\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_servers_workspace_deleted_partial_idx": {
+ "name": "mcp_servers_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"mcp_servers\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_servers_workspace_id_workspace_id_fk": {
+ "name": "mcp_servers_workspace_id_workspace_id_fk",
+ "tableFrom": "mcp_servers",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_servers_organization_id_organization_id_fk": {
+ "name": "mcp_servers_organization_id_organization_id_fk",
+ "tableFrom": "mcp_servers",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_servers_credential_group_id_credential_group_id_fk": {
+ "name": "mcp_servers_credential_group_id_credential_group_id_fk",
+ "tableFrom": "mcp_servers",
+ "tableTo": "credential_group",
+ "columnsFrom": ["credential_group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "mcp_servers_created_by_user_id_fk": {
+ "name": "mcp_servers_created_by_user_id_fk",
+ "tableFrom": "mcp_servers",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_servers_owner_check": {
+ "name": "mcp_servers_owner_check",
+ "value": "num_nonnulls(\"mcp_servers\".\"workspace_id\", \"mcp_servers\".\"organization_id\") = 1"
+ },
+ "mcp_servers_organization_managed_check": {
+ "name": "mcp_servers_organization_managed_check",
+ "value": "\"mcp_servers\".\"organization_id\" IS NULL OR \"mcp_servers\".\"credential_group_id\" IS NOT NULL"
+ },
+ "mcp_servers_credential_group_managed_connector_check": {
+ "name": "mcp_servers_credential_group_managed_connector_check",
+ "value": "\"mcp_servers\".\"credential_group_id\" IS NULL OR \"mcp_servers\".\"managed_connector_id\" IS NOT NULL"
+ },
+ "mcp_servers_managed_connector_oauth_check": {
+ "name": "mcp_servers_managed_connector_oauth_check",
+ "value": "\"mcp_servers\".\"managed_connector_id\" IS NULL OR \"mcp_servers\".\"auth_type\" = 'oauth'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.member": {
+ "name": "member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "member_user_id_unique": {
+ "name": "member_user_id_unique",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_organization_id_idx": {
+ "name": "member_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "member_user_id_user_id_fk": {
+ "name": "member_user_id_user_id_fk",
+ "tableFrom": "member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_organization_id_organization_id_fk": {
+ "name": "member_organization_id_organization_id_fk",
+ "tableFrom": "member",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member_profile": {
+ "name": "member_profile",
+ "schema": "",
+ "columns": {
+ "member_id": {
+ "name": "member_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "department": {
+ "name": "department",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manager_member_id": {
+ "name": "manager_member_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "member_profile_manager_member_id_idx": {
+ "name": "member_profile_manager_member_id_idx",
+ "columns": [
+ {
+ "expression": "manager_member_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_profile_updated_by_idx": {
+ "name": "member_profile_updated_by_idx",
+ "columns": [
+ {
+ "expression": "updated_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "member_profile_member_id_member_id_fk": {
+ "name": "member_profile_member_id_member_id_fk",
+ "tableFrom": "member_profile",
+ "tableTo": "member",
+ "columnsFrom": ["member_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_profile_manager_member_id_member_id_fk": {
+ "name": "member_profile_manager_member_id_member_id_fk",
+ "tableFrom": "member_profile",
+ "tableTo": "member",
+ "columnsFrom": ["manager_member_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "member_profile_updated_by_user_id_fk": {
+ "name": "member_profile_updated_by_user_id_fk",
+ "tableFrom": "member_profile",
+ "tableTo": "user",
+ "columnsFrom": ["updated_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "member_profile_not_own_manager": {
+ "name": "member_profile_not_own_manager",
+ "value": "\"member_profile\".\"manager_member_id\" <> \"member_profile\".\"member_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.memory": {
+ "name": "memory",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_version": {
+ "name": "storage_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "encrypted_context_summary": {
+ "name": "encrypted_context_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_provenance_version": {
+ "name": "secret_provenance_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "memory_key_idx": {
+ "name": "memory_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "memory_workspace_key_idx": {
+ "name": "memory_workspace_key_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "memory_workspace_deleted_partial_idx": {
+ "name": "memory_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"memory\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "memory_workspace_id_workspace_id_fk": {
+ "name": "memory_workspace_id_workspace_id_fk",
+ "tableFrom": "memory",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.memory_artifact": {
+ "name": "memory_artifact",
+ "schema": "",
+ "columns": {
+ "memory_id": {
+ "name": "memory_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "memory_artifact_key_idx": {
+ "name": "memory_artifact_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "memory_artifact_memory_id_memory_id_fk": {
+ "name": "memory_artifact_memory_id_memory_id_fk",
+ "tableFrom": "memory_artifact",
+ "tableTo": "memory",
+ "columnsFrom": ["memory_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "memory_artifact_key_execution_large_values_key_fk": {
+ "name": "memory_artifact_key_execution_large_values_key_fk",
+ "tableFrom": "memory_artifact",
+ "tableTo": "execution_large_values",
+ "columnsFrom": ["key"],
+ "columnsTo": ["key"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "memory_artifact_memory_id_key_pk": {
+ "name": "memory_artifact_memory_id_key_pk",
+ "columns": ["memory_id", "key"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.memory_item": {
+ "name": "memory_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "memory_id": {
+ "name": "memory_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "memory_item_sequence_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "9223372036854775807",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "append_key": {
+ "name": "append_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provenance_status": {
+ "name": "provenance_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provenance_entries": {
+ "name": "provenance_entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "memory_item_append_unique": {
+ "name": "memory_item_append_unique",
+ "columns": [
+ {
+ "expression": "memory_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "append_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "memory_item_sequence_idx": {
+ "name": "memory_item_sequence_idx",
+ "columns": [
+ {
+ "expression": "memory_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sequence",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "memory_item_memory_id_memory_id_fk": {
+ "name": "memory_item_memory_id_memory_id_fk",
+ "tableFrom": "memory_item",
+ "tableTo": "memory",
+ "columnsFrom": ["memory_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "memory_item_kind_check": {
+ "name": "memory_item_kind_check",
+ "value": "\"memory_item\".\"kind\" IN ('message', 'exchange')"
+ },
+ "memory_item_provenance_status_check": {
+ "name": "memory_item_provenance_status_check",
+ "value": "\"memory_item\".\"provenance_status\" IN ('exact', 'unknown')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.memory_secret_provenance": {
+ "name": "memory_secret_provenance",
+ "schema": "",
+ "columns": {
+ "memory_id": {
+ "name": "memory_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entries": {
+ "name": "entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "memory_secret_provenance_memory_id_memory_id_fk": {
+ "name": "memory_secret_provenance_memory_id_memory_id_fk",
+ "tableFrom": "memory_secret_provenance",
+ "tableTo": "memory",
+ "columnsFrom": ["memory_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "memory_secret_provenance_status_check": {
+ "name": "memory_secret_provenance_status_check",
+ "value": "\"memory_secret_provenance\".\"status\" IN ('exact', 'unknown')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mothership_benchmark_runs": {
+ "name": "mothership_benchmark_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "benchmark_id": {
+ "name": "benchmark_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "evaluation_key": {
+ "name": "evaluation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reviews": {
+ "name": "reviews",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "reviewed_at": {
+ "name": "reviewed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "correct": {
+ "name": "correct",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "automatic_correct": {
+ "name": "automatic_correct",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total": {
+ "name": "total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "artifacts": {
+ "name": "artifacts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mothership_benchmark_runs_benchmark_created_idx": {
+ "name": "mothership_benchmark_runs_benchmark_created_idx",
+ "columns": [
+ {
+ "expression": "benchmark_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mothership_benchmark_runs_benchmark_id_mothership_benchmarks_id_fk": {
+ "name": "mothership_benchmark_runs_benchmark_id_mothership_benchmarks_id_fk",
+ "tableFrom": "mothership_benchmark_runs",
+ "tableTo": "mothership_benchmarks",
+ "columnsFrom": ["benchmark_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mothership_benchmark_runs_score_check": {
+ "name": "mothership_benchmark_runs_score_check",
+ "value": "\"mothership_benchmark_runs\".\"total\" > 0 AND \"mothership_benchmark_runs\".\"correct\" >= 0 AND \"mothership_benchmark_runs\".\"correct\" <= \"mothership_benchmark_runs\".\"total\""
+ },
+ "mothership_benchmark_runs_version_check": {
+ "name": "mothership_benchmark_runs_version_check",
+ "value": "\"mothership_benchmark_runs\".\"version\" > 0"
+ },
+ "mothership_benchmark_runs_automatic_score_check": {
+ "name": "mothership_benchmark_runs_automatic_score_check",
+ "value": "\"mothership_benchmark_runs\".\"automatic_correct\" >= 0 AND \"mothership_benchmark_runs\".\"automatic_correct\" <= \"mothership_benchmark_runs\".\"total\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mothership_benchmarks": {
+ "name": "mothership_benchmarks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_as_user_id": {
+ "name": "run_as_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_workspace_id": {
+ "name": "source_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "artifacts": {
+ "name": "artifacts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "running_stage": {
+ "name": "running_stage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_id": {
+ "name": "attempt_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "planner_chat_id": {
+ "name": "planner_chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mothership_benchmarks_owner_created_idx": {
+ "name": "mothership_benchmarks_owner_created_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mothership_benchmarks_workspace_idx": {
+ "name": "mothership_benchmarks_workspace_idx",
+ "columns": [
+ {
+ "expression": "source_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mothership_benchmarks_organization_id_organization_id_fk": {
+ "name": "mothership_benchmarks_organization_id_organization_id_fk",
+ "tableFrom": "mothership_benchmarks",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_benchmarks_user_id_user_id_fk": {
+ "name": "mothership_benchmarks_user_id_user_id_fk",
+ "tableFrom": "mothership_benchmarks",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_benchmarks_run_as_user_id_user_id_fk": {
+ "name": "mothership_benchmarks_run_as_user_id_user_id_fk",
+ "tableFrom": "mothership_benchmarks",
+ "tableTo": "user",
+ "columnsFrom": ["run_as_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_benchmarks_source_workspace_id_workspace_id_fk": {
+ "name": "mothership_benchmarks_source_workspace_id_workspace_id_fk",
+ "tableFrom": "mothership_benchmarks",
+ "tableTo": "workspace",
+ "columnsFrom": ["source_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mothership_benchmarks_version_check": {
+ "name": "mothership_benchmarks_version_check",
+ "value": "\"mothership_benchmarks\".\"version\" > 0"
+ },
+ "mothership_benchmarks_attempt_check": {
+ "name": "mothership_benchmarks_attempt_check",
+ "value": "(\"mothership_benchmarks\".\"running_stage\" IS NULL AND \"mothership_benchmarks\".\"attempt_id\" IS NULL AND \"mothership_benchmarks\".\"lease_expires_at\" IS NULL) OR (\"mothership_benchmarks\".\"running_stage\" IS NOT NULL AND \"mothership_benchmarks\".\"running_stage\" IN ('distill', 'redact', 'plan', 'reconstruct', 'grade') AND \"mothership_benchmarks\".\"attempt_id\" IS NOT NULL AND \"mothership_benchmarks\".\"lease_expires_at\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mothership_inbox_allowed_sender": {
+ "name": "mothership_inbox_allowed_sender",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "added_by": {
+ "name": "added_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "inbox_sender_ws_email_idx": {
+ "name": "inbox_sender_ws_email_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk": {
+ "name": "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk",
+ "tableFrom": "mothership_inbox_allowed_sender",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_inbox_allowed_sender_added_by_user_id_fk": {
+ "name": "mothership_inbox_allowed_sender_added_by_user_id_fk",
+ "tableFrom": "mothership_inbox_allowed_sender",
+ "tableTo": "user",
+ "columnsFrom": ["added_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mothership_inbox_task": {
+ "name": "mothership_inbox_task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_email": {
+ "name": "from_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sender_authenticated": {
+ "name": "sender_authenticated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "from_name": {
+ "name": "from_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject": {
+ "name": "subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body_preview": {
+ "name": "body_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body_text": {
+ "name": "body_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body_html": {
+ "name": "body_html",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_message_id": {
+ "name": "email_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "in_reply_to": {
+ "name": "in_reply_to",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_message_id": {
+ "name": "response_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agentmail_message_id": {
+ "name": "agentmail_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'received'"
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_job_id": {
+ "name": "trigger_job_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejection_reason": {
+ "name": "rejection_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_attachments": {
+ "name": "has_attachments",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cc_recipients": {
+ "name": "cc_recipients",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "processing_started_at": {
+ "name": "processing_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "inbox_task_ws_created_at_idx": {
+ "name": "inbox_task_ws_created_at_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "inbox_task_ws_status_idx": {
+ "name": "inbox_task_ws_status_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "inbox_task_response_msg_id_idx": {
+ "name": "inbox_task_response_msg_id_idx",
+ "columns": [
+ {
+ "expression": "response_message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "inbox_task_email_msg_id_idx": {
+ "name": "inbox_task_email_msg_id_idx",
+ "columns": [
+ {
+ "expression": "email_message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mothership_inbox_task_workspace_id_workspace_id_fk": {
+ "name": "mothership_inbox_task_workspace_id_workspace_id_fk",
+ "tableFrom": "mothership_inbox_task",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_inbox_task_chat_id_copilot_chats_id_fk": {
+ "name": "mothership_inbox_task_chat_id_copilot_chats_id_fk",
+ "tableFrom": "mothership_inbox_task",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mothership_inbox_webhook": {
+ "name": "mothership_inbox_webhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "webhook_id": {
+ "name": "webhook_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "mothership_inbox_webhook_workspace_id_workspace_id_fk": {
+ "name": "mothership_inbox_webhook_workspace_id_workspace_id_fk",
+ "tableFrom": "mothership_inbox_webhook",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "mothership_inbox_webhook_workspace_id_unique": {
+ "name": "mothership_inbox_webhook_workspace_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mothership_memory_selections": {
+ "name": "mothership_memory_selections",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "space_id": {
+ "name": "space_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "mothership_memory_selections_user_id_user_id_fk": {
+ "name": "mothership_memory_selections_user_id_user_id_fk",
+ "tableFrom": "mothership_memory_selections",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_memory_selections_organization_id_organization_id_fk": {
+ "name": "mothership_memory_selections_organization_id_organization_id_fk",
+ "tableFrom": "mothership_memory_selections",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_memory_selections_space_id_mothership_memory_spaces_id_fk": {
+ "name": "mothership_memory_selections_space_id_mothership_memory_spaces_id_fk",
+ "tableFrom": "mothership_memory_selections",
+ "tableTo": "mothership_memory_spaces",
+ "columnsFrom": ["space_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "mothership_memory_selections_user_id_organization_id_pk": {
+ "name": "mothership_memory_selections_user_id_organization_id_pk",
+ "columns": ["user_id", "organization_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mothership_memory_spaces": {
+ "name": "mothership_memory_spaces",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mothership_memory_spaces_owner_idx": {
+ "name": "mothership_memory_spaces_owner_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mothership_memory_spaces_user_id_user_id_fk": {
+ "name": "mothership_memory_spaces_user_id_user_id_fk",
+ "tableFrom": "mothership_memory_spaces",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mothership_memory_spaces_organization_id_organization_id_fk": {
+ "name": "mothership_memory_spaces_organization_id_organization_id_fk",
+ "tableFrom": "mothership_memory_spaces",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mothership_resource_effects": {
+ "name": "mothership_resource_effects",
+ "schema": "",
+ "columns": {
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effect_id": {
+ "name": "effect_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "mothership_resource_effects_chat_id_copilot_chats_id_fk": {
+ "name": "mothership_resource_effects_chat_id_copilot_chats_id_fk",
+ "tableFrom": "mothership_resource_effects",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "mothership_resource_effects_chat_id_effect_id_pk": {
+ "name": "mothership_resource_effects_chat_id_effect_id_pk",
+ "columns": ["chat_id", "effect_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_access_token": {
+ "name": "oauth_access_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_id": {
+ "name": "refresh_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauth_access_token_client_id_idx": {
+ "name": "oauth_access_token_client_id_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_access_token_session_id_idx": {
+ "name": "oauth_access_token_session_id_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_access_token_refresh_id_idx": {
+ "name": "oauth_access_token_refresh_id_idx",
+ "columns": [
+ {
+ "expression": "refresh_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_access_token_user_client_idx": {
+ "name": "oauth_access_token_user_client_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_access_token_expires_at_idx": {
+ "name": "oauth_access_token_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_access_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_access_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": ["client_id"],
+ "columnsTo": ["client_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_session_id_session_id_fk": {
+ "name": "oauth_access_token_session_id_session_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "session",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_user_id_user_id_fk": {
+ "name": "oauth_access_token_user_id_user_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": {
+ "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_refresh_token",
+ "columnsFrom": ["refresh_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_access_token_token_unique": {
+ "name": "oauth_access_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "oauth_access_token_search_resource_check": {
+ "name": "oauth_access_token_search_resource_check",
+ "value": "NOT ('search:read' = ANY(\"oauth_access_token\".\"scopes\")) OR \"oauth_access_token\".\"resource\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.oauth_client": {
+ "name": "oauth_client",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_secret": {
+ "name": "client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "skip_consent": {
+ "name": "skip_consent",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enable_end_session": {
+ "name": "enable_end_session",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uri": {
+ "name": "uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contacts": {
+ "name": "contacts",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tos": {
+ "name": "tos",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy": {
+ "name": "policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_id": {
+ "name": "software_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_version": {
+ "name": "software_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_statement": {
+ "name": "software_statement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "post_logout_redirect_uris": {
+ "name": "post_logout_redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_endpoint_auth_method": {
+ "name": "token_endpoint_auth_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_types": {
+ "name": "grant_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_types": {
+ "name": "response_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public": {
+ "name": "public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "require_pkce": {
+ "name": "require_pkce",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauth_client_user_id_idx": {
+ "name": "oauth_client_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_user_id_user_id_fk": {
+ "name": "oauth_client_user_id_user_id_fk",
+ "tableFrom": "oauth_client",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_client_client_id_unique": {
+ "name": "oauth_client_client_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["client_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_consent": {
+ "name": "oauth_consent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauth_consent_client_id_idx": {
+ "name": "oauth_consent_client_id_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_consent_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_consent_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "oauth_client",
+ "columnsFrom": ["client_id"],
+ "columnsTo": ["client_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_consent_user_id_user_id_fk": {
+ "name": "oauth_consent_user_id_user_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_consent_user_client_reference_unique": {
+ "name": "oauth_consent_user_client_reference_unique",
+ "nullsNotDistinct": true,
+ "columns": ["user_id", "client_id", "reference_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_refresh_token": {
+ "name": "oauth_refresh_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_time": {
+ "name": "auth_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "family_id": {
+ "name": "family_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauth_refresh_token_client_id_idx": {
+ "name": "oauth_refresh_token_client_id_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_refresh_token_session_id_idx": {
+ "name": "oauth_refresh_token_session_id_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_refresh_token_user_client_idx": {
+ "name": "oauth_refresh_token_user_client_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_refresh_token_expires_at_idx": {
+ "name": "oauth_refresh_token_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_refresh_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": ["client_id"],
+ "columnsTo": ["client_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_session_id_session_id_fk": {
+ "name": "oauth_refresh_token_session_id_session_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "session",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_user_id_user_id_fk": {
+ "name": "oauth_refresh_token_user_id_user_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_family_id_oauth_token_family_id_fk": {
+ "name": "oauth_refresh_token_family_id_oauth_token_family_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "oauth_token_family",
+ "columnsFrom": ["family_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_refresh_token_token_unique": {
+ "name": "oauth_refresh_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ },
+ "oauth_refresh_token_family_generation_unique": {
+ "name": "oauth_refresh_token_family_generation_unique",
+ "nullsNotDistinct": false,
+ "columns": ["family_id", "generation"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "oauth_refresh_token_generation_check": {
+ "name": "oauth_refresh_token_generation_check",
+ "value": "\"oauth_refresh_token\".\"generation\" BETWEEN 0 AND 1000"
+ },
+ "oauth_refresh_token_search_resource_check": {
+ "name": "oauth_refresh_token_search_resource_check",
+ "value": "NOT ('search:read' = ANY(\"oauth_refresh_token\".\"scopes\")) OR \"oauth_refresh_token\".\"resource\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.oauth_token_family": {
+ "name": "oauth_token_family",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consent_id": {
+ "name": "consent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_generation": {
+ "name": "current_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauth_token_family_client_id_idx": {
+ "name": "oauth_token_family_client_id_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_token_family_session_id_idx": {
+ "name": "oauth_token_family_session_id_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_token_family_user_client_idx": {
+ "name": "oauth_token_family_user_client_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_token_family_consent_id_idx": {
+ "name": "oauth_token_family_consent_id_idx",
+ "columns": [
+ {
+ "expression": "consent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_token_family_expires_at_idx": {
+ "name": "oauth_token_family_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_token_family_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_token_family_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_token_family",
+ "tableTo": "oauth_client",
+ "columnsFrom": ["client_id"],
+ "columnsTo": ["client_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_token_family_session_id_session_id_fk": {
+ "name": "oauth_token_family_session_id_session_id_fk",
+ "tableFrom": "oauth_token_family",
+ "tableTo": "session",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_token_family_user_id_user_id_fk": {
+ "name": "oauth_token_family_user_id_user_id_fk",
+ "tableFrom": "oauth_token_family",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_token_family_consent_id_oauth_consent_id_fk": {
+ "name": "oauth_token_family_consent_id_oauth_consent_id_fk",
+ "tableFrom": "oauth_token_family",
+ "tableTo": "oauth_consent",
+ "columnsFrom": ["consent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "oauth_token_family_generation_check": {
+ "name": "oauth_token_family_generation_check",
+ "value": "\"oauth_token_family\".\"current_generation\" BETWEEN 0 AND 1000"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization": {
+ "name": "organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_policy_settings": {
+ "name": "session_policy_settings",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "security_policy_version": {
+ "name": "security_policy_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "require_sso": {
+ "name": "require_sso",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "data_retention_settings": {
+ "name": "data_retention_settings",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "org_usage_limit": {
+ "name": "org_usage_limit",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "storage_used_bytes": {
+ "name": "storage_used_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "limit_notifications": {
+ "name": "limit_notifications",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "credit_balance": {
+ "name": "credit_balance",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_access_request_settings": {
+ "name": "organization_access_request_settings",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "allow_requests": {
+ "name": "allow_requests",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_access_request_settings_organization_id_organization_id_fk": {
+ "name": "organization_access_request_settings_organization_id_organization_id_fk",
+ "tableFrom": "organization_access_request_settings",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_access_request_settings_updated_by_user_id_fk": {
+ "name": "organization_access_request_settings_updated_by_user_id_fk",
+ "tableFrom": "organization_access_request_settings",
+ "tableTo": "user",
+ "columnsFrom": ["updated_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_byok_keys": {
+ "name": "organization_byok_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "organization_byok_organization_provider_idx": {
+ "name": "organization_byok_organization_provider_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_byok_keys_organization_id_organization_id_fk": {
+ "name": "organization_byok_keys_organization_id_organization_id_fk",
+ "tableFrom": "organization_byok_keys",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_byok_keys_created_by_user_id_fk": {
+ "name": "organization_byok_keys_created_by_user_id_fk",
+ "tableFrom": "organization_byok_keys",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_member_usage_limit": {
+ "name": "organization_member_usage_limit",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usage_limit": {
+ "name": "usage_limit",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "set_by": {
+ "name": "set_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "org_member_usage_limit_org_user_unique": {
+ "name": "org_member_usage_limit_org_user_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "org_member_usage_limit_organization_id_idx": {
+ "name": "org_member_usage_limit_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_member_usage_limit_organization_id_organization_id_fk": {
+ "name": "organization_member_usage_limit_organization_id_organization_id_fk",
+ "tableFrom": "organization_member_usage_limit",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_member_usage_limit_user_id_user_id_fk": {
+ "name": "organization_member_usage_limit_user_id_user_id_fk",
+ "tableFrom": "organization_member_usage_limit",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_member_usage_limit_set_by_user_id_fk": {
+ "name": "organization_member_usage_limit_set_by_user_id_fk",
+ "tableFrom": "organization_member_usage_limit",
+ "tableTo": "user",
+ "columnsFrom": ["set_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_search_history": {
+ "name": "organization_search_history",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sources": {
+ "name": "sources",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "queries": {
+ "name": "queries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ }
+ },
+ "indexes": {
+ "organization_search_history_user_idx": {
+ "name": "organization_search_history_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_search_history_organization_id_organization_id_fk": {
+ "name": "organization_search_history_organization_id_organization_id_fk",
+ "tableFrom": "organization_search_history",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_search_history_user_id_user_id_fk": {
+ "name": "organization_search_history_user_id_user_id_fk",
+ "tableFrom": "organization_search_history",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "organization_search_history_organization_id_user_id_pk": {
+ "name": "organization_search_history_organization_id_user_id_pk",
+ "columns": ["organization_id", "user_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_search_integration": {
+ "name": "organization_search_integration",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connector_type": {
+ "name": "connector_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved": {
+ "name": "approved",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_search_integration_organization_id_organization_id_fk": {
+ "name": "organization_search_integration_organization_id_organization_id_fk",
+ "tableFrom": "organization_search_integration",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "organization_search_integration_organization_id_connector_type_pk": {
+ "name": "organization_search_integration_organization_id_connector_type_pk",
+ "columns": ["organization_id", "connector_type"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_search_mcp_invocation": {
+ "name": "organization_search_mcp_invocation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_kind": {
+ "name": "auth_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "organization_search_mcp_invocation_org_created_idx": {
+ "name": "organization_search_mcp_invocation_org_created_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "organization_search_mcp_invocation_user_idx": {
+ "name": "organization_search_mcp_invocation_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "org_search_mcp_invocation_org_fk": {
+ "name": "org_search_mcp_invocation_org_fk",
+ "tableFrom": "organization_search_mcp_invocation",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "org_search_mcp_invocation_user_fk": {
+ "name": "org_search_mcp_invocation_user_fk",
+ "tableFrom": "organization_search_mcp_invocation",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "organization_search_mcp_invocation_tool_check": {
+ "name": "organization_search_mcp_invocation_tool_check",
+ "value": "\"organization_search_mcp_invocation\".\"tool_name\" IN ('search', 'read_document', 'chat')"
+ },
+ "organization_search_mcp_invocation_outcome_check": {
+ "name": "organization_search_mcp_invocation_outcome_check",
+ "value": "\"organization_search_mcp_invocation\".\"outcome\" IN ('success', 'error', 'cancelled', 'rate_limited')"
+ },
+ "organization_search_mcp_invocation_duration_check": {
+ "name": "organization_search_mcp_invocation_duration_check",
+ "value": "\"organization_search_mcp_invocation\".\"duration_ms\" >= 0"
+ },
+ "organization_search_mcp_invocation_client_name_check": {
+ "name": "organization_search_mcp_invocation_client_name_check",
+ "value": "length(\"organization_search_mcp_invocation\".\"client_name\") <= 256"
+ },
+ "organization_search_mcp_invocation_auth_check": {
+ "name": "organization_search_mcp_invocation_auth_check",
+ "value": "(\"organization_search_mcp_invocation\".\"auth_kind\" = 'oauth_access_token' AND \"organization_search_mcp_invocation\".\"oauth_client_id\" IS NOT NULL)\n OR (\"organization_search_mcp_invocation\".\"auth_kind\" IN ('personal_api_key', 'workspace_api_key') AND \"organization_search_mcp_invocation\".\"oauth_client_id\" IS NULL AND \"organization_search_mcp_invocation\".\"client_name\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization_secret": {
+ "name": "organization_secret",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_value": {
+ "name": "encrypted_value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "organization_secret_shared_unique": {
+ "name": "organization_secret_shared_unique",
+ "columns": [
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"organization_secret\".\"owner_user_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "organization_secret_member_unique": {
+ "name": "organization_secret_member_unique",
+ "columns": [
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"organization_secret\".\"owner_user_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "organization_secret_owner_idx": {
+ "name": "organization_secret_owner_idx",
+ "columns": [
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_secret_source_id_organization_secret_source_id_fk": {
+ "name": "organization_secret_source_id_organization_secret_source_id_fk",
+ "tableFrom": "organization_secret",
+ "tableTo": "organization_secret_source",
+ "columnsFrom": ["source_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_secret_owner_user_id_user_id_fk": {
+ "name": "organization_secret_owner_user_id_user_id_fk",
+ "tableFrom": "organization_secret",
+ "tableTo": "user",
+ "columnsFrom": ["owner_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_secret_source": {
+ "name": "organization_secret_source",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "organization_secret_source_org_unique": {
+ "name": "organization_secret_source_org_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_secret_source_organization_id_organization_id_fk": {
+ "name": "organization_secret_source_organization_id_organization_id_fk",
+ "tableFrom": "organization_secret_source",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "organization_secret_source_mode_check": {
+ "name": "organization_secret_source_mode_check",
+ "value": "\"organization_secret_source\".\"mode\" IN ('organization', 'member')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.outbox_event": {
+ "name": "outbox_event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "max_attempts": {
+ "name": "max_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 10
+ },
+ "available_at": {
+ "name": "available_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "outbox_event_status_available_idx": {
+ "name": "outbox_event_status_available_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "available_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "outbox_event_pending_type_available_idx": {
+ "name": "outbox_event_pending_type_available_idx",
+ "columns": [
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "available_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"outbox_event\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "outbox_event_locked_at_idx": {
+ "name": "outbox_event_locked_at_idx",
+ "columns": [
+ {
+ "expression": "locked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "outbox_event_type_created_idx": {
+ "name": "outbox_event_type_created_idx",
+ "columns": [
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.paused_executions": {
+ "name": "paused_executions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_snapshot": {
+ "name": "execution_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pause_points": {
+ "name": "pause_points",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_pause_count": {
+ "name": "total_pause_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resumed_count": {
+ "name": "resumed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "automatic_resume_retry_count": {
+ "name": "automatic_resume_retry_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paused'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "paused_at": {
+ "name": "paused_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_resume_at": {
+ "name": "next_resume_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "paused_executions_workflow_id_idx": {
+ "name": "paused_executions_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "paused_executions_status_idx": {
+ "name": "paused_executions_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "paused_executions_execution_id_unique": {
+ "name": "paused_executions_execution_id_unique",
+ "columns": [
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "paused_executions_next_resume_at_idx": {
+ "name": "paused_executions_next_resume_at_idx",
+ "columns": [
+ {
+ "expression": "next_resume_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "status = 'paused' AND next_resume_at IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "paused_executions_workflow_id_workflow_id_fk": {
+ "name": "paused_executions_workflow_id_workflow_id_fk",
+ "tableFrom": "paused_executions",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pending_credential_draft": {
+ "name": "pending_credential_draft",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_config": {
+ "name": "oauth_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pending_draft_organization_id_idx": {
+ "name": "pending_draft_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pending_draft_user_provider_org": {
+ "name": "pending_draft_user_provider_org",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pending_draft_user_provider_ws": {
+ "name": "pending_draft_user_provider_ws",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pending_credential_draft_user_id_user_id_fk": {
+ "name": "pending_credential_draft_user_id_user_id_fk",
+ "tableFrom": "pending_credential_draft",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pending_credential_draft_workspace_id_workspace_id_fk": {
+ "name": "pending_credential_draft_workspace_id_workspace_id_fk",
+ "tableFrom": "pending_credential_draft",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pending_credential_draft_organization_id_organization_id_fk": {
+ "name": "pending_credential_draft_organization_id_organization_id_fk",
+ "tableFrom": "pending_credential_draft",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pending_credential_draft_credential_id_credential_id_fk": {
+ "name": "pending_credential_draft_credential_id_credential_id_fk",
+ "tableFrom": "pending_credential_draft",
+ "tableTo": "credential",
+ "columnsFrom": ["credential_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pending_draft_owner_check": {
+ "name": "pending_draft_owner_check",
+ "value": "num_nonnulls(\"pending_credential_draft\".\"workspace_id\", \"pending_credential_draft\".\"organization_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.people_directory_entry": {
+ "name": "people_directory_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "department": {
+ "name": "department",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manager_external_id": {
+ "name": "manager_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "people_directory_entry_source_id_idx": {
+ "name": "people_directory_entry_source_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "people_directory_entry_email_idx": {
+ "name": "people_directory_entry_email_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "people_directory_entry_manager_idx": {
+ "name": "people_directory_entry_manager_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "manager_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "people_directory_entry_organization_id_people_directory_sync_organization_id_fk": {
+ "name": "people_directory_entry_organization_id_people_directory_sync_organization_id_fk",
+ "tableFrom": "people_directory_entry",
+ "tableTo": "people_directory_sync",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["organization_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.people_directory_page": {
+ "name": "people_directory_page",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "page_hash": {
+ "name": "page_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "people_directory_page_organization_id_people_directory_sync_organization_id_fk": {
+ "name": "people_directory_page_organization_id_people_directory_sync_organization_id_fk",
+ "tableFrom": "people_directory_page",
+ "tableTo": "people_directory_sync",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["organization_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "people_directory_page_organization_id_run_id_page_hash_pk": {
+ "name": "people_directory_page_organization_id_run_id_page_hash_pk",
+ "columns": ["organization_id", "run_id", "page_hash"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.people_directory_scim_change": {
+ "name": "people_directory_scim_change",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "changed_at": {
+ "name": "changed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "people_directory_scim_change_due_idx": {
+ "name": "people_directory_scim_change_due_idx",
+ "columns": [
+ {
+ "expression": "changed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "people_directory_scim_change_organization_id_organization_id_fk": {
+ "name": "people_directory_scim_change_organization_id_organization_id_fk",
+ "tableFrom": "people_directory_scim_change",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.people_directory_stage": {
+ "name": "people_directory_stage",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proposed_id": {
+ "name": "proposed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "department": {
+ "name": "department",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manager_external_id": {
+ "name": "manager_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reports_cursor": {
+ "name": "reports_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reports_complete": {
+ "name": "reports_complete",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "people_directory_stage_email_idx": {
+ "name": "people_directory_stage_email_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "people_directory_stage_pending_idx": {
+ "name": "people_directory_stage_pending_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "NOT \"people_directory_stage\".\"reports_complete\"",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "people_directory_stage_organization_id_people_directory_sync_organization_id_fk": {
+ "name": "people_directory_stage_organization_id_people_directory_sync_organization_id_fk",
+ "tableFrom": "people_directory_stage",
+ "tableTo": "people_directory_sync",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["organization_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "people_directory_stage_organization_id_run_id_external_id_pk": {
+ "name": "people_directory_stage_organization_id_run_id_external_id_pk",
+ "columns": ["organization_id", "run_id", "external_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.people_directory_sync": {
+ "name": "people_directory_sync",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_target": {
+ "name": "source_target",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_credential": {
+ "name": "encrypted_credential",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "configured_by": {
+ "name": "configured_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_started_at": {
+ "name": "run_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "users_read": {
+ "name": "users_read",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "retry_count": {
+ "name": "retry_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_sync_at": {
+ "name": "next_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_success_at": {
+ "name": "last_success_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_failed_at": {
+ "name": "last_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "people_directory_sync_due_idx": {
+ "name": "people_directory_sync_due_idx",
+ "columns": [
+ {
+ "expression": "next_sync_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "people_directory_sync_organization_id_organization_id_fk": {
+ "name": "people_directory_sync_organization_id_organization_id_fk",
+ "tableFrom": "people_directory_sync",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "people_directory_sync_configured_by_user_id_fk": {
+ "name": "people_directory_sync_configured_by_user_id_fk",
+ "tableFrom": "people_directory_sync",
+ "tableTo": "user",
+ "columnsFrom": ["configured_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.permission_access_request": {
+ "name": "permission_access_request",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requester_id": {
+ "name": "requester_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope_key": {
+ "name": "scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_key": {
+ "name": "target_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target": {
+ "name": "target",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_label": {
+ "name": "target_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "membership_id": {
+ "name": "membership_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "group_name": {
+ "name": "group_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "decision_reason": {
+ "name": "decision_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_by": {
+ "name": "decided_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decision": {
+ "name": "decision",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "decided_at": {
+ "name": "decided_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "permission_access_request_pending_unique": {
+ "name": "permission_access_request_pending_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "requester_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"permission_access_request\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_access_request_org_queue_idx": {
+ "name": "permission_access_request_org_queue_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_access_request_requester_idx": {
+ "name": "permission_access_request_requester_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "requester_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "permission_access_request_organization_id_organization_id_fk": {
+ "name": "permission_access_request_organization_id_organization_id_fk",
+ "tableFrom": "permission_access_request",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_access_request_requester_id_user_id_fk": {
+ "name": "permission_access_request_requester_id_user_id_fk",
+ "tableFrom": "permission_access_request",
+ "tableTo": "user",
+ "columnsFrom": ["requester_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_access_request_decided_by_user_id_fk": {
+ "name": "permission_access_request_decided_by_user_id_fk",
+ "tableFrom": "permission_access_request",
+ "tableTo": "user",
+ "columnsFrom": ["decided_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "permission_access_request_status_check": {
+ "name": "permission_access_request_status_check",
+ "value": "\"permission_access_request\".\"status\" in ('pending', 'fulfilled', 'declined', 'cancelled', 'closed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.permission_group": {
+ "name": "permission_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "membership_mode": {
+ "name": "membership_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'inherit'"
+ }
+ },
+ "indexes": {
+ "permission_group_created_by_idx": {
+ "name": "permission_group_created_by_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_group_organization_name_unique": {
+ "name": "permission_group_organization_name_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_group_organization_default_unique": {
+ "name": "permission_group_organization_default_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "is_default = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "permission_group_organization_id_organization_id_fk": {
+ "name": "permission_group_organization_id_organization_id_fk",
+ "tableFrom": "permission_group",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_group_created_by_user_id_fk": {
+ "name": "permission_group_created_by_user_id_fk",
+ "tableFrom": "permission_group",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.permission_group_member": {
+ "name": "permission_group_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "permission_group_id": {
+ "name": "permission_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assigned_by": {
+ "name": "assigned_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assigned_at": {
+ "name": "assigned_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "permission_group_member_group_user_unique": {
+ "name": "permission_group_member_group_user_unique",
+ "columns": [
+ {
+ "expression": "permission_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_group_member_organization_user_idx": {
+ "name": "permission_group_member_organization_user_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "permission_group_member_permission_group_id_permission_group_id_fk": {
+ "name": "permission_group_member_permission_group_id_permission_group_id_fk",
+ "tableFrom": "permission_group_member",
+ "tableTo": "permission_group",
+ "columnsFrom": ["permission_group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_group_member_organization_id_organization_id_fk": {
+ "name": "permission_group_member_organization_id_organization_id_fk",
+ "tableFrom": "permission_group_member",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_group_member_user_id_user_id_fk": {
+ "name": "permission_group_member_user_id_user_id_fk",
+ "tableFrom": "permission_group_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_group_member_assigned_by_user_id_fk": {
+ "name": "permission_group_member_assigned_by_user_id_fk",
+ "tableFrom": "permission_group_member",
+ "tableTo": "user",
+ "columnsFrom": ["assigned_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.permission_group_workspace": {
+ "name": "permission_group_workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "permission_group_id": {
+ "name": "permission_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "permission_group_workspace_workspace_id_idx": {
+ "name": "permission_group_workspace_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permission_group_workspace_group_workspace_unique": {
+ "name": "permission_group_workspace_group_workspace_unique",
+ "columns": [
+ {
+ "expression": "permission_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "permission_group_workspace_permission_group_id_permission_group_id_fk": {
+ "name": "permission_group_workspace_permission_group_id_permission_group_id_fk",
+ "tableFrom": "permission_group_workspace",
+ "tableTo": "permission_group",
+ "columnsFrom": ["permission_group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_group_workspace_workspace_id_workspace_id_fk": {
+ "name": "permission_group_workspace_workspace_id_workspace_id_fk",
+ "tableFrom": "permission_group_workspace",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "permission_group_workspace_organization_id_organization_id_fk": {
+ "name": "permission_group_workspace_organization_id_organization_id_fk",
+ "tableFrom": "permission_group_workspace",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.permissions": {
+ "name": "permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_type": {
+ "name": "permission_type",
+ "type": "permission_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "permissions_entity_idx": {
+ "name": "permissions_entity_idx",
+ "columns": [
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permissions_user_entity_permission_idx": {
+ "name": "permissions_user_entity_permission_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "permissions_unique_constraint": {
+ "name": "permissions_unique_constraint",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "permissions_user_id_user_id_fk": {
+ "name": "permissions_user_id_user_id_fk",
+ "tableFrom": "permissions",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pinned_item": {
+ "name": "pinned_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pinned_item_user_workspace_idx": {
+ "name": "pinned_item_user_workspace_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pinned_item_resource_idx": {
+ "name": "pinned_item_resource_idx",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pinned_item_user_resource_unique": {
+ "name": "pinned_item_user_resource_unique",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pinned_item_user_id_user_id_fk": {
+ "name": "pinned_item_user_id_user_id_fk",
+ "tableFrom": "pinned_item",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pinned_item_workspace_id_workspace_id_fk": {
+ "name": "pinned_item_workspace_id_workspace_id_fk",
+ "tableFrom": "pinned_item",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_scope_key": {
+ "name": "organization_scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "generated": {
+ "as": "CASE WHEN organization_id IS NULL THEN 'personal' ELSE 'organization:' || organization_id END",
+ "type": "stored"
+ }
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_organization_archive_id_idx": {
+ "name": "project_organization_archive_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_owner_archive_id_idx": {
+ "name": "project_owner_archive_id_idx",
+ "columns": [
+ {
+ "expression": "owner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_organization_id_organization_id_fk": {
+ "name": "project_organization_id_organization_id_fk",
+ "tableFrom": "project",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "project_owner_id_user_id_fk": {
+ "name": "project_owner_id_user_id_fk",
+ "tableFrom": "project",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_id_organization_scope_unique": {
+ "name": "project_id_organization_scope_unique",
+ "nullsNotDistinct": false,
+ "columns": ["id", "organization_scope_key"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_name_length": {
+ "name": "project_name_length",
+ "value": "char_length(btrim(\"project\".\"name\")) BETWEEN 1 AND 100"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.public_share": {
+ "name": "public_share",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "auth_type": {
+ "name": "auth_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'public'"
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allowed_emails": {
+ "name": "allowed_emails",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "public_share_entity_id_idx": {
+ "name": "public_share_entity_id_idx",
+ "columns": [
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "public_share_token_unique": {
+ "name": "public_share_token_unique",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "public_share_resource_unique": {
+ "name": "public_share_resource_unique",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "public_share_resource_id_idx": {
+ "name": "public_share_resource_id_idx",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "public_share_workspace_id_idx": {
+ "name": "public_share_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "public_share_workspace_id_workspace_id_fk": {
+ "name": "public_share_workspace_id_workspace_id_fk",
+ "tableFrom": "public_share",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "public_share_created_by_user_id_fk": {
+ "name": "public_share_created_by_user_id_fk",
+ "tableFrom": "public_share",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "public_share_entity_binding_check": {
+ "name": "public_share_entity_binding_check",
+ "value": "\n (\"public_share\".\"entity_type\" IS NULL AND \"public_share\".\"entity_id\" IS NULL AND \"public_share\".\"workspace_id\" IS NOT NULL)\n OR (\"public_share\".\"entity_type\" IS NOT NULL AND \"public_share\".\"entity_id\" IS NOT NULL AND char_length(\"public_share\".\"entity_id\") > 0\n AND ((\"public_share\".\"entity_type\" = 'workspace' AND \"public_share\".\"workspace_id\" IS NOT NULL AND \"public_share\".\"entity_id\" = \"public_share\".\"workspace_id\")\n OR (\"public_share\".\"entity_type\" = 'project' AND \"public_share\".\"workspace_id\" IS NULL AND \"public_share\".\"resource_type\" = 'file')))\n "
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.rate_limit_bucket": {
+ "name": "rate_limit_bucket",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "tokens": {
+ "name": "tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "blocked_until": {
+ "name": "blocked_until",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "capacity_state": {
+ "name": "capacity_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.resource_policy": {
+ "name": "resource_policy",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "document": {
+ "name": "document",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "resource_policy_organization_id_idx": {
+ "name": "resource_policy_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "resource_policy_resource_unique": {
+ "name": "resource_policy_resource_unique",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "resource_policy_workspace_id_idx": {
+ "name": "resource_policy_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_policy_workspace_id_workspace_id_fk": {
+ "name": "resource_policy_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_policy",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "resource_policy_organization_id_organization_id_fk": {
+ "name": "resource_policy_organization_id_organization_id_fk",
+ "tableFrom": "resource_policy",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "resource_policy_created_by_user_id_fk": {
+ "name": "resource_policy_created_by_user_id_fk",
+ "tableFrom": "resource_policy",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "resource_policy_updated_by_user_id_fk": {
+ "name": "resource_policy_updated_by_user_id_fk",
+ "tableFrom": "resource_policy",
+ "tableTo": "user",
+ "columnsFrom": ["updated_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "resource_policy_owner_check": {
+ "name": "resource_policy_owner_check",
+ "value": "num_nonnulls(\"resource_policy\".\"workspace_id\", \"resource_policy\".\"organization_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.resume_queue": {
+ "name": "resume_queue",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "paused_execution_id": {
+ "name": "paused_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_execution_id": {
+ "name": "parent_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "new_execution_id": {
+ "name": "new_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "context_id": {
+ "name": "context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resume_input": {
+ "name": "resume_input",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "queued_at": {
+ "name": "queued_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "resume_queue_parent_status_idx": {
+ "name": "resume_queue_parent_status_idx",
+ "columns": [
+ {
+ "expression": "parent_execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "resume_queue_new_execution_idx": {
+ "name": "resume_queue_new_execution_idx",
+ "columns": [
+ {
+ "expression": "new_execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resume_queue_paused_execution_id_paused_executions_id_fk": {
+ "name": "resume_queue_paused_execution_id_paused_executions_id_fk",
+ "tableFrom": "resume_queue",
+ "tableTo": "paused_executions",
+ "columnsFrom": ["paused_execution_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sandbox_image": {
+ "name": "sandbox_image",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spec_hash": {
+ "name": "spec_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spec": {
+ "name": "spec",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "sandbox_image_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "image_ref": {
+ "name": "image_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_image_id": {
+ "name": "provider_image_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "build_id": {
+ "name": "build_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "materialization_generation": {
+ "name": "materialization_generation",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_detail": {
+ "name": "error_detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "sandbox_image_provider_spec_unique": {
+ "name": "sandbox_image_provider_spec_unique",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "spec_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sandbox_image_status_idx": {
+ "name": "sandbox_image_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sandbox_image_last_used_idx": {
+ "name": "sandbox_image_last_used_idx",
+ "columns": [
+ {
+ "expression": "last_used_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_connection": {
+ "name": "scim_connection",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "settings": {
+ "name": "settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_request_at": {
+ "name": "last_request_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reconcile_lock_token": {
+ "name": "reconcile_lock_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reconcile_lease_at": {
+ "name": "reconcile_lease_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reconciled_at": {
+ "name": "reconciled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_connection_organization_unique": {
+ "name": "scim_connection_organization_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_connection_reconcile_due_idx": {
+ "name": "scim_connection_reconcile_due_idx",
+ "columns": [
+ {
+ "expression": "reconciled_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_connection_organization_id_organization_id_fk": {
+ "name": "scim_connection_organization_id_organization_id_fk",
+ "tableFrom": "scim_connection",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_connection_created_by_user_id_fk": {
+ "name": "scim_connection_created_by_user_id_fk",
+ "tableFrom": "scim_connection",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_credential": {
+ "name": "scim_credential",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_prefix": {
+ "name": "token_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_by": {
+ "name": "revoked_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_credential_token_hash_unique": {
+ "name": "scim_credential_token_hash_unique",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_credential_connection_idx": {
+ "name": "scim_credential_connection_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_credential_connection_id_scim_connection_id_fk": {
+ "name": "scim_credential_connection_id_scim_connection_id_fk",
+ "tableFrom": "scim_credential",
+ "tableTo": "scim_connection",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_credential_revoked_by_user_id_fk": {
+ "name": "scim_credential_revoked_by_user_id_fk",
+ "tableFrom": "scim_credential",
+ "tableTo": "user",
+ "columnsFrom": ["revoked_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "scim_credential_created_by_user_id_fk": {
+ "name": "scim_credential_created_by_user_id_fk",
+ "tableFrom": "scim_credential",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group": {
+ "name": "scim_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name_key": {
+ "name": "display_name_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "order_key": {
+ "name": "order_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_connection_display_name_unique": {
+ "name": "scim_group_connection_display_name_unique",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "display_name_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_group_connection_external_id_unique": {
+ "name": "scim_group_connection_external_id_unique",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "external_id is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_group_connection_order_idx": {
+ "name": "scim_group_connection_order_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "order_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_connection_id_scim_connection_id_fk": {
+ "name": "scim_group_connection_id_scim_connection_id_fk",
+ "tableFrom": "scim_group",
+ "tableTo": "scim_connection",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group_mapping": {
+ "name": "scim_group_mapping",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_kind": {
+ "name": "target_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_group_id": {
+ "name": "permission_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permission_type": {
+ "name": "permission_type",
+ "type": "permission_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'manual'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_mapping_permission_group_idx": {
+ "name": "scim_group_mapping_permission_group_idx",
+ "columns": [
+ {
+ "expression": "permission_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_group_mapping_workspace_idx": {
+ "name": "scim_group_mapping_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_group_mapping_group_target_unique": {
+ "name": "scim_group_mapping_group_target_unique",
+ "columns": [
+ {
+ "expression": "group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"permission_group_id\", \"workspace_id\", \"role\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_mapping_group_id_scim_group_id_fk": {
+ "name": "scim_group_mapping_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "scim_group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_permission_group_id_permission_group_id_fk": {
+ "name": "scim_group_mapping_permission_group_id_permission_group_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "permission_group",
+ "columnsFrom": ["permission_group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_workspace_id_workspace_id_fk": {
+ "name": "scim_group_mapping_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_created_by_user_id_fk": {
+ "name": "scim_group_mapping_created_by_user_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "scim_group_mapping_target_shape": {
+ "name": "scim_group_mapping_target_shape",
+ "value": "(\n (\"scim_group_mapping\".\"target_kind\" = 'permission_group' AND \"scim_group_mapping\".\"permission_group_id\" IS NOT NULL AND \"scim_group_mapping\".\"workspace_id\" IS NULL AND \"scim_group_mapping\".\"permission_type\" IS NULL AND \"scim_group_mapping\".\"role\" IS NULL)\n OR (\"scim_group_mapping\".\"target_kind\" = 'workspace' AND \"scim_group_mapping\".\"workspace_id\" IS NOT NULL AND \"scim_group_mapping\".\"permission_type\" IS NOT NULL AND \"scim_group_mapping\".\"permission_group_id\" IS NULL AND \"scim_group_mapping\".\"role\" IS NULL)\n OR (\"scim_group_mapping\".\"target_kind\" = 'org_role' AND \"scim_group_mapping\".\"role\" IS NOT NULL AND \"scim_group_mapping\".\"permission_group_id\" IS NULL AND \"scim_group_mapping\".\"workspace_id\" IS NULL AND \"scim_group_mapping\".\"permission_type\" IS NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.scim_group_member": {
+ "name": "scim_group_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scim_user_id": {
+ "name": "scim_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_member_group_user_unique": {
+ "name": "scim_group_member_group_user_unique",
+ "columns": [
+ {
+ "expression": "group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scim_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_group_member_scim_user_idx": {
+ "name": "scim_group_member_scim_user_idx",
+ "columns": [
+ {
+ "expression": "scim_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_member_group_id_scim_group_id_fk": {
+ "name": "scim_group_member_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "scim_group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_member_scim_user_id_scim_user_id_fk": {
+ "name": "scim_group_member_scim_user_id_scim_user_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "scim_user",
+ "columnsFrom": ["scim_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_projection_grant": {
+ "name": "scim_projection_grant",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scim_user_id": {
+ "name": "scim_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_kind": {
+ "name": "target_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_type": {
+ "name": "permission_type",
+ "type": "permission_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "baseline_permission": {
+ "name": "baseline_permission",
+ "type": "permission_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin": {
+ "name": "origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'directory'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_projection_grant_user_target_unique": {
+ "name": "scim_projection_grant_user_target_unique",
+ "columns": [
+ {
+ "expression": "scim_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_projection_grant_connection_idx": {
+ "name": "scim_projection_grant_connection_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_projection_grant_connection_id_scim_connection_id_fk": {
+ "name": "scim_projection_grant_connection_id_scim_connection_id_fk",
+ "tableFrom": "scim_projection_grant",
+ "tableTo": "scim_connection",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_projection_grant_scim_user_id_scim_user_id_fk": {
+ "name": "scim_projection_grant_scim_user_id_scim_user_id_fk",
+ "tableFrom": "scim_projection_grant",
+ "tableTo": "scim_user",
+ "columnsFrom": ["scim_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_request_log": {
+ "name": "scim_request_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "method": {
+ "name": "method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scim_type": {
+ "name": "scim_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "detail": {
+ "name": "detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_request_log_connection_created_idx": {
+ "name": "scim_request_log_connection_created_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_request_log_connection_id_scim_connection_id_fk": {
+ "name": "scim_request_log_connection_id_scim_connection_id_fk",
+ "tableFrom": "scim_request_log",
+ "tableTo": "scim_connection",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_user": {
+ "name": "scim_user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_name": {
+ "name": "user_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "attributes": {
+ "name": "attributes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "order_key": {
+ "name": "order_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_user_connection_user_unique": {
+ "name": "scim_user_connection_user_unique",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_connection_user_name_unique": {
+ "name": "scim_user_connection_user_name_unique",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_connection_external_id_unique": {
+ "name": "scim_user_connection_external_id_unique",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "external_id is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_connection_order_idx": {
+ "name": "scim_user_connection_order_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "order_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_user_idx": {
+ "name": "scim_user_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_user_connection_id_scim_connection_id_fk": {
+ "name": "scim_user_connection_id_scim_connection_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "scim_connection",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_user_user_id_user_id_fk": {
+ "name": "scim_user_user_id_user_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_user_tombstone": {
+ "name": "scim_user_tombstone",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_user_tombstone_connection_external_id_unique": {
+ "name": "scim_user_tombstone_connection_external_id_unique",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_tombstone_user_idx": {
+ "name": "scim_user_tombstone_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_user_tombstone_connection_id_scim_connection_id_fk": {
+ "name": "scim_user_tombstone_connection_id_scim_connection_id_fk",
+ "tableFrom": "scim_user_tombstone",
+ "tableTo": "scim_connection",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_user_tombstone_user_id_user_id_fk": {
+ "name": "scim_user_tombstone_user_id_user_id_fk",
+ "tableFrom": "scim_user_tombstone",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.secret_usage": {
+ "name": "secret_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_name": {
+ "name": "secret_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_scope": {
+ "name": "secret_scope",
+ "type": "secret_usage_scope",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_owner_user_id": {
+ "name": "secret_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "secret_usage_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "usage_date": {
+ "name": "usage_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "use_count": {
+ "name": "use_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_execution_id": {
+ "name": "last_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_trigger": {
+ "name": "last_trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "secret_usage_bucket_unique": {
+ "name": "secret_usage_bucket_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "actor_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "usage_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "secret_usage_secret_recent_idx": {
+ "name": "secret_usage_secret_recent_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_used_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "secret_usage_workspace_id_workspace_id_fk": {
+ "name": "secret_usage_workspace_id_workspace_id_fk",
+ "tableFrom": "secret_usage",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impersonated_by": {
+ "name": "impersonated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_user_id_idx": {
+ "name": "session_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "session_active_organization_id_organization_id_fk": {
+ "name": "session_active_organization_id_organization_id_fk",
+ "tableFrom": "session",
+ "tableTo": "organization",
+ "columnsFrom": ["active_organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.settings": {
+ "name": "settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "theme": {
+ "name": "theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "auto_connect": {
+ "name": "auto_connect",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "telemetry_enabled": {
+ "name": "telemetry_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "email_preferences": {
+ "name": "email_preferences",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "billing_usage_notifications_enabled": {
+ "name": "billing_usage_notifications_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "super_user_mode_enabled": {
+ "name": "super_user_mode_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "mothership_environment": {
+ "name": "mothership_environment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "error_notifications_enabled": {
+ "name": "error_notifications_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "snap_to_grid_size": {
+ "name": "snap_to_grid_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "show_action_bar": {
+ "name": "show_action_bar",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "auto_focus_on_click": {
+ "name": "auto_focus_on_click",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "copilot_auto_allowed_tools": {
+ "name": "copilot_auto_allowed_tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'"
+ },
+ "last_active_workspace_id": {
+ "name": "last_active_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "settings_user_id_user_id_fk": {
+ "name": "settings_user_id_user_id_fk",
+ "tableFrom": "settings",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "settings_user_id_unique": {
+ "name": "settings_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sim_link": {
+ "name": "sim_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_name": {
+ "name": "normalized_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_url": {
+ "name": "default_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unlisted": {
+ "name": "unlisted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "restrict_edit": {
+ "name": "restrict_edit",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "visit_count": {
+ "name": "visit_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_visited_at": {
+ "name": "last_visited_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "sim_link_organization_name_unique": {
+ "name": "sim_link_organization_name_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "normalized_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sim_link_created_by_idx": {
+ "name": "sim_link_created_by_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "sim_link_organization_id_organization_id_fk": {
+ "name": "sim_link_organization_id_organization_id_fk",
+ "tableFrom": "sim_link",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sim_link_created_by_user_id_fk": {
+ "name": "sim_link_created_by_user_id_fk",
+ "tableFrom": "sim_link",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sim_trigger_state": {
+ "name": "sim_trigger_state",
+ "schema": "",
+ "columns": {
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "block_id": {
+ "name": "block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_key": {
+ "name": "scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "last_fired_at": {
+ "name": "last_fired_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "sim_trigger_state_workflow_id_workflow_id_fk": {
+ "name": "sim_trigger_state_workflow_id_workflow_id_fk",
+ "tableFrom": "sim_trigger_state",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "sim_trigger_state_workflow_id_block_id_scope_key_pk": {
+ "name": "sim_trigger_state_workflow_id_block_id_scope_key_pk",
+ "columns": ["workflow_id", "block_id", "scope_key"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.skill": {
+ "name": "skill",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "skill_workspace_name_unique": {
+ "name": "skill_workspace_name_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "skill_workspace_id_workspace_id_fk": {
+ "name": "skill_workspace_id_workspace_id_fk",
+ "tableFrom": "skill",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "skill_user_id_user_id_fk": {
+ "name": "skill_user_id_user_id_fk",
+ "tableFrom": "skill",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.skill_member": {
+ "name": "skill_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invited_by": {
+ "name": "invited_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "skill_member_user_id_idx": {
+ "name": "skill_member_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "skill_member_unique": {
+ "name": "skill_member_unique",
+ "columns": [
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "skill_member_skill_id_skill_id_fk": {
+ "name": "skill_member_skill_id_skill_id_fk",
+ "tableFrom": "skill_member",
+ "tableTo": "skill",
+ "columnsFrom": ["skill_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "skill_member_user_id_user_id_fk": {
+ "name": "skill_member_user_id_user_id_fk",
+ "tableFrom": "skill_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "skill_member_invited_by_user_id_fk": {
+ "name": "skill_member_invited_by_user_id_fk",
+ "tableFrom": "skill_member",
+ "tableTo": "user",
+ "columnsFrom": ["invited_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_app": {
+ "name": "slack_app",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_client_secret": {
+ "name": "encrypted_client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_signing_secret": {
+ "name": "encrypted_signing_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "slack_app_organization_id_organization_id_fk": {
+ "name": "slack_app_organization_id_organization_id_fk",
+ "tableFrom": "slack_app",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "slack_app_owner_check": {
+ "name": "slack_app_owner_check",
+ "value": "(\"slack_app\".\"kind\" = 'custom' AND \"slack_app\".\"organization_id\" IS NOT NULL) OR (\"slack_app\".\"kind\" = 'shared' AND \"slack_app\".\"organization_id\" IS NULL)"
+ },
+ "slack_app_custom_credentials_check": {
+ "name": "slack_app_custom_credentials_check",
+ "value": "\"slack_app\".\"kind\" = 'shared' OR (\"slack_app\".\"client_id\" IS NOT NULL AND \"slack_app\".\"encrypted_client_secret\" IS NOT NULL AND \"slack_app\".\"encrypted_signing_secret\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.slack_search_installation": {
+ "name": "slack_search_installation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_app_id": {
+ "name": "slack_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_name": {
+ "name": "team_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bot_user_id": {
+ "name": "bot_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enterprise_id": {
+ "name": "enterprise_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "credential_version": {
+ "name": "credential_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_outcome": {
+ "name": "last_outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_event_at": {
+ "name": "last_event_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_search_installation_organization_idx": {
+ "name": "slack_search_installation_organization_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_search_installation_credential_unique": {
+ "name": "slack_search_installation_credential_unique",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_search_installation_app_team_unique": {
+ "name": "slack_search_installation_app_team_unique",
+ "columns": [
+ {
+ "expression": "app_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_search_installation_active_team_unique": {
+ "name": "slack_search_installation_active_team_unique",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"slack_search_installation\".\"enabled\" = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_search_installation_organization_id_organization_id_fk": {
+ "name": "slack_search_installation_organization_id_organization_id_fk",
+ "tableFrom": "slack_search_installation",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "slack_search_installation_credential_id_credential_id_fk": {
+ "name": "slack_search_installation_credential_id_credential_id_fk",
+ "tableFrom": "slack_search_installation",
+ "tableTo": "credential",
+ "columnsFrom": ["credential_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "slack_search_installation_slack_app_id_slack_app_id_fk": {
+ "name": "slack_search_installation_slack_app_id_slack_app_id_fk",
+ "tableFrom": "slack_search_installation",
+ "tableTo": "slack_app",
+ "columnsFrom": ["slack_app_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_search_turn": {
+ "name": "slack_search_turn",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ordinal": {
+ "name": "ordinal",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "slack_search_turn_ordinal_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_key": {
+ "name": "conversation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "lease_id": {
+ "name": "lease_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_search_turn_event_unique": {
+ "name": "slack_search_turn_event_unique",
+ "columns": [
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_search_turn_pending_idx": {
+ "name": "slack_search_turn_pending_idx",
+ "columns": [
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_search_turn_thread_idx": {
+ "name": "slack_search_turn_thread_idx",
+ "columns": [
+ {
+ "expression": "conversation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_search_turn_active_thread_unique": {
+ "name": "slack_search_turn_active_thread_unique",
+ "columns": [
+ {
+ "expression": "conversation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"slack_search_turn\".\"status\" = 'running'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_search_turn_installation_id_slack_search_installation_id_fk": {
+ "name": "slack_search_turn_installation_id_slack_search_installation_id_fk",
+ "tableFrom": "slack_search_turn",
+ "tableTo": "slack_search_installation",
+ "columnsFrom": ["installation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sso_domain": {
+ "name": "sso_domain",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "verification_token": {
+ "name": "verification_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "verified_at": {
+ "name": "verified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "primary_provider_id": {
+ "name": "primary_provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "sso_domain_domain_idx": {
+ "name": "sso_domain_domain_idx",
+ "columns": [
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sso_domain_org_domain_unique": {
+ "name": "sso_domain_org_domain_unique",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sso_domain_verified_unique": {
+ "name": "sso_domain_verified_unique",
+ "columns": [
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "status = 'verified'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "sso_domain_organization_id_organization_id_fk": {
+ "name": "sso_domain_organization_id_organization_id_fk",
+ "tableFrom": "sso_domain",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sso_domain_created_by_user_id_fk": {
+ "name": "sso_domain_created_by_user_id_fk",
+ "tableFrom": "sso_domain",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sso_provider": {
+ "name": "sso_provider",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issuer": {
+ "name": "issuer",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oidc_config": {
+ "name": "oidc_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "saml_config": {
+ "name": "saml_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "domain_verified": {
+ "name": "domain_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "jit_provisioning_enabled": {
+ "name": "jit_provisioning_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ }
+ },
+ "indexes": {
+ "sso_provider_provider_id_unique": {
+ "name": "sso_provider_provider_id_unique",
+ "columns": [
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sso_provider_domain_idx": {
+ "name": "sso_provider_domain_idx",
+ "columns": [
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sso_provider_user_id_idx": {
+ "name": "sso_provider_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sso_provider_organization_id_idx": {
+ "name": "sso_provider_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "sso_provider_user_id_user_id_fk": {
+ "name": "sso_provider_user_id_user_id_fk",
+ "tableFrom": "sso_provider",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sso_provider_organization_id_organization_id_fk": {
+ "name": "sso_provider_organization_id_organization_id_fk",
+ "tableFrom": "sso_provider",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.subscription": {
+ "name": "subscription",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "period_start": {
+ "name": "period_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "period_end": {
+ "name": "period_end",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancel_at": {
+ "name": "cancel_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canceled_at": {
+ "name": "canceled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seats": {
+ "name": "seats",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_start": {
+ "name": "trial_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_end": {
+ "name": "trial_end",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_interval": {
+ "name": "billing_interval",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_schedule_id": {
+ "name": "stripe_schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_closed_period_start": {
+ "name": "last_closed_period_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "subscription_reference_status_idx": {
+ "name": "subscription_reference_status_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "subscription_cycle_close_lagging_idx": {
+ "name": "subscription_cycle_close_lagging_idx",
+ "columns": [
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"subscription\".\"status\" in ('active', 'past_due') and \"subscription\".\"period_start\" is not null and (\"subscription\".\"last_closed_period_start\" is null or \"subscription\".\"last_closed_period_start\" < \"subscription\".\"period_start\")",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "check_enterprise_metadata": {
+ "name": "check_enterprise_metadata",
+ "value": "plan != 'enterprise' OR metadata IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.table_jobs": {
+ "name": "table_jobs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rows_processed": {
+ "name": "rows_processed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "table_jobs_one_active_per_table": {
+ "name": "table_jobs_one_active_per_table",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"table_jobs\".\"status\" = 'running' AND \"table_jobs\".\"type\" <> 'export'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_jobs_watchdog_idx": {
+ "name": "table_jobs_watchdog_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_jobs_table_started_idx": {
+ "name": "table_jobs_table_started_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "table_jobs_table_id_user_table_definitions_id_fk": {
+ "name": "table_jobs_table_id_user_table_definitions_id_fk",
+ "tableFrom": "table_jobs",
+ "tableTo": "user_table_definitions",
+ "columnsFrom": ["table_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_jobs_workspace_id_workspace_id_fk": {
+ "name": "table_jobs_workspace_id_workspace_id_fk",
+ "tableFrom": "table_jobs",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.table_row_executions": {
+ "name": "table_row_executions",
+ "schema": "",
+ "columns": {
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "row_id": {
+ "name": "row_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "running_block_ids": {
+ "name": "running_block_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "block_errors": {
+ "name": "block_errors",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "cancelled_at": {
+ "name": "cancelled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "capability_governed_user_id": {
+ "name": "capability_governed_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enrichment_details": {
+ "name": "enrichment_details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "table_row_executions_table_status_idx": {
+ "name": "table_row_executions_table_status_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"table_row_executions\".\"status\" IN ('queued', 'running', 'pending')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_row_executions_execution_id_idx": {
+ "name": "table_row_executions_execution_id_idx",
+ "columns": [
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"table_row_executions\".\"execution_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_row_executions_table_group_idx": {
+ "name": "table_row_executions_table_group_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "table_row_executions_table_id_user_table_definitions_id_fk": {
+ "name": "table_row_executions_table_id_user_table_definitions_id_fk",
+ "tableFrom": "table_row_executions",
+ "tableTo": "user_table_definitions",
+ "columnsFrom": ["table_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_row_executions_row_id_user_table_rows_id_fk": {
+ "name": "table_row_executions_row_id_user_table_rows_id_fk",
+ "tableFrom": "table_row_executions",
+ "tableTo": "user_table_rows",
+ "columnsFrom": ["row_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_row_executions_capability_governed_user_id_user_id_fk": {
+ "name": "table_row_executions_capability_governed_user_id_user_id_fk",
+ "tableFrom": "table_row_executions",
+ "tableTo": "user",
+ "columnsFrom": ["capability_governed_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "table_row_executions_row_id_group_id_pk": {
+ "name": "table_row_executions_row_id_group_id_pk",
+ "columns": ["row_id", "group_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.table_run_dispatches": {
+ "name": "table_run_dispatches",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "limit": {
+ "name": "limit",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processed_count": {
+ "name": "processed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "is_manual_run": {
+ "name": "is_manual_run",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "triggered_by_user_id": {
+ "name": "triggered_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "capability_governed_user_id": {
+ "name": "capability_governed_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_at": {
+ "name": "requested_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled_at": {
+ "name": "cancelled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "table_run_dispatches_active_idx": {
+ "name": "table_run_dispatches_active_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_run_dispatches_watchdog_idx": {
+ "name": "table_run_dispatches_watchdog_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "requested_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_run_dispatches_governed_active_idx": {
+ "name": "table_run_dispatches_governed_active_idx",
+ "columns": [
+ {
+ "expression": "capability_governed_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"table_run_dispatches\".\"status\" IN ('pending', 'dispatching')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "table_run_dispatches_table_id_user_table_definitions_id_fk": {
+ "name": "table_run_dispatches_table_id_user_table_definitions_id_fk",
+ "tableFrom": "table_run_dispatches",
+ "tableTo": "user_table_definitions",
+ "columnsFrom": ["table_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_run_dispatches_workspace_id_workspace_id_fk": {
+ "name": "table_run_dispatches_workspace_id_workspace_id_fk",
+ "tableFrom": "table_run_dispatches",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_run_dispatches_triggered_by_user_id_user_id_fk": {
+ "name": "table_run_dispatches_triggered_by_user_id_user_id_fk",
+ "tableFrom": "table_run_dispatches",
+ "tableTo": "user",
+ "columnsFrom": ["triggered_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "table_run_dispatches_capability_governed_user_id_user_id_fk": {
+ "name": "table_run_dispatches_capability_governed_user_id_user_id_fk",
+ "tableFrom": "table_run_dispatches",
+ "tableTo": "user",
+ "columnsFrom": ["capability_governed_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.table_views": {
+ "name": "table_views",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "table_views_table_created_idx": {
+ "name": "table_views_table_created_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_views_workspace_created_idx": {
+ "name": "table_views_workspace_created_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "table_views_table_default_unique": {
+ "name": "table_views_table_default_unique",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "is_default = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "table_views_table_id_user_table_definitions_id_fk": {
+ "name": "table_views_table_id_user_table_definitions_id_fk",
+ "tableFrom": "table_views",
+ "tableTo": "user_table_definitions",
+ "columnsFrom": ["table_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_views_workspace_id_workspace_id_fk": {
+ "name": "table_views_workspace_id_workspace_id_fk",
+ "tableFrom": "table_views",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "table_views_created_by_user_id_fk": {
+ "name": "table_views_created_by_user_id_fk",
+ "tableFrom": "table_views",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.upload_session": {
+ "name": "upload_session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "knowledge_base_id": {
+ "name": "knowledge_base_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "purpose": {
+ "name": "purpose",
+ "type": "upload_session_purpose",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "method": {
+ "name": "method",
+ "type": "upload_session_method",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_context": {
+ "name": "storage_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "final_key": {
+ "name": "final_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_provider": {
+ "name": "storage_provider",
+ "type": "upload_session_provider",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_upload_id": {
+ "name": "provider_upload_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_object_version": {
+ "name": "provider_object_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "part_size": {
+ "name": "part_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "part_count": {
+ "name": "part_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "upload_session_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'uploading'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "processing_lease_id": {
+ "name": "processing_lease_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_lease_expires_at": {
+ "name": "processing_lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_file_id": {
+ "name": "completed_file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "upload_session_token_hash_unique": {
+ "name": "upload_session_token_hash_unique",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "upload_session_final_key_unique": {
+ "name": "upload_session_final_key_unique",
+ "columns": [
+ {
+ "expression": "final_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "upload_session_status_expires_at_idx": {
+ "name": "upload_session_status_expires_at_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.usage_log": {
+ "name": "usage_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "usage_log_category",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "usage_log_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost": {
+ "name": "cost",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_key": {
+ "name": "event_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_entity_type": {
+ "name": "billing_entity_type",
+ "type": "billing_entity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_entity_id": {
+ "name": "billing_entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_period_start": {
+ "name": "billing_period_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_period_end": {
+ "name": "billing_period_end",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "usage_log_user_created_at_idx": {
+ "name": "usage_log_user_created_at_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_source_idx": {
+ "name": "usage_log_source_idx",
+ "columns": [
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_workflow_id_idx": {
+ "name": "usage_log_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_event_key_unique": {
+ "name": "usage_log_event_key_unique",
+ "columns": [
+ {
+ "expression": "event_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"usage_log\".\"event_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_billing_entity_period_cost_idx": {
+ "name": "usage_log_billing_entity_period_cost_idx",
+ "columns": [
+ {
+ "expression": "billing_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "billing_entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "billing_period_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "billing_period_end",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_billing_entity_created_at_cost_idx": {
+ "name": "usage_log_billing_entity_created_at_cost_idx",
+ "columns": [
+ {
+ "expression": "billing_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "billing_entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_workspace_created_at_cost_idx": {
+ "name": "usage_log_workspace_created_at_cost_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "billing_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "billing_entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "usage_log_execution_id_idx": {
+ "name": "usage_log_execution_id_idx",
+ "columns": [
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "usage_log_user_id_user_id_fk": {
+ "name": "usage_log_user_id_user_id_fk",
+ "tableFrom": "usage_log",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "usage_log_workspace_id_workspace_id_fk": {
+ "name": "usage_log_workspace_id_workspace_id_fk",
+ "tableFrom": "usage_log",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "usage_log_workflow_id_workflow_id_fk": {
+ "name": "usage_log_workflow_id_workflow_id_fk",
+ "tableFrom": "usage_log",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "usage_log_billing_scope_all_or_none": {
+ "name": "usage_log_billing_scope_all_or_none",
+ "value": "(\n (\"usage_log\".\"billing_entity_type\" IS NULL AND \"usage_log\".\"billing_entity_id\" IS NULL AND \"usage_log\".\"billing_period_start\" IS NULL AND \"usage_log\".\"billing_period_end\" IS NULL)\n OR\n (\"usage_log\".\"billing_entity_type\" IS NOT NULL AND \"usage_log\".\"billing_entity_id\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" IS NOT NULL AND \"usage_log\".\"billing_period_end\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" < \"usage_log\".\"billing_period_end\")\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_email": {
+ "name": "normalized_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'user'"
+ },
+ "banned": {
+ "name": "banned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "ban_reason": {
+ "name": "ban_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ban_expires": {
+ "name": "ban_expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspension_source": {
+ "name": "suspension_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "user_email_lower_idx": {
+ "name": "user_email_lower_idx",
+ "columns": [
+ {
+ "expression": "lower(btrim(\"email\"))",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_gmail_mailbox_idx": {
+ "name": "user_gmail_mailbox_idx",
+ "columns": [
+ {
+ "expression": "(CASE WHEN split_part(lower(btrim(\"email\")), '@', 2) IN ('gmail.com', 'googlemail.com') THEN replace(split_part(split_part(lower(btrim(\"email\")), '@', 1), '+', 1), '.', '') || '@gmail.com' END)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "(CASE WHEN split_part(lower(btrim(\"user\".\"email\")), '@', 2) IN ('gmail.com', 'googlemail.com') THEN replace(split_part(split_part(lower(btrim(\"user\".\"email\")), '@', 1), '+', 1), '.', '') || '@gmail.com' END) IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ },
+ "user_normalized_email_unique": {
+ "name": "user_normalized_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["normalized_email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_stats": {
+ "name": "user_stats",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "current_usage_limit": {
+ "name": "current_usage_limit",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'5'"
+ },
+ "usage_limit_updated_at": {
+ "name": "usage_limit_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "last_period_cost": {
+ "name": "last_period_cost",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "billed_overage_this_period": {
+ "name": "billed_overage_this_period",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "credit_balance": {
+ "name": "credit_balance",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "last_period_copilot_cost": {
+ "name": "last_period_copilot_cost",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "storage_used_bytes": {
+ "name": "storage_used_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "free_tier_eligible": {
+ "name": "free_tier_eligible",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "billing_blocked": {
+ "name": "billing_blocked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "billing_blocked_reason": {
+ "name": "billing_blocked_reason",
+ "type": "billing_blocked_reason",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "limit_notifications": {
+ "name": "limit_notifications",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_stats_user_id_user_id_fk": {
+ "name": "user_stats_user_id_user_id_fk",
+ "tableFrom": "user_stats",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_stats_user_id_unique": {
+ "name": "user_stats_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_table_definitions": {
+ "name": "user_table_definitions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "folder_id": {
+ "name": "folder_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schema": {
+ "name": "schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_rows": {
+ "name": "max_rows",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 10000
+ },
+ "row_count": {
+ "name": "row_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "rows_version": {
+ "name": "rows_version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "schema_locked": {
+ "name": "schema_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "insert_locked": {
+ "name": "insert_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "update_locked": {
+ "name": "update_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "delete_locked": {
+ "name": "delete_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_table_def_workspace_id_idx": {
+ "name": "user_table_def_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_def_folder_id_idx": {
+ "name": "user_table_def_folder_id_idx",
+ "columns": [
+ {
+ "expression": "folder_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_def_created_by_idx": {
+ "name": "user_table_def_created_by_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_def_workspace_name_unique": {
+ "name": "user_table_def_workspace_name_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_table_definitions\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_def_archived_at_idx": {
+ "name": "user_table_def_archived_at_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_def_workspace_archived_partial_idx": {
+ "name": "user_table_def_workspace_archived_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_table_definitions\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_table_definitions_workspace_id_workspace_id_fk": {
+ "name": "user_table_definitions_workspace_id_workspace_id_fk",
+ "tableFrom": "user_table_definitions",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_table_definitions_folder_id_folder_id_fk": {
+ "name": "user_table_definitions_folder_id_folder_id_fk",
+ "tableFrom": "user_table_definitions",
+ "tableTo": "folder",
+ "columnsFrom": ["folder_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "user_table_definitions_created_by_user_id_fk": {
+ "name": "user_table_definitions_created_by_user_id_fk",
+ "tableFrom": "user_table_definitions",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_table_row_changes": {
+ "name": "user_table_row_changes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "user_table_row_changes_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "9223372036854775807",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "row_delta": {
+ "name": "row_delta",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "user_table_row_changes_table_id_idx": {
+ "name": "user_table_row_changes_table_id_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_table_row_changes_table_id_user_table_definitions_id_fk": {
+ "name": "user_table_row_changes_table_id_user_table_definitions_id_fk",
+ "tableFrom": "user_table_row_changes",
+ "tableTo": "user_table_definitions",
+ "columnsFrom": ["table_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_table_row_secret_provenance": {
+ "name": "user_table_row_secret_provenance",
+ "schema": "",
+ "columns": {
+ "row_id": {
+ "name": "row_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "content_updated_at": {
+ "name": "content_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entries": {
+ "name": "entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_table_row_secret_provenance_row_id_user_table_rows_id_fk": {
+ "name": "user_table_row_secret_provenance_row_id_user_table_rows_id_fk",
+ "tableFrom": "user_table_row_secret_provenance",
+ "tableTo": "user_table_rows",
+ "columnsFrom": ["row_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_table_row_secret_provenance_status_check": {
+ "name": "user_table_row_secret_provenance_status_check",
+ "value": "\"user_table_row_secret_provenance\".\"status\" IN ('exact', 'unknown')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_table_rows": {
+ "name": "user_table_rows",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "order_key": {
+ "name": "order_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_provenance_version": {
+ "name": "secret_provenance_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "user_table_rows_created_by_idx": {
+ "name": "user_table_rows_created_by_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_table_rows\".\"created_by\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_rows_tenant_data_gin_idx": {
+ "name": "user_table_rows_tenant_data_gin_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "\"data\" jsonb_path_ops",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {
+ "fastupdate": "off"
+ }
+ },
+ "user_table_rows_workspace_table_idx": {
+ "name": "user_table_rows_workspace_table_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_rows_table_position_idx": {
+ "name": "user_table_rows_table_position_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_rows_table_order_key_idx": {
+ "name": "user_table_rows_table_order_key_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "order_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_rows_table_created_id_idx": {
+ "name": "user_table_rows_table_created_id_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_table_rows_table_id_id_idx": {
+ "name": "user_table_rows_table_id_id_idx",
+ "columns": [
+ {
+ "expression": "table_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_table_rows_table_id_user_table_definitions_id_fk": {
+ "name": "user_table_rows_table_id_user_table_definitions_id_fk",
+ "tableFrom": "user_table_rows",
+ "tableTo": "user_table_definitions",
+ "columnsFrom": ["table_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_table_rows_workspace_id_workspace_id_fk": {
+ "name": "user_table_rows_workspace_id_workspace_id_fk",
+ "tableFrom": "user_table_rows",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_table_rows_created_by_user_id_fk": {
+ "name": "user_table_rows_created_by_user_id_fk",
+ "tableFrom": "user_table_rows",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "verification_expires_at_idx": {
+ "name": "verification_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook": {
+ "name": "webhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "registration_status": {
+ "name": "registration_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "registration_generation": {
+ "name": "registration_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config_fingerprint": {
+ "name": "config_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prepared_at": {
+ "name": "prepared_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "block_id": {
+ "name": "block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "routing_key": {
+ "name": "routing_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_config": {
+ "name": "provider_config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "failed_count": {
+ "name": "failed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "last_failed_at": {
+ "name": "last_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "path_deployment_unique": {
+ "name": "path_deployment_unique",
+ "columns": [
+ {
+ "expression": "path",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"webhook\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_workflow_deployment_idx": {
+ "name": "webhook_workflow_deployment_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_routing_key_active_idx": {
+ "name": "webhook_routing_key_active_idx",
+ "columns": [
+ {
+ "expression": "routing_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"webhook\".\"archived_at\" IS NULL AND \"webhook\".\"routing_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_archived_at_partial_idx": {
+ "name": "webhook_archived_at_partial_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"webhook\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468": {
+ "name": "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_webhook_on_workflow_id_block_id_updated_at_desc": {
+ "name": "idx_webhook_on_workflow_id_block_id_updated_at_desc",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_active_registration_unique": {
+ "name": "webhook_active_registration_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"webhook\".\"registration_status\" = 'active' AND \"webhook\".\"block_id\" IS NOT NULL AND \"webhook\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_candidate_registration_unique": {
+ "name": "webhook_candidate_registration_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"webhook\".\"registration_status\" = 'candidate' AND \"webhook\".\"block_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_registration_status_generation_idx": {
+ "name": "webhook_registration_status_generation_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "registration_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "registration_generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_workflow_id_workflow_id_fk": {
+ "name": "webhook_workflow_id_workflow_id_fk",
+ "tableFrom": "webhook",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "webhook_deployment_version_id_workflow_deployment_version_id_fk": {
+ "name": "webhook_deployment_version_id_workflow_deployment_version_id_fk",
+ "tableFrom": "webhook",
+ "tableTo": "workflow_deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "webhook_registration_status_check": {
+ "name": "webhook_registration_status_check",
+ "value": "\"webhook\".\"registration_status\" IS NULL OR \"webhook\".\"registration_status\" IN ('active', 'candidate', 'retired', 'orphaned')"
+ },
+ "webhook_registration_generation_check": {
+ "name": "webhook_registration_generation_check",
+ "value": "\"webhook\".\"registration_generation\" IS NULL OR \"webhook\".\"registration_generation\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.webhook_path_claim": {
+ "name": "webhook_path_claim",
+ "schema": "",
+ "columns": {
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_path_claim_workflow_idx": {
+ "name": "webhook_path_claim_workflow_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_path_claim_workflow_id_workflow_id_fk": {
+ "name": "webhook_path_claim_workflow_id_workflow_id_fk",
+ "tableFrom": "webhook_path_claim",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "webhook_path_claim_generation_check": {
+ "name": "webhook_path_claim_generation_check",
+ "value": "\"webhook_path_claim\".\"generation\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workflow": {
+ "name": "workflow",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "folder_id": {
+ "name": "folder_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_synced": {
+ "name": "last_synced",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_deployed": {
+ "name": "is_deployed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "deployed_at": {
+ "name": "deployed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_public_api": {
+ "name": "is_public_api",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "locked": {
+ "name": "locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "fork_sync_excluded": {
+ "name": "fork_sync_excluded",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "run_count": {
+ "name": "run_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "variables": {
+ "name": "variables",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workflow_workspace_id_idx": {
+ "name": "workflow_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_user_workspace_idx": {
+ "name": "workflow_user_workspace_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_workspace_folder_name_active_unique": {
+ "name": "workflow_workspace_folder_name_active_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"folder_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workflow\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_folder_sort_idx": {
+ "name": "workflow_folder_sort_idx",
+ "columns": [
+ {
+ "expression": "folder_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sort_order",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_active_workspace_sort_idx": {
+ "name": "workflow_active_workspace_sort_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sort_order",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_archived_at_idx": {
+ "name": "workflow_archived_at_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_workspace_archived_partial_idx": {
+ "name": "workflow_workspace_archived_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_user_id_user_id_fk": {
+ "name": "workflow_user_id_user_id_fk",
+ "tableFrom": "workflow",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_workspace_id_workspace_id_fk": {
+ "name": "workflow_workspace_id_workspace_id_fk",
+ "tableFrom": "workflow",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_folder_id_folder_id_fk": {
+ "name": "workflow_folder_id_folder_id_fk",
+ "tableFrom": "workflow",
+ "tableTo": "folder",
+ "columnsFrom": ["folder_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_activity_hourly": {
+ "name": "workflow_activity_hourly",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bucket_start": {
+ "name": "bucket_start",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "runs": {
+ "name": "runs",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed": {
+ "name": "completed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "failed": {
+ "name": "failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cancelled": {
+ "name": "cancelled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "in_flight": {
+ "name": "in_flight",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration_sum_ms": {
+ "name": "duration_sum_ms",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration_count": {
+ "name": "duration_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "computed_at": {
+ "name": "computed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_activity_hourly_read_idx": {
+ "name": "workflow_activity_hourly_read_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bucket_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "trigger",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "runs",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "completed",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "failed",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cancelled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "in_flight",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "duration_sum_ms",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "duration_count",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_activity_hourly_bucket_start_idx": {
+ "name": "workflow_activity_hourly_bucket_start_idx",
+ "columns": [
+ {
+ "expression": "bucket_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "workflow_activity_hourly_pk": {
+ "name": "workflow_activity_hourly_pk",
+ "columns": ["workspace_id", "bucket_start", "workflow_id", "trigger"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_blocks": {
+ "name": "workflow_blocks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position_x": {
+ "name": "position_x",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position_y": {
+ "name": "position_y",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "horizontal_handles": {
+ "name": "horizontal_handles",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "is_wide": {
+ "name": "is_wide",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "advanced_mode": {
+ "name": "advanced_mode",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trigger_mode": {
+ "name": "trigger_mode",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "error_enabled": {
+ "name": "error_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "retry": {
+ "name": "retry",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locked": {
+ "name": "locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "height": {
+ "name": "height",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "sub_blocks": {
+ "name": "sub_blocks",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "outputs": {
+ "name": "outputs",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_blocks_workflow_id_idx": {
+ "name": "workflow_blocks_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_blocks_type_idx": {
+ "name": "workflow_blocks_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_blocks_workflow_id_workflow_id_fk": {
+ "name": "workflow_blocks_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_blocks",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_checkpoints": {
+ "name": "workflow_checkpoints",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workflow_state": {
+ "name": "workflow_state",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_checkpoints_chat_id_idx": {
+ "name": "workflow_checkpoints_chat_id_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_checkpoints_message_id_idx": {
+ "name": "workflow_checkpoints_message_id_idx",
+ "columns": [
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_checkpoints_user_workflow_idx": {
+ "name": "workflow_checkpoints_user_workflow_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_checkpoints_workflow_chat_idx": {
+ "name": "workflow_checkpoints_workflow_chat_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_checkpoints_created_at_idx": {
+ "name": "workflow_checkpoints_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_checkpoints_chat_created_at_idx": {
+ "name": "workflow_checkpoints_chat_created_at_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_checkpoints_user_id_user_id_fk": {
+ "name": "workflow_checkpoints_user_id_user_id_fk",
+ "tableFrom": "workflow_checkpoints",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_checkpoints_workflow_id_workflow_id_fk": {
+ "name": "workflow_checkpoints_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_checkpoints",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_checkpoints_chat_id_copilot_chats_id_fk": {
+ "name": "workflow_checkpoints_chat_id_copilot_chats_id_fk",
+ "tableFrom": "workflow_checkpoints",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_deployment_operation": {
+ "name": "workflow_deployment_operation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_active_version_id": {
+ "name": "previous_active_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "protocol_version": {
+ "name": "protocol_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'preparing'"
+ },
+ "component_readiness": {
+ "name": "component_readiness",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_hash": {
+ "name": "request_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_deployment_operation_workflow_generation_unique": {
+ "name": "workflow_deployment_operation_workflow_generation_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_operation_workflow_idempotency_unique": {
+ "name": "workflow_deployment_operation_workflow_idempotency_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workflow_deployment_operation\".\"idempotency_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_operation_workflow_in_flight_unique": {
+ "name": "workflow_deployment_operation_workflow_in_flight_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_operation_workflow_status_idx": {
+ "name": "workflow_deployment_operation_workflow_status_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_operation_deployment_version_idx": {
+ "name": "workflow_deployment_operation_deployment_version_idx",
+ "columns": [
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_operation_workflow_version_generation_idx": {
+ "name": "workflow_deployment_operation_workflow_version_generation_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "generation",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_deployment_operation_workflow_id_workflow_id_fk": {
+ "name": "workflow_deployment_operation_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_deployment_operation",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk": {
+ "name": "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk",
+ "tableFrom": "workflow_deployment_operation",
+ "tableTo": "workflow_deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk": {
+ "name": "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk",
+ "tableFrom": "workflow_deployment_operation",
+ "tableTo": "workflow_deployment_version",
+ "columnsFrom": ["previous_active_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workflow_deployment_operation_action_check": {
+ "name": "workflow_deployment_operation_action_check",
+ "value": "\"workflow_deployment_operation\".\"action\" IN ('deploy', 'activate')"
+ },
+ "workflow_deployment_operation_status_check": {
+ "name": "workflow_deployment_operation_status_check",
+ "value": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating', 'active', 'failed', 'superseded')"
+ },
+ "workflow_deployment_operation_generation_check": {
+ "name": "workflow_deployment_operation_generation_check",
+ "value": "\"workflow_deployment_operation\".\"generation\" > 0"
+ },
+ "workflow_deployment_operation_protocol_version_check": {
+ "name": "workflow_deployment_operation_protocol_version_check",
+ "value": "\"workflow_deployment_operation\".\"protocol_version\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workflow_deployment_version": {
+ "name": "workflow_deployment_version",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workflow_deployment_version_workflow_version_unique": {
+ "name": "workflow_deployment_version_workflow_version_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_version_workflow_active_idx": {
+ "name": "workflow_deployment_version_workflow_active_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_deployment_version_created_at_idx": {
+ "name": "workflow_deployment_version_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_deployment_version_workflow_id_workflow_id_fk": {
+ "name": "workflow_deployment_version_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_deployment_version",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_edges": {
+ "name": "workflow_edges",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_block_id": {
+ "name": "source_block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_block_id": {
+ "name": "target_block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_handle": {
+ "name": "source_handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_handle": {
+ "name": "target_handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_edges_workflow_source_idx": {
+ "name": "workflow_edges_workflow_source_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_edges_workflow_target_idx": {
+ "name": "workflow_edges_workflow_target_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_edges_source_block_fk_idx": {
+ "name": "workflow_edges_source_block_fk_idx",
+ "columns": [
+ {
+ "expression": "source_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_edges_target_block_fk_idx": {
+ "name": "workflow_edges_target_block_fk_idx",
+ "columns": [
+ {
+ "expression": "target_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_edges_workflow_id_workflow_id_fk": {
+ "name": "workflow_edges_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_edges",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_edges_source_block_id_workflow_blocks_id_fk": {
+ "name": "workflow_edges_source_block_id_workflow_blocks_id_fk",
+ "tableFrom": "workflow_edges",
+ "tableTo": "workflow_blocks",
+ "columnsFrom": ["source_block_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_edges_target_block_id_workflow_blocks_id_fk": {
+ "name": "workflow_edges_target_block_id_workflow_blocks_id_fk",
+ "tableFrom": "workflow_edges",
+ "tableTo": "workflow_blocks",
+ "columnsFrom": ["target_block_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_execution_logs": {
+ "name": "workflow_execution_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_snapshot_id": {
+ "name": "state_snapshot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "level": {
+ "name": "level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_deadline_at": {
+ "name": "execution_deadline_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_duration_ms": {
+ "name": "total_duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_data": {
+ "name": "execution_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "cost_total": {
+ "name": "cost_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "models_used": {
+ "name": "models_used",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "files": {
+ "name": "files",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_execution_logs_state_snapshot_id_idx": {
+ "name": "workflow_execution_logs_state_snapshot_id_idx",
+ "columns": [
+ {
+ "expression": "state_snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_deployment_version_id_idx": {
+ "name": "workflow_execution_logs_deployment_version_id_idx",
+ "columns": [
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_trigger_idx": {
+ "name": "workflow_execution_logs_trigger_idx",
+ "columns": [
+ {
+ "expression": "trigger",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_level_idx": {
+ "name": "workflow_execution_logs_level_idx",
+ "columns": [
+ {
+ "expression": "level",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_started_at_idx": {
+ "name": "workflow_execution_logs_started_at_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_execution_id_unique": {
+ "name": "workflow_execution_logs_execution_id_unique",
+ "columns": [
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_workflow_started_at_idx": {
+ "name": "workflow_execution_logs_workflow_started_at_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_workspace_activity_level_idx": {
+ "name": "workflow_execution_logs_workspace_activity_level_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "total_duration_ms",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "trigger",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "level",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_workspace_started_at_id_desc_idx": {
+ "name": "workflow_execution_logs_workspace_started_at_id_desc_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "\"started_at\" DESC NULLS LAST",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "\"id\" DESC",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_workspace_cost_total_idx": {
+ "name": "workflow_execution_logs_workspace_cost_total_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost_total",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_models_used_idx": {
+ "name": "workflow_execution_logs_models_used_idx",
+ "columns": [
+ {
+ "expression": "models_used",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ },
+ "workflow_execution_logs_workspace_ended_at_id_idx": {
+ "name": "workflow_execution_logs_workspace_ended_at_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date_trunc('milliseconds', \"ended_at\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_running_started_at_idx": {
+ "name": "workflow_execution_logs_running_started_at_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "status = 'running'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_running_deadline_idx": {
+ "name": "workflow_execution_logs_running_deadline_idx",
+ "columns": [
+ {
+ "expression": "execution_deadline_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_execution_logs\".\"status\" = 'running' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_redacting_started_at_idx": {
+ "name": "workflow_execution_logs_redacting_started_at_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "status = 'redacting'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_redacting_deadline_idx": {
+ "name": "workflow_execution_logs_redacting_deadline_idx",
+ "columns": [
+ {
+ "expression": "execution_deadline_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_execution_logs\".\"status\" = 'redacting' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_completed_ended_at_idx": {
+ "name": "workflow_execution_logs_completed_ended_at_idx",
+ "columns": [
+ {
+ "expression": "ended_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_execution_logs\".\"status\" = 'completed' AND \"workflow_execution_logs\".\"level\" = 'info' AND \"workflow_execution_logs\".\"ended_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_execution_logs_late_end_idx": {
+ "name": "workflow_execution_logs_late_end_idx",
+ "columns": [
+ {
+ "expression": "ended_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_execution_logs\".\"ended_at\" >= \"workflow_execution_logs\".\"started_at\" + interval '2 hours'",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_execution_logs_workflow_id_workflow_id_fk": {
+ "name": "workflow_execution_logs_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_execution_logs",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workflow_execution_logs_workspace_id_workspace_id_fk": {
+ "name": "workflow_execution_logs_workspace_id_workspace_id_fk",
+ "tableFrom": "workflow_execution_logs",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk": {
+ "name": "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk",
+ "tableFrom": "workflow_execution_logs",
+ "tableTo": "workflow_execution_snapshots",
+ "columnsFrom": ["state_snapshot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk": {
+ "name": "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk",
+ "tableFrom": "workflow_execution_logs",
+ "tableTo": "workflow_deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_execution_snapshots": {
+ "name": "workflow_execution_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state_hash": {
+ "name": "state_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_data": {
+ "name": "state_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_snapshots_hash_idx": {
+ "name": "workflow_snapshots_hash_idx",
+ "columns": [
+ {
+ "expression": "state_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_snapshots_workflow_hash_idx": {
+ "name": "workflow_snapshots_workflow_hash_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "state_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_snapshots_created_at_idx": {
+ "name": "workflow_snapshots_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_execution_snapshots_workflow_id_workflow_id_fk": {
+ "name": "workflow_execution_snapshots_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_execution_snapshots",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_mcp_server": {
+ "name": "workflow_mcp_server",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_mcp_server_workspace_id_idx": {
+ "name": "workflow_mcp_server_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_mcp_server_created_by_idx": {
+ "name": "workflow_mcp_server_created_by_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_mcp_server_deleted_at_idx": {
+ "name": "workflow_mcp_server_deleted_at_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_mcp_server_workspace_deleted_partial_idx": {
+ "name": "workflow_mcp_server_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_mcp_server\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_mcp_server_workspace_id_workspace_id_fk": {
+ "name": "workflow_mcp_server_workspace_id_workspace_id_fk",
+ "tableFrom": "workflow_mcp_server",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_mcp_server_created_by_user_id_fk": {
+ "name": "workflow_mcp_server_created_by_user_id_fk",
+ "tableFrom": "workflow_mcp_server",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_mcp_tool": {
+ "name": "workflow_mcp_tool",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "server_id": {
+ "name": "server_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_description": {
+ "name": "tool_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parameter_schema": {
+ "name": "parameter_schema",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "parameter_description_overrides": {
+ "name": "parameter_description_overrides",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::json"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_mcp_tool_server_id_idx": {
+ "name": "workflow_mcp_tool_server_id_idx",
+ "columns": [
+ {
+ "expression": "server_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_mcp_tool_workflow_id_idx": {
+ "name": "workflow_mcp_tool_workflow_id_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_mcp_tool_server_workflow_unique": {
+ "name": "workflow_mcp_tool_server_workflow_unique",
+ "columns": [
+ {
+ "expression": "server_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workflow_mcp_tool\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_mcp_tool_archived_at_partial_idx": {
+ "name": "workflow_mcp_tool_archived_at_partial_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_mcp_tool\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk": {
+ "name": "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk",
+ "tableFrom": "workflow_mcp_tool",
+ "tableTo": "workflow_mcp_server",
+ "columnsFrom": ["server_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_mcp_tool_workflow_id_workflow_id_fk": {
+ "name": "workflow_mcp_tool_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_mcp_tool",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_schedule": {
+ "name": "workflow_schedule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_operation_id": {
+ "name": "deployment_operation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "block_id": {
+ "name": "block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cron_expression": {
+ "name": "cron_expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_ran_at": {
+ "name": "last_ran_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_queued_at": {
+ "name": "last_queued_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_type": {
+ "name": "trigger_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "failed_count": {
+ "name": "failed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "infra_retry_count": {
+ "name": "infra_retry_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "last_failed_at": {
+ "name": "last_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'workflow'"
+ },
+ "job_title": {
+ "name": "job_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lifecycle": {
+ "name": "lifecycle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'persistent'"
+ },
+ "success_condition": {
+ "name": "success_condition",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_runs": {
+ "name": "max_runs",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_count": {
+ "name": "run_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "source_chat_id": {
+ "name": "source_chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_task_name": {
+ "name": "source_task_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_user_id": {
+ "name": "source_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_workspace_id": {
+ "name": "source_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_scope": {
+ "name": "secret_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'all'"
+ },
+ "mounted_secrets": {
+ "name": "mounted_secrets",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "job_history": {
+ "name": "job_history",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contexts": {
+ "name": "contexts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "excluded_dates": {
+ "name": "excluded_dates",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ends_at": {
+ "name": "ends_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_budget_usd": {
+ "name": "run_budget_usd",
+ "type": "numeric(12, 4)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_schedule_workflow_block_deployment_unique": {
+ "name": "workflow_schedule_workflow_block_deployment_unique",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workflow_schedule\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_schedule_workflow_deployment_idx": {
+ "name": "workflow_schedule_workflow_deployment_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_schedule_archived_at_partial_idx": {
+ "name": "workflow_schedule_archived_at_partial_idx",
+ "columns": [
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_schedule\".\"archived_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6": {
+ "name": "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6",
+ "columns": [
+ {
+ "expression": "source_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_schedule_due_workflow_idx": {
+ "name": "workflow_schedule_due_workflow_idx",
+ "columns": [
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND (\"workflow_schedule\".\"source_type\" = 'workflow' OR \"workflow_schedule\".\"source_type\" IS NULL)",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_schedule_due_job_idx": {
+ "name": "workflow_schedule_due_job_idx",
+ "columns": [
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND \"workflow_schedule\".\"source_type\" = 'job'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_schedule_workflow_id_workflow_id_fk": {
+ "name": "workflow_schedule_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_schedule",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk": {
+ "name": "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk",
+ "tableFrom": "workflow_schedule",
+ "tableTo": "workflow_deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk": {
+ "name": "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk",
+ "tableFrom": "workflow_schedule",
+ "tableTo": "workflow_deployment_operation",
+ "columnsFrom": ["deployment_operation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workflow_schedule_source_user_id_user_id_fk": {
+ "name": "workflow_schedule_source_user_id_user_id_fk",
+ "tableFrom": "workflow_schedule",
+ "tableTo": "user",
+ "columnsFrom": ["source_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_schedule_source_workspace_id_workspace_id_fk": {
+ "name": "workflow_schedule_source_workspace_id_workspace_id_fk",
+ "tableFrom": "workflow_schedule",
+ "tableTo": "workspace",
+ "columnsFrom": ["source_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_source_meta": {
+ "name": "workflow_source_meta",
+ "schema": "",
+ "columns": {
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "meta": {
+ "name": "meta",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workflow_source_meta_workflow_id_workflow_id_fk": {
+ "name": "workflow_source_meta_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_source_meta",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_subflows": {
+ "name": "workflow_subflows",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow_id": {
+ "name": "workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_subflows_workflow_type_idx": {
+ "name": "workflow_subflows_workflow_type_idx",
+ "columns": [
+ {
+ "expression": "workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_subflows_workflow_id_workflow_id_fk": {
+ "name": "workflow_subflows_workflow_id_workflow_id_fk",
+ "tableFrom": "workflow_subflows",
+ "tableTo": "workflow",
+ "columnsFrom": ["workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_test": {
+ "name": "workflow_test",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body_file_id": {
+ "name": "body_file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cases": {
+ "name": "cases",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'"
+ },
+ "source_hash": {
+ "name": "source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_test_workspace_name_unique": {
+ "name": "workflow_test_workspace_name_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workflow_test\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_test_body_file_unique": {
+ "name": "workflow_test_body_file_unique",
+ "columns": [
+ {
+ "expression": "body_file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_test_workspace_id_workspace_id_fk": {
+ "name": "workflow_test_workspace_id_workspace_id_fk",
+ "tableFrom": "workflow_test",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_test_body_file_id_workspace_files_id_fk": {
+ "name": "workflow_test_body_file_id_workspace_files_id_fk",
+ "tableFrom": "workflow_test",
+ "tableTo": "workspace_files",
+ "columnsFrom": ["body_file_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "workflow_test_created_by_user_id_user_id_fk": {
+ "name": "workflow_test_created_by_user_id_user_id_fk",
+ "tableFrom": "workflow_test",
+ "tableTo": "user",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_test_run": {
+ "name": "workflow_test_run",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "test_id": {
+ "name": "test_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "passed": {
+ "name": "passed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "failed": {
+ "name": "failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "skipped": {
+ "name": "skipped",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "report": {
+ "name": "report",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_hash": {
+ "name": "source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ran_against": {
+ "name": "ran_against",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "progress": {
+ "name": "progress",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "triggered_by_actor": {
+ "name": "triggered_by_actor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "triggered_by_user_id": {
+ "name": "triggered_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workflow_test_run_test_version_started_idx": {
+ "name": "workflow_test_run_test_version_started_idx",
+ "columns": [
+ {
+ "expression": "test_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_test_run_test_id_workflow_test_id_fk": {
+ "name": "workflow_test_run_test_id_workflow_test_id_fk",
+ "tableFrom": "workflow_test_run",
+ "tableTo": "workflow_test",
+ "columnsFrom": ["test_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_test_run_workspace_id_workspace_id_fk": {
+ "name": "workflow_test_run_workspace_id_workspace_id_fk",
+ "tableFrom": "workflow_test_run",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workflow_test_run_triggered_by_user_id_user_id_fk": {
+ "name": "workflow_test_run_triggered_by_user_id_user_id_fk",
+ "tableFrom": "workflow_test_run",
+ "tableTo": "user",
+ "columnsFrom": ["triggered_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workflow_test_run_version_check": {
+ "name": "workflow_test_run_version_check",
+ "value": "\"workflow_test_run\".\"version\" IN ('draft', 'deployed')"
+ },
+ "workflow_test_run_status_check": {
+ "name": "workflow_test_run_status_check",
+ "value": "\"workflow_test_run\".\"status\" IN ('running', 'passed', 'failed', 'error')"
+ },
+ "workflow_test_run_completed_check": {
+ "name": "workflow_test_run_completed_check",
+ "value": "(\"workflow_test_run\".\"status\" = 'running') = (\"workflow_test_run\".\"completed_at\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workload_identity_pending_subject": {
+ "name": "workload_identity_pending_subject",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject": {
+ "name": "subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workload_identity_pending_subject_subject_unique": {
+ "name": "workload_identity_pending_subject_subject_unique",
+ "columns": [
+ {
+ "expression": "subject",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workload_identity_pending_subject_issuer_idx": {
+ "name": "workload_identity_pending_subject_issuer_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workload_identity_pending_subject_user_id_idx": {
+ "name": "workload_identity_pending_subject_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workload_identity_pending_subject_workspace_id_workspace_id_fk": {
+ "name": "workload_identity_pending_subject_workspace_id_workspace_id_fk",
+ "tableFrom": "workload_identity_pending_subject",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workload_identity_pending_subject_user_id_user_id_fk": {
+ "name": "workload_identity_pending_subject_user_id_user_id_fk",
+ "tableFrom": "workload_identity_pending_subject",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#33C482'"
+ },
+ "logo_url": {
+ "name": "logo_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_scope_key": {
+ "name": "organization_scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "generated": {
+ "as": "CASE WHEN organization_id IS NULL THEN 'personal' ELSE 'organization:' || organization_id END",
+ "type": "stored"
+ }
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_mode": {
+ "name": "workspace_mode",
+ "type": "workspace_mode",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'grandfathered_shared'"
+ },
+ "billed_account_user_id": {
+ "name": "billed_account_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_used_bytes": {
+ "name": "storage_used_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "allow_personal_api_keys": {
+ "name": "allow_personal_api_keys",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "inbox_enabled": {
+ "name": "inbox_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "inbox_address": {
+ "name": "inbox_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inbox_provider_id": {
+ "name": "inbox_provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inbox_secret_scope": {
+ "name": "inbox_secret_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'all'"
+ },
+ "inbox_mounted_secrets": {
+ "name": "inbox_mounted_secrets",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_assigned_at": {
+ "name": "organization_assigned_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "forked_from_workspace_id": {
+ "name": "forked_from_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fork_sync_new_workflows_excluded": {
+ "name": "fork_sync_new_workflows_excluded",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_owner_id_idx": {
+ "name": "workspace_owner_id_idx",
+ "columns": [
+ {
+ "expression": "owner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_organization_id_idx": {
+ "name": "workspace_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_billed_account_user_id_idx": {
+ "name": "workspace_billed_account_user_id_idx",
+ "columns": [
+ {
+ "expression": "billed_account_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_project_id_id_idx": {
+ "name": "workspace_project_id_id_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_mode_idx": {
+ "name": "workspace_mode_idx",
+ "columns": [
+ {
+ "expression": "workspace_mode",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_forked_from_workspace_id_idx": {
+ "name": "workspace_forked_from_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "forked_from_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_inbox_provider_id_idx": {
+ "name": "workspace_inbox_provider_id_idx",
+ "columns": [
+ {
+ "expression": "inbox_provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace\".\"inbox_provider_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_organization_id_organization_id_fk": {
+ "name": "workspace_organization_id_organization_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_project_id_project_id_fk": {
+ "name": "workspace_project_id_project_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "workspace_billed_account_user_id_user_id_fk": {
+ "name": "workspace_billed_account_user_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["billed_account_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "workspace_forked_from_workspace_id_workspace_id_fk": {
+ "name": "workspace_forked_from_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "workspace",
+ "columnsFrom": ["forked_from_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_project_organization_fk": {
+ "name": "workspace_project_organization_fk",
+ "tableFrom": "workspace",
+ "tableTo": "project",
+ "columnsFrom": ["project_id", "organization_scope_key"],
+ "columnsTo": ["id", "organization_scope_key"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "workspace_fork_project_fk": {
+ "name": "workspace_fork_project_fk",
+ "tableFrom": "workspace",
+ "tableTo": "workspace",
+ "columnsFrom": ["forked_from_workspace_id", "project_id"],
+ "columnsTo": ["id", "project_id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_id_project_unique": {
+ "name": "workspace_id_project_unique",
+ "nullsNotDistinct": false,
+ "columns": ["id", "project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "workspace_storage_used_bytes_non_negative": {
+ "name": "workspace_storage_used_bytes_non_negative",
+ "value": "\"workspace\".\"storage_used_bytes\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_byok_keys": {
+ "name": "workspace_byok_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_byok_workspace_provider_idx": {
+ "name": "workspace_byok_workspace_provider_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_byok_keys_workspace_id_workspace_id_fk": {
+ "name": "workspace_byok_keys_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_byok_keys",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_byok_keys_created_by_user_id_fk": {
+ "name": "workspace_byok_keys_created_by_user_id_fk",
+ "tableFrom": "workspace_byok_keys",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_environment": {
+ "name": "workspace_environment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variables": {
+ "name": "variables",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_environment_workspace_unique": {
+ "name": "workspace_environment_workspace_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_environment_workspace_id_workspace_id_fk": {
+ "name": "workspace_environment_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_environment",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_file": {
+ "name": "workspace_file",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by": {
+ "name": "uploaded_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_file_workspace_id_idx": {
+ "name": "workspace_file_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_deleted_at_idx": {
+ "name": "workspace_file_deleted_at_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_workspace_deleted_partial_idx": {
+ "name": "workspace_file_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_uploaded_by_idx": {
+ "name": "workspace_file_uploaded_by_idx",
+ "columns": [
+ {
+ "expression": "uploaded_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_file_workspace_id_workspace_id_fk": {
+ "name": "workspace_file_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_file",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_file_uploaded_by_user_id_fk": {
+ "name": "workspace_file_uploaded_by_user_id_fk",
+ "tableFrom": "workspace_file",
+ "tableTo": "user",
+ "columnsFrom": ["uploaded_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_file_key_unique": {
+ "name": "workspace_file_key_unique",
+ "nullsNotDistinct": false,
+ "columns": ["key"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_collab_state": {
+ "name": "workspace_file_collab_state",
+ "schema": "",
+ "columns": {
+ "file_id": {
+ "name": "file_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "doc_state": {
+ "name": "doc_state",
+ "type": "bytea",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_hash": {
+ "name": "source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_file_collab_state_file_id_workspace_files_id_fk": {
+ "name": "workspace_file_collab_state_file_id_workspace_files_id_fk",
+ "tableFrom": "workspace_file_collab_state",
+ "tableTo": "workspace_files",
+ "columnsFrom": ["file_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_search_backfill": {
+ "name": "workspace_file_search_backfill",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "after_workspace_id": {
+ "name": "after_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "after_entity_type": {
+ "name": "after_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "after_entity_id": {
+ "name": "after_entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "after_file_id": {
+ "name": "after_file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_search_build": {
+ "name": "workspace_file_search_build",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "file_id": {
+ "name": "file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "artifact_key": {
+ "name": "artifact_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_content_updated_at": {
+ "name": "source_content_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workspace_file_search_build_file_idx": {
+ "name": "workspace_file_search_build_file_idx",
+ "columns": [
+ {
+ "expression": "file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_search_build_cleanup_idx": {
+ "name": "workspace_file_search_build_cleanup_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file_search_build\".\"expires_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "file_search_build_owner_check": {
+ "name": "file_search_build_owner_check",
+ "value": "(\"workspace_file_search_build\".\"entity_type\" IS NULL AND \"workspace_file_search_build\".\"entity_id\" IS NULL AND \"workspace_file_search_build\".\"workspace_id\" IS NOT NULL) OR (\"workspace_file_search_build\".\"entity_type\" = 'workspace' AND \"workspace_file_search_build\".\"entity_id\" = \"workspace_file_search_build\".\"workspace_id\") OR (\"workspace_file_search_build\".\"entity_type\" = 'project' AND length(\"workspace_file_search_build\".\"entity_id\") > 0 AND \"workspace_file_search_build\".\"workspace_id\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_search_chunk": {
+ "name": "workspace_file_search_chunk",
+ "schema": "",
+ "columns": {
+ "build_id": {
+ "name": "build_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ordinal": {
+ "name": "ordinal",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "line_start": {
+ "name": "line_start",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fragment": {
+ "name": "fragment",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "overlap": {
+ "name": "overlap",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "file_search_chunk_owner_content_idx": {
+ "name": "file_search_chunk_owner_content_idx",
+ "columns": [
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "text_ops"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "text_ops"
+ },
+ {
+ "expression": "content",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file_search_chunk\".\"entity_type\" = 'project'",
+ "concurrently": true,
+ "method": "gin",
+ "with": {
+ "fastupdate": "off"
+ }
+ },
+ "workspace_file_search_chunk_line_idx": {
+ "name": "workspace_file_search_chunk_line_idx",
+ "columns": [
+ {
+ "expression": "build_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "line_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "ordinal",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_search_chunk_content_idx": {
+ "name": "workspace_file_search_chunk_content_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "text_ops"
+ },
+ {
+ "expression": "content",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "gin",
+ "with": {
+ "fastupdate": "off"
+ }
+ }
+ },
+ "foreignKeys": {
+ "workspace_file_search_chunk_build_id_workspace_file_search_build_id_fk": {
+ "name": "workspace_file_search_chunk_build_id_workspace_file_search_build_id_fk",
+ "tableFrom": "workspace_file_search_chunk",
+ "tableTo": "workspace_file_search_build",
+ "columnsFrom": ["build_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "workspace_file_search_chunk_pk": {
+ "name": "workspace_file_search_chunk_pk",
+ "columns": ["build_id", "ordinal"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "file_search_chunk_owner_check": {
+ "name": "file_search_chunk_owner_check",
+ "value": "(\"workspace_file_search_chunk\".\"entity_type\" IS NULL AND \"workspace_file_search_chunk\".\"entity_id\" IS NULL AND \"workspace_file_search_chunk\".\"workspace_id\" IS NOT NULL) OR (\"workspace_file_search_chunk\".\"entity_type\" = 'workspace' AND \"workspace_file_search_chunk\".\"entity_id\" = \"workspace_file_search_chunk\".\"workspace_id\") OR (\"workspace_file_search_chunk\".\"entity_type\" = 'project' AND length(\"workspace_file_search_chunk\".\"entity_id\") > 0 AND \"workspace_file_search_chunk\".\"workspace_id\" IS NULL)"
+ },
+ "workspace_file_search_chunk_content_size": {
+ "name": "workspace_file_search_chunk_content_size",
+ "value": "octet_length(\"workspace_file_search_chunk\".\"content\") <= 8192"
+ },
+ "workspace_file_search_chunk_position": {
+ "name": "workspace_file_search_chunk_position",
+ "value": "\"workspace_file_search_chunk\".\"ordinal\" >= 0 AND \"workspace_file_search_chunk\".\"line_start\" > 0 AND \"workspace_file_search_chunk\".\"overlap\" BETWEEN 0 AND 2"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_search_revision": {
+ "name": "workspace_file_search_revision",
+ "schema": "",
+ "columns": {
+ "file_id": {
+ "name": "file_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_content_updated_at": {
+ "name": "source_content_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "workspace_file_search_index_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "build_id": {
+ "name": "build_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "line_count": {
+ "name": "line_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "indexed_bytes": {
+ "name": "indexed_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "chunk_count": {
+ "name": "chunk_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "dispatched_at": {
+ "name": "dispatched_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "handoff_expires_at": {
+ "name": "handoff_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "file_search_revision_owner_pending_idx": {
+ "name": "file_search_revision_owner_pending_idx",
+ "columns": [
+ {
+ "expression": "coalesce(\"entity_type\", 'workspace')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"entity_id\", \"workspace_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_content_updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file_search_revision\".\"status\" = 'pending' AND \"workspace_file_search_revision\".\"dispatched_at\" IS NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "file_search_revision_owner_status_idx": {
+ "name": "file_search_revision_owner_status_idx",
+ "columns": [
+ {
+ "expression": "coalesce(\"entity_type\", 'workspace')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"entity_id\", \"workspace_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "dispatched_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_search_revision_workspace_status_idx": {
+ "name": "workspace_file_search_revision_workspace_status_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_search_revision_build_idx": {
+ "name": "workspace_file_search_revision_build_idx",
+ "columns": [
+ {
+ "expression": "build_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_search_revision_pending_idx": {
+ "name": "workspace_file_search_revision_pending_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_content_updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file_search_revision\".\"status\" = 'pending' AND \"workspace_file_search_revision\".\"dispatched_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_search_revision_active_idx": {
+ "name": "workspace_file_search_revision_active_idx",
+ "columns": [
+ {
+ "expression": "dispatched_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file_search_revision\".\"status\" = 'pending' AND \"workspace_file_search_revision\".\"dispatched_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_file_search_revision_file_id_workspace_files_id_fk": {
+ "name": "workspace_file_search_revision_file_id_workspace_files_id_fk",
+ "tableFrom": "workspace_file_search_revision",
+ "tableTo": "workspace_files",
+ "columnsFrom": ["file_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_file_search_revision_build_id_workspace_file_search_build_id_fk": {
+ "name": "workspace_file_search_revision_build_id_workspace_file_search_build_id_fk",
+ "tableFrom": "workspace_file_search_revision",
+ "tableTo": "workspace_file_search_build",
+ "columnsFrom": ["build_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "file_search_revision_owner_check": {
+ "name": "file_search_revision_owner_check",
+ "value": "(\"workspace_file_search_revision\".\"entity_type\" IS NULL AND \"workspace_file_search_revision\".\"entity_id\" IS NULL AND \"workspace_file_search_revision\".\"workspace_id\" IS NOT NULL) OR (\"workspace_file_search_revision\".\"entity_type\" = 'workspace' AND \"workspace_file_search_revision\".\"entity_id\" = \"workspace_file_search_revision\".\"workspace_id\") OR (\"workspace_file_search_revision\".\"entity_type\" = 'project' AND length(\"workspace_file_search_revision\".\"entity_id\") > 0 AND \"workspace_file_search_revision\".\"workspace_id\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_secret_provenance": {
+ "name": "workspace_file_secret_provenance",
+ "schema": "",
+ "columns": {
+ "file_id": {
+ "name": "file_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "content_updated_at": {
+ "name": "content_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entries": {
+ "name": "entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_file_secret_provenance_file_id_workspace_files_id_fk": {
+ "name": "workspace_file_secret_provenance_file_id_workspace_files_id_fk",
+ "tableFrom": "workspace_file_secret_provenance",
+ "tableTo": "workspace_files",
+ "columnsFrom": ["file_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_file_secret_provenance_status_check": {
+ "name": "workspace_file_secret_provenance_status_check",
+ "value": "\"workspace_file_secret_provenance\".\"status\" IN ('exact', 'unknown', 'unrecorded')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_file_version": {
+ "name": "workspace_file_version",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "file_id": {
+ "name": "file_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "superseded_at": {
+ "name": "superseded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "workspace_file_version_source",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_user_ids": {
+ "name": "author_user_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "restored_from_version": {
+ "name": "restored_from_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_provenance_status": {
+ "name": "secret_provenance_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_provenance_entries": {
+ "name": "secret_provenance_entries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_file_version_file_version_unique": {
+ "name": "workspace_file_version_file_version_unique",
+ "columns": [
+ {
+ "expression": "file_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_version_key_unique": {
+ "name": "workspace_file_version_key_unique",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_version_workspace_id_idx": {
+ "name": "workspace_file_version_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_file_version_workspace_superseded_idx": {
+ "name": "workspace_file_version_workspace_superseded_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "superseded_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_file_version\".\"superseded_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_file_version_file_id_workspace_files_id_fk": {
+ "name": "workspace_file_version_file_id_workspace_files_id_fk",
+ "tableFrom": "workspace_file_version",
+ "tableTo": "workspace_files",
+ "columnsFrom": ["file_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_file_version_workspace_id_workspace_id_fk": {
+ "name": "workspace_file_version_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_file_version",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_file_version_provenance_status_check": {
+ "name": "workspace_file_version_provenance_status_check",
+ "value": "\"workspace_file_version\".\"secret_provenance_status\" IS NULL OR \"workspace_file_version\".\"secret_provenance_status\" IN ('exact', 'unknown', 'unrecorded')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_files": {
+ "name": "workspace_files",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "folder_id": {
+ "name": "folder_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "context": {
+ "name": "context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "original_name": {
+ "name": "original_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "width": {
+ "name": "width",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "content_updated_at": {
+ "name": "content_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "date_trunc('milliseconds', now())"
+ },
+ "secret_provenance_version": {
+ "name": "secret_provenance_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workspace_files_project_id_idx": {
+ "name": "workspace_files_project_id_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_project_folder_name_active_unique": {
+ "name": "workspace_files_project_folder_name_active_unique",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"folder_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "original_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"project_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_key_active_unique": {
+ "name": "workspace_files_key_active_unique",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_folder_name_active_unique": {
+ "name": "workspace_files_workspace_folder_name_active_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"folder_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "original_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_search_owner_keyset_idx": {
+ "name": "workspace_files_search_owner_keyset_idx",
+ "columns": [
+ {
+ "expression": "(CASE WHEN \"project_id\" IS NOT NULL THEN 'project' ELSE 'workspace' END)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"project_id\", \"workspace_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND ((\"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL) OR (\"workspace_files\".\"context\" = 'project' AND \"workspace_files\".\"project_id\" IS NOT NULL))",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_active_keyset_idx": {
+ "name": "workspace_files_workspace_active_keyset_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_active_uploaded_idx": {
+ "name": "workspace_files_workspace_active_uploaded_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "uploaded_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_active_updated_idx": {
+ "name": "workspace_files_workspace_active_updated_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_folder_uploaded_idx": {
+ "name": "workspace_files_workspace_folder_uploaded_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"folder_id\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "uploaded_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_name_trgm_idx": {
+ "name": "workspace_files_workspace_name_trgm_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "text_ops"
+ },
+ {
+ "expression": "original_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "gin",
+ "with": {
+ "fastupdate": "off"
+ }
+ },
+ "workspace_files_workspace_display_name_idx": {
+ "name": "workspace_files_workspace_display_name_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "regexp_replace(regexp_replace(regexp_replace(normalize(\"original_name\", NFC), '^[ \\t\\n\\v\\f\\r\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+|[ \\t\\n\\v\\f\\r\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+$', '', 'g'), '[\\x01-\\x1f\\x7f]', '', 'g'), '[ \\t\\n\\v\\f\\r\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+', ' ', 'g')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_chat_display_name_unique": {
+ "name": "workspace_files_chat_display_name_unique",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "display_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_files\".\"context\" = 'mothership' AND \"workspace_files\".\"chat_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_organization_id_idx": {
+ "name": "workspace_files_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_key_idx": {
+ "name": "workspace_files_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_user_id_idx": {
+ "name": "workspace_files_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_id_idx": {
+ "name": "workspace_files_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_folder_id_idx": {
+ "name": "workspace_files_folder_id_idx",
+ "columns": [
+ {
+ "expression": "folder_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_context_idx": {
+ "name": "workspace_files_context_idx",
+ "columns": [
+ {
+ "expression": "context",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_chat_id_idx": {
+ "name": "workspace_files_chat_id_idx",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_deleted_at_idx": {
+ "name": "workspace_files_deleted_at_idx",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_files_workspace_deleted_partial_idx": {
+ "name": "workspace_files_workspace_deleted_partial_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_files\".\"deleted_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_files_project_id_project_id_fk": {
+ "name": "workspace_files_project_id_project_id_fk",
+ "tableFrom": "workspace_files",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "workspace_files_user_id_user_id_fk": {
+ "name": "workspace_files_user_id_user_id_fk",
+ "tableFrom": "workspace_files",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_files_workspace_id_workspace_id_fk": {
+ "name": "workspace_files_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_files",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_files_organization_id_organization_id_fk": {
+ "name": "workspace_files_organization_id_organization_id_fk",
+ "tableFrom": "workspace_files",
+ "tableTo": "organization",
+ "columnsFrom": ["organization_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_files_folder_id_folder_id_fk": {
+ "name": "workspace_files_folder_id_folder_id_fk",
+ "tableFrom": "workspace_files",
+ "tableTo": "folder",
+ "columnsFrom": ["folder_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "workspace_files_chat_id_copilot_chats_id_fk": {
+ "name": "workspace_files_chat_id_copilot_chats_id_fk",
+ "tableFrom": "workspace_files",
+ "tableTo": "copilot_chats",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_files_owner_check": {
+ "name": "workspace_files_owner_check",
+ "value": "num_nonnulls(\"workspace_files\".\"workspace_id\", \"workspace_files\".\"project_id\", \"workspace_files\".\"organization_id\") <= 1"
+ },
+ "workspace_files_workspace_binding_check": {
+ "name": "workspace_files_workspace_binding_check",
+ "value": "\"workspace_files\".\"context\" NOT IN ('workspace', 'chat', 'mothership', 'execution', 'workspace-logos') OR \"workspace_files\".\"workspace_id\" IS NOT NULL"
+ },
+ "workspace_files_project_binding_check": {
+ "name": "workspace_files_project_binding_check",
+ "value": "(\"workspace_files\".\"project_id\" IS NOT NULL) = (\"workspace_files\".\"context\" = 'project') AND (\"workspace_files\".\"project_id\" IS NULL OR \"workspace_files\".\"chat_id\" IS NULL)"
+ },
+ "workspace_files_organization_binding_check": {
+ "name": "workspace_files_organization_binding_check",
+ "value": "\"workspace_files\".\"organization_id\" IS NULL OR (\"workspace_files\".\"workspace_id\" IS NULL AND \"workspace_files\".\"context\" = 'knowledge-base' AND \"workspace_files\".\"folder_id\" IS NULL AND \"workspace_files\".\"chat_id\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_fork_block_map": {
+ "name": "workspace_fork_block_map",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "child_workspace_id": {
+ "name": "child_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_workflow_id": {
+ "name": "parent_workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_block_id": {
+ "name": "parent_block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "child_workflow_id": {
+ "name": "child_workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "child_block_id": {
+ "name": "child_block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_fork_block_map_child_ws_parent_unique": {
+ "name": "workspace_fork_block_map_child_ws_parent_unique",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_block_map_child_ws_child_unique": {
+ "name": "workspace_fork_block_map_child_ws_child_unique",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "child_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_block_map_child_ws_parent_wf_idx": {
+ "name": "workspace_fork_block_map_child_ws_parent_wf_idx",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_block_map_child_ws_child_wf_idx": {
+ "name": "workspace_fork_block_map_child_ws_child_wf_idx",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "child_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_fork_block_map_child_workspace_id_workspace_id_fk": {
+ "name": "workspace_fork_block_map_child_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_fork_block_map",
+ "tableTo": "workspace",
+ "columnsFrom": ["child_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_fork_dependent_value": {
+ "name": "workspace_fork_dependent_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "child_workspace_id": {
+ "name": "child_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_workflow_id": {
+ "name": "target_workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_block_id": {
+ "name": "target_block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sub_block_key": {
+ "name": "sub_block_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_fork_dependent_value_field_unique": {
+ "name": "workspace_fork_dependent_value_field_unique",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sub_block_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk": {
+ "name": "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_fork_dependent_value",
+ "tableTo": "workspace",
+ "columnsFrom": ["child_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_fork_promote_run": {
+ "name": "workspace_fork_promote_run",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "child_workspace_id": {
+ "name": "child_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_workspace_id": {
+ "name": "source_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_workspace_id": {
+ "name": "target_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "direction": {
+ "name": "direction",
+ "type": "workspace_fork_promote_direction",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_fork_promote_run_child_ws_target_unique": {
+ "name": "workspace_fork_promote_run_child_ws_target_unique",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_promote_run_target_ws_idx": {
+ "name": "workspace_fork_promote_run_target_ws_idx",
+ "columns": [
+ {
+ "expression": "target_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_fork_promote_run_child_workspace_id_workspace_id_fk": {
+ "name": "workspace_fork_promote_run_child_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_fork_promote_run",
+ "tableTo": "workspace",
+ "columnsFrom": ["child_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_fork_promote_run_created_by_user_id_fk": {
+ "name": "workspace_fork_promote_run_created_by_user_id_fk",
+ "tableFrom": "workspace_fork_promote_run",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_fork_resource_map": {
+ "name": "workspace_fork_resource_map",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "child_workspace_id": {
+ "name": "child_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "workspace_fork_resource_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_resource_id": {
+ "name": "parent_resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "child_resource_id": {
+ "name": "child_resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_fork_resource_map_child_type_parent_unique": {
+ "name": "workspace_fork_resource_map_child_type_parent_unique",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_fork_resource_map_child_workspace_id_workspace_id_fk": {
+ "name": "workspace_fork_resource_map_child_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_fork_resource_map",
+ "tableTo": "workspace",
+ "columnsFrom": ["child_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_fork_resource_map_created_by_user_id_fk": {
+ "name": "workspace_fork_resource_map_created_by_user_id_fk",
+ "tableFrom": "workspace_fork_resource_map",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_fork_workflow_sync": {
+ "name": "workspace_fork_workflow_sync",
+ "schema": "",
+ "columns": {
+ "deployment_operation_id": {
+ "name": "deployment_operation_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "child_workspace_id": {
+ "name": "child_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_workflow_id": {
+ "name": "source_workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_workflow_id": {
+ "name": "target_workflow_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_deployment_version_id": {
+ "name": "source_deployment_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "workspace_fork_workflow_sync_sequence_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "9223372036854775807",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "promote_run_id": {
+ "name": "promote_run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "activated_at": {
+ "name": "activated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rollback_operation_id": {
+ "name": "rollback_operation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rolled_back_at": {
+ "name": "rolled_back_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "workspace_fork_workflow_sync_baseline_idx": {
+ "name": "workspace_fork_workflow_sync_baseline_idx",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sequence",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_fork_workflow_sync\".\"activated_at\" IS NOT NULL AND \"workspace_fork_workflow_sync\".\"rolled_back_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_workflow_sync_run_idx": {
+ "name": "workspace_fork_workflow_sync_run_idx",
+ "columns": [
+ {
+ "expression": "promote_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_workflow_sync_rollback_idx": {
+ "name": "workspace_fork_workflow_sync_rollback_idx",
+ "columns": [
+ {
+ "expression": "rollback_operation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"workspace_fork_workflow_sync\".\"rollback_operation_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_workflow_sync_source_idx": {
+ "name": "workspace_fork_workflow_sync_source_idx",
+ "columns": [
+ {
+ "expression": "source_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_workflow_sync_target_idx": {
+ "name": "workspace_fork_workflow_sync_target_idx",
+ "columns": [
+ {
+ "expression": "target_workflow_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_fork_workflow_sync_child_workspace_idx": {
+ "name": "workspace_fork_workflow_sync_child_workspace_idx",
+ "columns": [
+ {
+ "expression": "child_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_fork_workflow_sync_child_workspace_id_workspace_id_fk": {
+ "name": "workspace_fork_workflow_sync_child_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_fork_workflow_sync",
+ "tableTo": "workspace",
+ "columnsFrom": ["child_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_fork_workflow_sync_source_workflow_id_workflow_id_fk": {
+ "name": "workspace_fork_workflow_sync_source_workflow_id_workflow_id_fk",
+ "tableFrom": "workspace_fork_workflow_sync",
+ "tableTo": "workflow",
+ "columnsFrom": ["source_workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_fork_workflow_sync_target_workflow_id_workflow_id_fk": {
+ "name": "workspace_fork_workflow_sync_target_workflow_id_workflow_id_fk",
+ "tableFrom": "workspace_fork_workflow_sync",
+ "tableTo": "workflow",
+ "columnsFrom": ["target_workflow_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_operation_receipt": {
+ "name": "workspace_operation_receipt",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_hash": {
+ "name": "request_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "report": {
+ "name": "report",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_operation_receipt_request_unique": {
+ "name": "workspace_operation_receipt_request_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_operation_receipt_workspace_created_idx": {
+ "name": "workspace_operation_receipt_workspace_created_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_operation_receipt_workspace_id_workspace_id_fk": {
+ "name": "workspace_operation_receipt_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_operation_receipt",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_resource_key": {
+ "name": "workspace_resource_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "workspace_resource_kind",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin": {
+ "name": "origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_resource_key_ws_kind_key_unique": {
+ "name": "workspace_resource_key_ws_kind_key_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_resource_key_ws_kind_resource_unique": {
+ "name": "workspace_resource_key_ws_kind_resource_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_resource_key_workspace_id_workspace_id_fk": {
+ "name": "workspace_resource_key_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_resource_key",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_resource_key_created_by_user_id_fk": {
+ "name": "workspace_resource_key_created_by_user_id_fk",
+ "tableFrom": "workspace_resource_key",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_resource_key_key_format": {
+ "name": "workspace_resource_key_key_format",
+ "value": "\"workspace_resource_key\".\"key\" ~ '^[a-z][a-z0-9_-]{0,63}$'"
+ },
+ "workspace_resource_key_origin_check": {
+ "name": "workspace_resource_key_origin_check",
+ "value": "\"workspace_resource_key\".\"origin\" IN ('allocated', 'adopted', 'created')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_sandbox": {
+ "name": "workspace_sandbox",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "language": {
+ "name": "language",
+ "type": "sandbox_language",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dependencies": {
+ "name": "dependencies",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "cli_tools": {
+ "name": "cli_tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "system_packages": {
+ "name": "system_packages",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "spec_hash": {
+ "name": "spec_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_sandbox_workspace_name_unique": {
+ "name": "workspace_sandbox_workspace_name_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_sandbox_spec_hash_idx": {
+ "name": "workspace_sandbox_spec_hash_idx",
+ "columns": [
+ {
+ "expression": "spec_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_sandbox_workspace_id_workspace_id_fk": {
+ "name": "workspace_sandbox_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_sandbox",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_sandbox_created_by_user_id_fk": {
+ "name": "workspace_sandbox_created_by_user_id_fk",
+ "tableFrom": "workspace_sandbox",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_source_apply_lease": {
+ "name": "workspace_source_apply_lease",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "acquired_at": {
+ "name": "acquired_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_source_apply_lease_workspace_id_workspace_id_fk": {
+ "name": "workspace_source_apply_lease_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_source_apply_lease",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_source_staged_blob": {
+ "name": "workspace_source_staged_blob",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sha256": {
+ "name": "sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_key": {
+ "name": "storage_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workspace_source_staged_blob_scope_hash_unique": {
+ "name": "workspace_source_staged_blob_scope_hash_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sha256",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_source_staged_blob_expires_at_idx": {
+ "name": "workspace_source_staged_blob_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_source_staged_blob_workspace_id_workspace_id_fk": {
+ "name": "workspace_source_staged_blob_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_source_staged_blob",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_visit": {
+ "name": "workspace_visit",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "visited_at": {
+ "name": "visited_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_visit_workspace_idx": {
+ "name": "workspace_visit_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_visit_user_id_user_id_fk": {
+ "name": "workspace_visit_user_id_user_id_fk",
+ "tableFrom": "workspace_visit",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_visit_workspace_id_workspace_id_fk": {
+ "name": "workspace_visit_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_visit",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "workspace_visit_user_id_workspace_id_pk": {
+ "name": "workspace_visit_user_id_workspace_id_pk",
+ "columns": ["user_id", "workspace_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.api_key_access": {
+ "name": "api_key_access",
+ "schema": "public",
+ "values": ["read", "write"]
+ },
+ "public.aws_marketplace_license_status": {
+ "name": "aws_marketplace_license_status",
+ "schema": "public",
+ "values": ["pending", "active", "inactive"]
+ },
+ "public.aws_marketplace_usage_report_status": {
+ "name": "aws_marketplace_usage_report_status",
+ "schema": "public",
+ "values": ["pending", "reported", "rejected"]
+ },
+ "public.background_work_kind": {
+ "name": "background_work_kind",
+ "schema": "public",
+ "values": ["deployment_side_effects", "fork_content_copy", "fork_sync", "fork_rollback"]
+ },
+ "public.background_work_status_value": {
+ "name": "background_work_status_value",
+ "schema": "public",
+ "values": ["pending", "processing", "completed", "completed_with_warnings", "failed"]
+ },
+ "public.billing_blocked_reason": {
+ "name": "billing_blocked_reason",
+ "schema": "public",
+ "values": ["payment_failed", "dispute"]
+ },
+ "public.billing_entity_type": {
+ "name": "billing_entity_type",
+ "schema": "public",
+ "values": ["user", "organization"]
+ },
+ "public.chat_type": {
+ "name": "chat_type",
+ "schema": "public",
+ "values": ["mothership", "copilot"]
+ },
+ "public.copilot_async_tool_status": {
+ "name": "copilot_async_tool_status",
+ "schema": "public",
+ "values": ["pending", "running", "completed", "failed", "cancelled", "delivered"]
+ },
+ "public.copilot_run_status": {
+ "name": "copilot_run_status",
+ "schema": "public",
+ "values": ["active", "paused_waiting_for_tool", "resuming", "complete", "error", "cancelled"]
+ },
+ "public.copilot_tool_permission_decision": {
+ "name": "copilot_tool_permission_decision",
+ "schema": "public",
+ "values": ["allow", "allow_chat", "always_allow", "skip"]
+ },
+ "public.credential_group_enrollment_status": {
+ "name": "credential_group_enrollment_status",
+ "schema": "public",
+ "values": ["invited", "delivery_failed", "in_progress", "completed", "revoked"]
+ },
+ "public.credential_group_status": {
+ "name": "credential_group_status",
+ "schema": "public",
+ "values": ["active", "disabled"]
+ },
+ "public.credential_member_role": {
+ "name": "credential_member_role",
+ "schema": "public",
+ "values": ["admin", "member"]
+ },
+ "public.credential_member_status": {
+ "name": "credential_member_status",
+ "schema": "public",
+ "values": ["active", "pending", "revoked"]
+ },
+ "public.credential_type": {
+ "name": "credential_type",
+ "schema": "public",
+ "values": [
+ "oauth",
+ "managed_oauth",
+ "managed_mcp",
+ "env_workspace",
+ "env_personal",
+ "service_account",
+ "personal_token"
+ ]
+ },
+ "public.data_drain_cadence": {
+ "name": "data_drain_cadence",
+ "schema": "public",
+ "values": ["hourly", "daily"]
+ },
+ "public.data_drain_destination": {
+ "name": "data_drain_destination",
+ "schema": "public",
+ "values": [
+ "s3",
+ "gcs",
+ "azure_blob",
+ "sentinel",
+ "datadog",
+ "bigquery",
+ "snowflake",
+ "webhook"
+ ]
+ },
+ "public.data_drain_run_status": {
+ "name": "data_drain_run_status",
+ "schema": "public",
+ "values": ["running", "success", "failed"]
+ },
+ "public.data_drain_run_trigger": {
+ "name": "data_drain_run_trigger",
+ "schema": "public",
+ "values": ["cron", "manual"]
+ },
+ "public.data_drain_source": {
+ "name": "data_drain_source",
+ "schema": "public",
+ "values": ["workflow_logs", "job_logs", "audit_logs", "copilot_chats", "copilot_runs"]
+ },
+ "public.execution_large_value_reference_source": {
+ "name": "execution_large_value_reference_source",
+ "schema": "public",
+ "values": ["execution_log", "paused_snapshot"]
+ },
+ "public.folder_resource_type": {
+ "name": "folder_resource_type",
+ "schema": "public",
+ "values": ["workflow", "file", "knowledge_base", "table"]
+ },
+ "public.invitation_kind": {
+ "name": "invitation_kind",
+ "schema": "public",
+ "values": ["organization", "workspace"]
+ },
+ "public.invitation_membership_intent": {
+ "name": "invitation_membership_intent",
+ "schema": "public",
+ "values": ["internal", "external"]
+ },
+ "public.invitation_status": {
+ "name": "invitation_status",
+ "schema": "public",
+ "values": ["pending", "accepted", "rejected", "cancelled", "expired"]
+ },
+ "public.managed_oauth_credential_status": {
+ "name": "managed_oauth_credential_status",
+ "schema": "public",
+ "values": ["active", "needs_reauth", "revoked"]
+ },
+ "public.permission_type": {
+ "name": "permission_type",
+ "schema": "public",
+ "values": ["admin", "write", "read"]
+ },
+ "public.sandbox_image_status": {
+ "name": "sandbox_image_status",
+ "schema": "public",
+ "values": ["pending", "building", "ready", "failed"]
+ },
+ "public.sandbox_language": {
+ "name": "sandbox_language",
+ "schema": "public",
+ "values": ["javascript", "python"]
+ },
+ "public.secret_usage_scope": {
+ "name": "secret_usage_scope",
+ "schema": "public",
+ "values": ["workspace", "personal"]
+ },
+ "public.secret_usage_source": {
+ "name": "secret_usage_source",
+ "schema": "public",
+ "values": ["workflow", "copilot", "mcp"]
+ },
+ "public.upload_session_method": {
+ "name": "upload_session_method",
+ "schema": "public",
+ "values": ["put", "multipart"]
+ },
+ "public.upload_session_provider": {
+ "name": "upload_session_provider",
+ "schema": "public",
+ "values": ["local", "s3", "blob", "gcs"]
+ },
+ "public.upload_session_purpose": {
+ "name": "upload_session_purpose",
+ "schema": "public",
+ "values": [
+ "workspace_file",
+ "project_file",
+ "table_import",
+ "knowledge_import",
+ "knowledge_document",
+ "profile_picture",
+ "workspace_logo",
+ "organization_logo",
+ "mothership_attachment",
+ "execution_attachment"
+ ]
+ },
+ "public.upload_session_status": {
+ "name": "upload_session_status",
+ "schema": "public",
+ "values": [
+ "uploading",
+ "completing",
+ "finalizing",
+ "completed",
+ "aborting",
+ "aborted",
+ "failed",
+ "expired"
+ ]
+ },
+ "public.usage_log_category": {
+ "name": "usage_log_category",
+ "schema": "public",
+ "values": ["model", "fixed", "tool", "model_unbilled"]
+ },
+ "public.usage_log_source": {
+ "name": "usage_log_source",
+ "schema": "public",
+ "values": [
+ "workflow",
+ "wand",
+ "copilot",
+ "workspace-chat",
+ "mcp_copilot",
+ "mothership_block",
+ "knowledge-base",
+ "voice-input",
+ "enrichment",
+ "voice-output",
+ "api-tool",
+ "workflow-test"
+ ]
+ },
+ "public.workspace_file_search_index_status": {
+ "name": "workspace_file_search_index_status",
+ "schema": "public",
+ "values": ["pending", "ready", "skipped", "failed"]
+ },
+ "public.workspace_file_version_source": {
+ "name": "workspace_file_version_source",
+ "schema": "public",
+ "values": ["upload", "user", "api", "copilot", "workflow", "collab", "revert", "unknown"]
+ },
+ "public.workspace_fork_promote_direction": {
+ "name": "workspace_fork_promote_direction",
+ "schema": "public",
+ "values": ["push", "pull"]
+ },
+ "public.workspace_fork_resource_type": {
+ "name": "workspace_fork_resource_type",
+ "schema": "public",
+ "values": [
+ "workflow",
+ "oauth_credential",
+ "service_account_credential",
+ "env_var",
+ "table",
+ "knowledge_base",
+ "knowledge_document",
+ "file",
+ "file_folder",
+ "mcp_server",
+ "workflow_mcp_server",
+ "custom_block",
+ "custom_tool",
+ "skill",
+ "sandbox"
+ ]
+ },
+ "public.workspace_mode": {
+ "name": "workspace_mode",
+ "schema": "public",
+ "values": ["personal", "organization", "grandfathered_shared"]
+ },
+ "public.workspace_resource_kind": {
+ "name": "workspace_resource_kind",
+ "schema": "public",
+ "values": [
+ "credential",
+ "knowledge-base",
+ "knowledge-document",
+ "table",
+ "file",
+ "file-folder",
+ "mcp-server",
+ "custom-tool",
+ "custom-block",
+ "skill",
+ "sandbox",
+ "workflow"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {
+ "public.copilot_async_tool_calls_persist_seq": {
+ "name": "copilot_async_tool_calls_persist_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "9223372036854775807",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json
index a7db62ed789..ade4f1cf5cd 100644
--- a/packages/db/migrations/meta/_journal.json
+++ b/packages/db/migrations/meta/_journal.json
@@ -3270,6 +3270,13 @@
"when": 1795151802047,
"tag": "0467_workflow_edges_block_fk_indexes",
"breakpoints": true
+ },
+ {
+ "idx": 468,
+ "version": "7",
+ "when": 1795223641227,
+ "tag": "0468_retire_legacy_search_and_contracts",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index b36ab1d045b..9c2a878fe7b 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -585,15 +585,6 @@ export const workflowSubflows = pgTable(
})
)
-export const waitlist = pgTable('waitlist', {
- id: text('id').primaryKey(),
- email: text('email').notNull().unique(),
- /** pending, approved, rejected */
- status: text('status').notNull().default('pending'),
- createdAt: timestamp('created_at').notNull().defaultNow(),
- updatedAt: timestamp('updated_at').notNull().defaultNow(),
-})
-
export const workflowExecutionSnapshots = pgTable(
'workflow_execution_snapshots',
{
@@ -1300,7 +1291,6 @@ export const organizationBYOKKeys = pgTable(
})
)
-// contract-pending(after the release that stops declaring them is deployed): drop settings.show_training_controls and settings.copilot_enabled_models — nothing has read or written either since v0.7.56; safe once no deployed release declares them.
export const settings = pgTable('settings', {
/** Use the user id as the key */
id: text('id').primaryKey(),
@@ -2036,6 +2026,7 @@ export interface SessionPolicySettings {
idleTimeoutHours?: number | null
}
+// contract-pending(after the release that stops declaring it is deployed): drop organization.whitelabel_settings — whitelabeling was removed and no code reads or writes it after this release; earlier releases still select it explicitly, so dropping it now would break them mid-rollout
export const organization = pgTable('organization', {
id: text('id').primaryKey(),
name: text('name').notNull(),
@@ -2058,19 +2049,6 @@ export const organization = pgTable('organization', {
* keep password sign-in as a break-glass path for a broken identity provider.
*/
requireSso: boolean('require_sso').notNull().default(false),
- whitelabelSettings: json('whitelabel_settings').$type<{
- brandName?: string
- logoUrl?: string
- primaryColor?: string
- primaryHoverColor?: string
- accentColor?: string
- accentHoverColor?: string
- supportEmail?: string
- documentationUrl?: string
- termsUrl?: string
- privacyUrl?: string
- hidePoweredBySim?: boolean
- }>(),
dataRetentionSettings: json('data_retention_settings').$type(),
orgUsageLimit: decimal('org_usage_limit'),
/**
@@ -3470,7 +3448,7 @@ export const workspaceFiles = pgTable(
* tokens, realtime versions — all of which truncate to milliseconds, while `now()` stores
* microseconds. A sub-millisecond value therefore stops comparing equal to its own round-trip, and
* every SQL equality keyed on it matches zero rows: a file whose
- * `workspace_file_search_index.source_content_updated_at` came from such a round trip can never be
+ * `workspace_file_search_revision.source_content_updated_at` came from such a round trip can never be
* claimed, indexed, or cleaned up. The default truncates, and the
* `workspace_files_content_version_millisecond` trigger enforces it for the writers a default cannot
* reach — explicit `CURRENT_TIMESTAMP` expressions, raw SQL inserts, and updates that change row
@@ -3644,76 +3622,7 @@ export const workspaceFileSearchIndexStatusEnum = pgEnum('workspace_file_search_
'failed',
])
-/** contract-pending(chunk search fully deployed): retire legacy index state and segments after rollback window. */
-export const workspaceFileSearchIndex = pgTable(
- 'workspace_file_search_index',
- {
- fileId: text('file_id').notNull(),
- workspaceId: text('workspace_id').notNull(),
- sourceContentUpdatedAt: timestamp('source_content_updated_at').notNull(),
- status: workspaceFileSearchIndexStatusEnum('status').notNull().default('pending'),
- partial: boolean('partial').notNull().default(false),
- failureReason: text('failure_reason'),
- lineCount: integer('line_count').notNull().default(0),
- indexedBytes: integer('indexed_bytes').notNull().default(0),
- dispatchedAt: timestamp('dispatched_at'),
- createdAt: timestamp('created_at').notNull().defaultNow(),
- updatedAt: timestamp('updated_at').notNull().defaultNow(),
- },
- (table) => ({
- pk: primaryKey({
- name: 'workspace_file_search_index_pk',
- columns: [table.fileId, table.sourceContentUpdatedAt],
- }),
- fileFk: foreignKey({
- name: 'workspace_file_search_index_file_fk',
- columns: [table.fileId],
- foreignColumns: [workspaceFiles.id],
- }).onDelete('cascade'),
- workspaceFk: foreignKey({
- name: 'workspace_file_search_index_workspace_fk',
- columns: [table.workspaceId],
- foreignColumns: [workspace.id],
- }).onDelete('cascade'),
- workspaceStatusIdx: index('workspace_file_search_index_workspace_status_idx').on(
- table.workspaceId,
- table.status,
- table.sourceContentUpdatedAt
- ),
- pendingDispatchIdx: index('workspace_file_search_index_pending_dispatch_idx')
- .on(table.workspaceId, table.updatedAt, table.fileId, table.sourceContentUpdatedAt)
- .where(sql`${table.status} = 'pending' AND ${table.dispatchedAt} IS NULL`),
- activeDispatchIdx: index('workspace_file_search_index_active_dispatch_idx')
- .on(table.workspaceId, table.dispatchedAt)
- .where(sql`${table.status} = 'pending' AND ${table.dispatchedAt} IS NOT NULL`),
- })
-)
-
-// contract-pending(after owner-aware search workers are fully deployed): retire this queue and dual enqueue after old dispatchers and retries drain.
-/** @deprecated Compatibility scheduling for previously deployed workspace workers. */
-export const workspaceFileSearchDispatchQueue = pgTable(
- 'workspace_file_search_dispatch_queue',
- {
- workspaceId: text('workspace_id').primaryKey(),
- enqueuedAt: timestamp('enqueued_at').notNull().defaultNow(),
- lastDispatchedAt: timestamp('last_dispatched_at'),
- updatedAt: timestamp('updated_at').notNull().defaultNow(),
- },
- (table) => ({
- workspaceFk: foreignKey({
- name: 'workspace_file_search_queue_workspace_fk',
- columns: [table.workspaceId],
- foreignColumns: [workspace.id],
- }).onDelete('cascade'),
- scheduleIdx: index('workspace_file_search_dispatch_queue_schedule_idx').on(
- table.lastDispatchedAt.asc().nullsFirst(),
- table.enqueuedAt,
- table.workspaceId
- ),
- })
-)
-
-/** Owner-neutral dispatch replaces the workspace-only queue after older workers drain. */
+/** Owner-neutral file search dispatch queue. */
export const fileSearchDispatchQueue = pgTable(
'file_search_dispatch_queue',
{
@@ -3749,47 +3658,6 @@ export const workspaceFileSearchBackfill = pgTable('workspace_file_search_backfi
updatedAt: timestamp('updated_at').notNull().defaultNow(),
})
-/** Bounded, overlapping logical-line segments searched through PostgreSQL trigram indexes. */
-export const workspaceFileSearchSegment = pgTable(
- 'workspace_file_search_segment',
- {
- fileId: text('file_id').notNull(),
- workspaceId: text('workspace_id').notNull(),
- sourceContentUpdatedAt: timestamp('source_content_updated_at').notNull(),
- lineNumber: integer('line_number').notNull(),
- segmentNumber: integer('segment_number').notNull(),
- segmentStart: integer('segment_start').notNull(),
- lineLength: integer('line_length').notNull(),
- content: text('content').notNull(),
- },
- (table) => ({
- pk: primaryKey({
- name: 'workspace_file_search_segment_pk',
- columns: [table.fileId, table.sourceContentUpdatedAt, table.lineNumber, table.segmentNumber],
- }),
- fileFk: foreignKey({
- name: 'workspace_file_search_segment_file_fk',
- columns: [table.fileId],
- foreignColumns: [workspaceFiles.id],
- }).onDelete('cascade'),
- workspaceFk: foreignKey({
- name: 'workspace_file_search_segment_workspace_fk',
- columns: [table.workspaceId],
- foreignColumns: [workspace.id],
- }).onDelete('cascade'),
- workspaceRevisionIdx: index('workspace_file_search_segment_workspace_revision_idx').on(
- table.workspaceId,
- table.fileId,
- table.sourceContentUpdatedAt
- ),
- contentTrigramIdx: index('workspace_file_search_segment_workspace_content_trgm_idx').using(
- 'gin',
- table.workspaceId.asc().op('text_ops'),
- table.content.asc().op('gin_trgm_ops')
- ),
- })
-)
-
/** Builds outlive file deletion so their text can be reclaimed in bounded background batches. */
export const workspaceFileSearchBuild = pgTable(
'workspace_file_search_build',
@@ -3806,7 +3674,6 @@ export const workspaceFileSearchBuild = pgTable(
expiresAt: timestamp('expires_at'),
},
(table) => ({
- /** contract-pending(after owner-aware search workers are fully deployed): validate file_search_build_owner_check separately — 0426 added it NOT VALID so rollout avoids a workspace_file_search_build scan. */
ownerCheck: check(
'file_search_build_owner_check',
sql`(${table.entityType} IS NULL AND ${table.entityId} IS NULL AND ${table.workspaceId} IS NOT NULL) OR (${table.entityType} = 'workspace' AND ${table.entityId} = ${table.workspaceId}) OR (${table.entityType} = 'project' AND length(${table.entityId}) > 0 AND ${table.workspaceId} IS NULL)`
@@ -3849,7 +3716,6 @@ export const workspaceFileSearchRevision = pgTable(
updatedAt: timestamp('updated_at').notNull().defaultNow(),
},
(table) => ({
- /** contract-pending(after owner-aware search workers are fully deployed): validate file_search_revision_owner_check separately — 0426 added it NOT VALID so rollout avoids a workspace_file_search_revision scan. */
ownerCheck: check(
'file_search_revision_owner_check',
sql`(${table.entityType} IS NULL AND ${table.entityId} IS NULL AND ${table.workspaceId} IS NOT NULL) OR (${table.entityType} = 'workspace' AND ${table.entityId} = ${table.workspaceId}) OR (${table.entityType} = 'project' AND length(${table.entityId}) > 0 AND ${table.workspaceId} IS NULL)`
@@ -3903,7 +3769,6 @@ export const workspaceFileSearchChunk = pgTable(
content: text('content').notNull(),
},
(table) => ({
- /** contract-pending(after owner-aware search workers are fully deployed): validate file_search_chunk_owner_check separately — 0426 added it NOT VALID so rollout avoids a workspace_file_search_chunk scan. */
ownerCheck: check(
'file_search_chunk_owner_check',
sql`(${table.entityType} IS NULL AND ${table.entityId} IS NULL AND ${table.workspaceId} IS NOT NULL) OR (${table.entityType} = 'workspace' AND ${table.entityId} = ${table.workspaceId}) OR (${table.entityType} = 'project' AND length(${table.entityId}) > 0 AND ${table.workspaceId} IS NULL)`
@@ -4228,7 +4093,6 @@ export const publicShare = pgTable(
updatedAt: timestamp('updated_at').notNull().defaultNow(),
},
(table) => ({
- /** contract-pending(after 0034_backfill_public_share_entities has run in every environment): validate public_share_entity_binding_check separately — 0425 added it NOT VALID so rollout avoids a public_share scan. */
entityBinding: check(
'public_share_entity_binding_check',
sql`
@@ -5318,7 +5182,6 @@ export const mothershipMemorySelections = pgTable(
})
)
-// contract-pending(after the release that stops declaring plan_artifact is deployed): drop copilot_chats.plan_artifact — the plan artifact moved into the message transcript; safe once no deployed release declares the column.
export const copilotChats = pgTable(
'copilot_chats',
{
@@ -5409,7 +5272,6 @@ export const mothershipResourceEffects = pgTable(
(table) => ({ pk: primaryKey({ columns: [table.chatId, table.effectId] }) })
)
-// contract-pending(after the release that stops declaring them is deployed): drop copilot_messages.parent_message_id, tokens_in, and tokens_out — no code has read or written them since they were added; safe once no deployed release declares them.
export const copilotMessages = pgTable(
'copilot_messages',
{
@@ -6347,7 +6209,6 @@ export const oauthRefreshToken = pgTable(
'oauth_refresh_token_generation_check',
sql`${table.generation} BETWEEN 0 AND 1000`
),
- /** contract-pending(after #7613 is fully deployed): validate oauth_refresh_token_search_resource_check separately so rollout avoids a token-table scan. */
searchResourceCheck: check(
'oauth_refresh_token_search_resource_check',
sql`NOT ('search:read' = ANY(${table.scopes})) OR ${table.resource} IS NOT NULL`
@@ -6382,7 +6243,6 @@ export const oauthAccessToken = pgTable(
userClientIdx: index('oauth_access_token_user_client_idx').on(table.userId, table.clientId),
/** Drives the cleanup pass; nothing else reads tokens by expiry. */
expiresAtIdx: index('oauth_access_token_expires_at_idx').on(table.expiresAt),
- /** contract-pending(after #7613 is fully deployed): validate oauth_access_token_search_resource_check separately so rollout avoids a token-table scan. */
searchResourceCheck: check(
'oauth_access_token_search_resource_check',
sql`NOT ('search:read' = ANY(${table.scopes})) OR ${table.resource} IS NOT NULL`
@@ -6815,7 +6675,6 @@ export interface ManagedMcpToolSnapshot {
outputSchema?: Record
}
-/** contract-pending(after all GitLab tokens migrate and workspace-token writers are retired): drop credential_personal_token_identity_unique; only the index is retired. */
export const credential = pgTable(
'credential',
{
@@ -6928,15 +6787,6 @@ export const credential = pgTable(
workspacePersonalEnvUnique: uniqueIndex('credential_workspace_personal_env_unique')
.on(table.workspaceId, table.type, table.envKey, table.envOwnerUserId)
.where(sql`type = 'env_personal'`),
- personalTokenIdentityUnique: uniqueIndex('credential_personal_token_identity_unique')
- .on(
- table.workspaceId,
- table.createdBy,
- table.providerId,
- table.providerTenantId,
- table.providerSubjectId
- )
- .where(sql`type = 'personal_token'`),
personalTokenSourceConstraint: check(
'credential_personal_token_source_check',
sql`(type::text <> 'personal_token') OR (
diff --git a/packages/db/script-migrations/0018_repair_workspace_file_content_revision.integration.ts b/packages/db/script-migrations/0018_repair_workspace_file_content_revision.integration.ts
index bd3d98e690d..00b8b7d7996 100644
--- a/packages/db/script-migrations/0018_repair_workspace_file_content_revision.integration.ts
+++ b/packages/db/script-migrations/0018_repair_workspace_file_content_revision.integration.ts
@@ -39,39 +39,33 @@ describe('workspace file content revision repair in PostgreSQL', () => {
connection: { search_path: schemaName, TimeZone: 'UTC' },
})
await sql`CREATE TABLE workspace_files (
- id text PRIMARY KEY, workspace_id text, context text NOT NULL, deleted_at timestamp,
- content_updated_at timestamp NOT NULL DEFAULT now(), secret_provenance_version integer
+ id text PRIMARY KEY, workspace_id text, project_id text, context text NOT NULL,
+ deleted_at timestamp, content_updated_at timestamp NOT NULL DEFAULT now(),
+ secret_provenance_version integer
)`
await sql`CREATE TABLE workspace_file_secret_provenance (
file_id text PRIMARY KEY REFERENCES workspace_files(id) ON DELETE CASCADE,
content_updated_at timestamp NOT NULL, status text NOT NULL,
entries jsonb NOT NULL DEFAULT '[]', updated_at timestamp NOT NULL DEFAULT now()
)`
- await sql`CREATE TABLE workspace_file_search_index (
- file_id text NOT NULL, workspace_id text NOT NULL, source_content_updated_at timestamp NOT NULL,
- status text NOT NULL DEFAULT 'pending', partial boolean NOT NULL DEFAULT false,
- failure_reason text, line_count integer NOT NULL DEFAULT 0,
- indexed_bytes integer NOT NULL DEFAULT 0, dispatched_at timestamp,
- created_at timestamp NOT NULL DEFAULT now(), updated_at timestamp NOT NULL DEFAULT now(),
- PRIMARY KEY (file_id, source_content_updated_at)
+ await sql`CREATE TABLE workspace_file_search_build (id text PRIMARY KEY, expires_at timestamp)`
+ await sql`CREATE TABLE workspace_file_search_revision (
+ file_id text PRIMARY KEY, workspace_id text, entity_type text, entity_id text,
+ source_content_updated_at timestamp NOT NULL, build_id text
)`
- await sql`CREATE TABLE workspace_file_search_segment (
- file_id text NOT NULL, workspace_id text NOT NULL, source_content_updated_at timestamp NOT NULL,
- line_number integer NOT NULL, segment_number integer NOT NULL, content text NOT NULL,
- line_length integer NOT NULL DEFAULT 0, segment_start integer NOT NULL DEFAULT 0,
- PRIMARY KEY (file_id, source_content_updated_at, line_number, segment_number)
- )`
- await sql`CREATE TABLE workspace_file_search_dispatch_queue (
- workspace_id text PRIMARY KEY, enqueued_at timestamp NOT NULL DEFAULT now(),
- updated_at timestamp NOT NULL DEFAULT now(), last_dispatched_at timestamp
+ await sql`CREATE TABLE file_search_dispatch_queue (
+ entity_type text NOT NULL, entity_id text NOT NULL,
+ updated_at timestamp NOT NULL DEFAULT now(), PRIMARY KEY (entity_type, entity_id)
)`
+ await applyMigration(sql, '0468_retire_legacy_search_and_contracts.sql', (statement) =>
+ statement.includes('CREATE OR REPLACE FUNCTION workspace_file_search_mark_pending()')
+ )
await applyMigration(
sql,
'0313_puzzling_zodiak.sql',
(statement) =>
- statement.includes('workspace_file_search_mark_pending') &&
- (statement.startsWith('CREATE OR REPLACE FUNCTION') ||
- statement.startsWith('CREATE TRIGGER'))
+ statement.startsWith('CREATE TRIGGER') &&
+ statement.includes('workspace_file_search_mark_pending')
)
await applyMigration(
sql,
@@ -95,8 +89,7 @@ describe('workspace file content revision repair in PostgreSQL', () => {
beforeEach(async () => {
await sql`TRUNCATE workspace_files, workspace_file_secret_provenance,
- workspace_file_search_index, workspace_file_search_segment,
- workspace_file_search_dispatch_queue`
+ workspace_file_search_build, workspace_file_search_revision, file_search_dispatch_queue`
})
afterAll(async () => {
@@ -135,13 +128,6 @@ describe('workspace file content revision repair in PostgreSQL', () => {
VALUES ('${fileId}', TIMESTAMP '${revision}', 'exact')`)
}
- async function seedIndexRow(fileId: string, revision: string, dispatched: boolean) {
- await sql.unsafe(`INSERT INTO workspace_file_search_index
- (file_id, workspace_id, source_content_updated_at, status, dispatched_at)
- VALUES ('${fileId}', 'legacy-workspace', TIMESTAMP '${revision}', 'pending',
- ${dispatched ? 'now()' : 'NULL'})`)
- }
-
async function revisionOf(fileId: string): Promise {
const [row] = await sql<{ revision: string }[]>`SELECT content_updated_at::text AS revision
FROM workspace_files WHERE id = ${fileId}`
@@ -161,23 +147,6 @@ describe('workspace file content revision repair in PostgreSQL', () => {
expect(await revisionOf('knowledge')).toBe(MICROSECOND_REVISION)
})
- it('retains obsolete text for the contract migration after chunk search is installed', async () => {
- await sql`CREATE TABLE workspace_file_search_revision (file_id text PRIMARY KEY)`
- try {
- await seedLegacyFile({ id: 'retired', context: 'workspace' })
- await seedIndexRow('retired', MICROSECOND_REVISION, true)
- await sql.unsafe(`INSERT INTO workspace_file_search_segment
- (file_id, workspace_id, source_content_updated_at, line_number, segment_number, content)
- VALUES ('retired', 'legacy-workspace', TIMESTAMP '${MICROSECOND_REVISION}', 1, 1, 'old text')`)
- expect(await repairWorkspaceFileContentRevisions(sql)).toBe(1)
- expect(await revisionOf('retired')).toBe(MILLISECOND_REVISION)
- const [row] = await sql`SELECT count(*)::int AS count FROM workspace_file_search_segment`
- expect(row.count).toBe(1)
- } finally {
- await sql`DROP TABLE workspace_file_search_revision`
- }
- })
-
it('keeps a tracked provenance version and realigns its sidecar', async () => {
await seedLegacyFile({ id: 'tracked', context: 'workspace', provenance: 1 })
await seedSidecar('tracked', MILLISECOND_REVISION)
@@ -193,28 +162,6 @@ describe('workspace file content revision repair in PostgreSQL', () => {
expect(row).toEqual({ version: 1, sidecarMatches: true })
})
- it('leaves the search index holding exactly the revision the file now records', async () => {
- await seedLegacyFile({ id: 'stranded', context: 'workspace' })
- await seedIndexRow('stranded', MILLISECOND_REVISION, false)
- await seedIndexRow('stranded', MICROSECOND_REVISION, true)
- await sql.unsafe(`INSERT INTO workspace_file_search_segment
- (file_id, workspace_id, source_content_updated_at, line_number, segment_number, content)
- VALUES ('stranded', 'legacy-workspace', TIMESTAMP '${MICROSECOND_REVISION}', 1, 1, 'orphaned')`)
-
- await repairWorkspaceFileContentRevisions(sql)
-
- const rows = await sql<{ revision: string; matchesFile: boolean }[]>`
- SELECT search_index.source_content_updated_at::text AS revision,
- (search_index.source_content_updated_at = file.content_updated_at) AS "matchesFile"
- FROM workspace_file_search_index AS search_index
- JOIN workspace_files AS file ON file.id = search_index.file_id
- WHERE search_index.file_id = 'stranded'`
- expect([...rows]).toEqual([{ revision: MILLISECOND_REVISION, matchesFile: true }])
- const [segments] = await sql<{ remaining: number }[]>`SELECT count(*)::int AS remaining
- FROM workspace_file_search_segment WHERE file_id = 'stranded'`
- expect(segments.remaining).toBe(0)
- })
-
it('is a no-op on replay', async () => {
await seedLegacyFile({ id: 'replayed', context: 'workspace', provenance: 1 })
await seedSidecar('replayed', MILLISECOND_REVISION)
@@ -306,9 +253,9 @@ describe('workspace file content revision repair in PostgreSQL', () => {
expect(await revisionOf('promoted')).toBe(MILLISECOND_REVISION)
const [row] = await sql<{ version: number; indexed: string | null }[]>`
SELECT file.secret_provenance_version AS version,
- (SELECT search_index.source_content_updated_at::text
- FROM workspace_file_search_index AS search_index
- WHERE search_index.file_id = file.id) AS indexed
+ (SELECT revision.source_content_updated_at::text
+ FROM workspace_file_search_revision AS revision
+ WHERE revision.file_id = file.id) AS indexed
FROM workspace_files AS file WHERE file.id = 'promoted'`
expect(row.indexed).toBe(MILLISECOND_REVISION)
expect(row.version).toBe(1)
diff --git a/packages/db/script-migrations/0018_repair_workspace_file_content_revision.ts b/packages/db/script-migrations/0018_repair_workspace_file_content_revision.ts
index 332a5762ee2..c13885e8b0a 100644
--- a/packages/db/script-migrations/0018_repair_workspace_file_content_revision.ts
+++ b/packages/db/script-migrations/0018_repair_workspace_file_content_revision.ts
@@ -36,8 +36,7 @@ interface RepairPage {
async function repairContentRevisionPage(
sql: Sql,
batchSize: number,
- afterFileId: string,
- retireLegacyRows: boolean
+ afterFileId: string
): Promise {
const candidates = await sql<{ fileId: string }[]>`
SELECT id AS "fileId"
@@ -95,27 +94,6 @@ async function repairContentRevisionPage(
AND file.secret_provenance_version IS DISTINCT FROM restored.version
`
}
-
- /** Chunk search retains the old tables for a later DROP; never bulk-delete that retired text here. */
- if (retireLegacyRows) {
- await tx`
- DELETE FROM workspace_file_search_segment AS segment
- USING workspace_files AS file
- WHERE segment.file_id = file.id
- AND segment.file_id = ANY(${rewrittenIds}::text[])
- AND segment.source_content_updated_at <> file.content_updated_at
- AND date_trunc('milliseconds', segment.source_content_updated_at) = file.content_updated_at
- `
- await tx`
- DELETE FROM workspace_file_search_index AS search_index
- USING workspace_files AS file
- WHERE search_index.file_id = file.id
- AND search_index.file_id = ANY(${rewrittenIds}::text[])
- AND search_index.source_content_updated_at <> file.content_updated_at
- AND date_trunc('milliseconds', search_index.source_content_updated_at) =
- file.content_updated_at
- `
- }
return rewritten.length
})
@@ -126,18 +104,10 @@ export async function repairWorkspaceFileContentRevisions(
sql: Sql,
batchSize: number = CONTENT_REVISION_REPAIR_BATCH_SIZE
): Promise {
- const [index] = await sql<{ chunkSearchInstalled: boolean }[]>`
- SELECT to_regclass('workspace_file_search_revision') IS NOT NULL AS "chunkSearchInstalled"
- `
let afterFileId = ''
let repaired = 0
for (;;) {
- const page = await repairContentRevisionPage(
- sql,
- batchSize,
- afterFileId,
- !index.chunkSearchInstalled
- )
+ const page = await repairContentRevisionPage(sql, batchSize, afterFileId)
if (page.scanned === 0 || page.lastFileId === null) return repaired
repaired += page.repaired
afterFileId = page.lastFileId
diff --git a/packages/db/scripts/reconcile-file-ownership.ts b/packages/db/scripts/reconcile-file-ownership.ts
index fa3651027c5..b32ee1dad30 100644
--- a/packages/db/scripts/reconcile-file-ownership.ts
+++ b/packages/db/scripts/reconcile-file-ownership.ts
@@ -16,6 +16,7 @@ const migrations = [
'0425_public_share_entity_ownership.sql',
'0426_file_search_owner_scope.sql',
'0428_file_search_dependency_owner.sql',
+ '0468_retire_legacy_search_and_contracts.sql',
]
/** Backfills run after the DDL transaction commits, as in the migrations, so they never hold its table locks. */
diff --git a/packages/emcn/package.json b/packages/emcn/package.json
index 41c361d270e..d221bba0e6b 100644
--- a/packages/emcn/package.json
+++ b/packages/emcn/package.json
@@ -62,7 +62,6 @@
"@radix-ui/react-slider": "^1.6.1",
"@radix-ui/react-slot": "^1.2.2",
"@radix-ui/react-switch": "^1.4.1",
- "@radix-ui/react-tabs": "^1.2.1",
"@tanstack/react-virtual": "^3.13.24",
"class-variance-authority": "^0.7.1",
"framer-motion": "^12.5.0",
@@ -84,7 +83,6 @@
"@radix-ui/react-slider": "1.6.1",
"@radix-ui/react-slot": "1.5.0",
"@radix-ui/react-switch": "1.4.1",
- "@radix-ui/react-tabs": "1.2.1",
"@sim/tsconfig": "workspace:*",
"@tanstack/react-virtual": "3.14.26",
"@types/prismjs": "^1.26.5",
diff --git a/packages/emcn/src/components/chip-modal/chip-modal.tsx b/packages/emcn/src/components/chip-modal/chip-modal.tsx
index 09222492316..5b16793bbb1 100644
--- a/packages/emcn/src/components/chip-modal/chip-modal.tsx
+++ b/packages/emcn/src/components/chip-modal/chip-modal.tsx
@@ -3,8 +3,8 @@
*
* `ChipModal` owns the panel chrome (outer ring, inner surface, header
* separator, footer separator + tinted footer bar) and the underlying Radix
- * dialog lifecycle. Composition mirrors `Modal` / `ModalHeader` / `ModalBody`
- * / `ModalFooter` — drop your controls in as children.
+ * dialog lifecycle. Compose `ChipModalHeader` / `ChipModalBody` /
+ * `ChipModalFooter` inside it and drop your controls in as children.
*
* Body items are declared via the polymorphic `ChipModalField`. Each field
* picks a `type` (`'input'`, `'email'`, `'textarea'`, `'dropdown'`, `'copy'`,
diff --git a/packages/emcn/src/components/index.ts b/packages/emcn/src/components/index.ts
index 6269c1faeb9..7f0b4135ff2 100644
--- a/packages/emcn/src/components/index.ts
+++ b/packages/emcn/src/components/index.ts
@@ -117,16 +117,9 @@ export { Label } from './label/label'
export { Lightbox } from './lightbox/lightbox'
export {
Modal,
- ModalBody,
ModalClose,
ModalContent,
ModalDescription,
- ModalFooter,
- ModalHeader,
- ModalTabs,
- ModalTabsContent,
- ModalTabsList,
- ModalTabsTrigger,
ModalTitle,
ModalTrigger,
NATIVE_SURFACE_OCCLUSION_PREPARE_EVENT,
@@ -144,13 +137,11 @@ export { POPOVER_ANIMATION_CLASSES } from './popover/animation'
export {
Popover,
PopoverAnchor,
- PopoverBackButton,
PopoverContent,
PopoverDivider,
PopoverFolder,
PopoverItem,
PopoverScrollArea,
- PopoverSearch,
PopoverSection,
PopoverTrigger,
usePopoverContext,
@@ -182,14 +173,12 @@ export {
export {
Table,
TableBody,
- TableCaption,
TableCell,
- TableFooter,
TableHead,
TableHeader,
TableRow,
} from './table/table'
-export { TagInput, type TagItem } from './tag-input/tag-input'
+export { TagInput } from './tag-input/tag-input'
export { Textarea } from './textarea/textarea'
export { TimePicker } from './time-picker/time-picker'
export { ToastProvider, toast, useToast } from './toast/toast'
diff --git a/packages/emcn/src/components/modal/auto-focus.ts b/packages/emcn/src/components/modal/auto-focus.ts
index 6a1da9a978f..adf7fbdc99c 100644
--- a/packages/emcn/src/components/modal/auto-focus.ts
+++ b/packages/emcn/src/components/modal/auto-focus.ts
@@ -2,7 +2,7 @@
* Default `onOpenAutoFocus` handler for emcn modals.
*
* Radix's native behavior focuses the first focusable descendant — usually the close
- * button in `ModalHeader`. We instead focus the first visible text-entry control
+ * button in the modal header. We instead focus the first visible text-entry control
* (input/textarea/contenteditable) inside the dialog, with the caret at the end.
*
* If no such control exists, we let Radix's default behavior run by not calling
diff --git a/packages/emcn/src/components/modal/modal.tsx b/packages/emcn/src/components/modal/modal.tsx
index fe45d90dbf7..6d90ce16c0b 100644
--- a/packages/emcn/src/components/modal/modal.tsx
+++ b/packages/emcn/src/components/modal/modal.tsx
@@ -1,34 +1,15 @@
/**
- * Compositional modal component with optional tabs.
- * Uses Radix UI Dialog and Tabs primitives for accessibility.
- * For sidebar modals, use `sidebar-modal.tsx` instead.
+ * Compositional modal component built on the Radix UI Dialog primitive.
+ * For sidebar modals, use `sidebar-modal.tsx` instead; for the standard header,
+ * body, and footer chrome, compose `ChipModal` parts inside `ModalContent`.
*
* @example
* ```tsx
- * // Base modal
*
* Open
*
- * Title
- * Content here
- *
- * Save
- *
- *
- *
- *
- * // Modal with tabs
- *
- *
- * Title
- *
- *
- * Tab 1
- * Tab 2
- *
- * Content 1
- * Content 2
- *
+ * Title
+ * Content here
*
*
* ```
@@ -38,11 +19,8 @@
import * as React from 'react'
import * as DialogPrimitive from '@radix-ui/react-dialog'
-import * as TabsPrimitive from '@radix-ui/react-tabs'
import { usePathname } from 'next/navigation'
-import { X } from '../../icons'
import { cn } from '../../lib/cn'
-import { Button } from '../button/button'
import { focusFirstTextInput, focusFirstTextInputIn } from './auto-focus'
/** Portal geometry follows the visible mobile viewport while the keyboard is open. */
@@ -489,20 +467,20 @@ interface ModalContentProps extends React.ComponentPropsWithoutRef>(
- ({ className, children, ...props }, ref) => {
- const dismissDisabled = useModalDismissDisabled()
- return (
-
-
- {children}
-
-
-
-
- Close
-
-
-
- )
- }
-)
-
-ModalHeader.displayName = 'ModalHeader'
-
/**
* Modal title component.
*/
@@ -749,184 +695,12 @@ const ModalDescription = React.forwardRef<
ModalDescription.displayName = 'ModalDescription'
-/**
- * Modal tabs root component. Wraps tab list and content panels.
- */
-const ModalTabs = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ onValueChange, ...props }, ref) => {
- const rootRef = React.useRef(null)
- React.useImperativeHandle(ref, () => rootRef.current as HTMLDivElement, [])
-
- const handleValueChange = (value: string) => {
- onValueChange?.(value)
- window.requestAnimationFrame(() => {
- const root = rootRef.current
- if (!root) return
- const panel = root.querySelector('[role="tabpanel"][data-state="active"]')
- focusFirstTextInputIn(panel)
- })
- }
-
- return
-})
-
-ModalTabs.displayName = 'ModalTabs'
-
-interface ModalTabsListProps extends React.ComponentPropsWithoutRef {
- /** Currently active tab value for indicator positioning */
- activeValue?: string
- /**
- * Whether the tabs are disabled (non-interactive with reduced opacity)
- * @default false
- */
- disabled?: boolean
-}
-
-/**
- * Modal tabs list component with animated sliding indicator.
- */
-const ModalTabsList = React.forwardRef<
- React.ElementRef,
- ModalTabsListProps
->(({ className, children, activeValue, disabled = false, ...props }, ref) => {
- const listRef = React.useRef(null)
- const [indicator, setIndicator] = React.useState({ left: 0, width: 0 })
- const [ready, setReady] = React.useState(false)
-
- React.useEffect(() => {
- const list = listRef.current
- if (!list) return
-
- const updateIndicator = () => {
- const activeTab = list.querySelector('[data-state="active"]') as HTMLElement | null
- if (!activeTab) return
-
- setIndicator({
- left: activeTab.offsetLeft,
- width: activeTab.offsetWidth,
- })
- setReady(true)
- }
-
- updateIndicator()
-
- const observer = new MutationObserver(updateIndicator)
- observer.observe(list, { attributes: true, subtree: true, attributeFilter: ['data-state'] })
- window.addEventListener('resize', updateIndicator)
-
- return () => {
- observer.disconnect()
- window.removeEventListener('resize', updateIndicator)
- }
- }, [activeValue])
-
- return (
-
-
- {children}
-
-
-
- )
-})
-
-ModalTabsList.displayName = 'ModalTabsList'
-
-/**
- * Modal tab trigger component. Individual tab button.
- */
-const ModalTabsTrigger = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
-
-ModalTabsTrigger.displayName = 'ModalTabsTrigger'
-
-/**
- * Modal tab content component. Content panel for each tab.
- * Includes bottom padding for consistent spacing across all tabbed modals.
- *
- * When this panel mounts (i.e. its tab becomes active), focus moves to the first
- * visible text-entry input inside it so typing works immediately. Tabs with no
- * text input are untouched.
- */
-const ModalTabsContent = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, ...props }, ref) => (
-
-))
-
-ModalTabsContent.displayName = 'ModalTabsContent'
-
-/**
- * Modal body/content area with background and padding.
- */
-const ModalBody = React.forwardRef>(
- ({ className, ...props }, ref) => (
-
- )
-)
-
-ModalBody.displayName = 'ModalBody'
-
-/**
- * Modal footer component for action buttons.
- */
-const ModalFooter = React.forwardRef>(
- ({ className, ...props }, ref) => (
-
- )
-)
-
-ModalFooter.displayName = 'ModalFooter'
-
export {
InsideModalContext,
Modal,
ModalTrigger,
ModalContent,
- ModalHeader,
ModalTitle,
ModalDescription,
- ModalBody,
- ModalTabs,
- ModalTabsList,
- ModalTabsTrigger,
- ModalTabsContent,
- ModalFooter,
ModalClose,
}
diff --git a/packages/emcn/src/components/popover/popover.tsx b/packages/emcn/src/components/popover/popover.tsx
index 6d60a2cd214..0c5782be46c 100644
--- a/packages/emcn/src/components/popover/popover.tsx
+++ b/packages/emcn/src/components/popover/popover.tsx
@@ -5,7 +5,7 @@
* @example
* Basic usage with folders:
* ```tsx
- * import { Popover, PopoverAnchor, PopoverBackButton, PopoverContent, PopoverFolder, PopoverItem } from '../../index'
+ * import { Popover, PopoverAnchor, PopoverContent, PopoverFolder, PopoverItem } from '../../index'
* import { Workflow } from '@sim/emcn/icons'
*
* function MyMenu() {
@@ -18,7 +18,6 @@
* Open Menu
*
*
- *
* console.log('Docs')}>
*
* Docs
@@ -54,7 +53,7 @@ import { DismissableLayerBranch } from '@radix-ui/react-dismissable-layer'
import * as PopoverPrimitive from '@radix-ui/react-popover'
import { createPortal } from 'react-dom'
import { MENU_STYLES } from '#menu-styles'
-import { Check, ChevronLeft, ChevronRight, Search } from '../../icons'
+import { Check, ChevronRight } from '../../icons'
import { cn } from '../../lib/cn'
import { chipActiveSurfaceClass, chipHoverSurfaceClass } from '../chip/chrome'
import { InsideModalContext } from '../modal/modal'
@@ -89,17 +88,12 @@ const STYLES = {
default: {
text: 'text-[var(--text-body)] [&_svg]:text-[var(--text-icon)]',
section: 'text-[var(--text-muted)]',
- search: 'text-[var(--text-muted)]',
- searchInput: 'text-[var(--text-body)] placeholder:text-[var(--text-muted)]',
content: '',
divider: 'border-[var(--border)]',
},
inverted: {
text: 'text-white dark:text-[var(--text-primary)]',
section: 'text-[var(--text-muted-inverse)]',
- search: 'text-[var(--text-muted-inverse)] dark:text-[var(--text-muted)]',
- searchInput:
- 'text-white placeholder:text-[var(--text-muted-inverse)] dark:text-[var(--text-primary)] dark:placeholder:text-[var(--text-muted)]',
content:
'border-[var(--border-inverted)] bg-[var(--surface-inverted)] text-white dark:text-foreground',
divider: 'border-[var(--border-inverted)]',
@@ -109,8 +103,6 @@ const STYLES = {
{
text: string
section: string
- search: string
- searchInput: string
content: string
divider: string
}
@@ -143,21 +135,12 @@ function getItemStateClasses(colorScheme: PopoverColorScheme, isActive: boolean)
}
interface PopoverContextValue {
- openFolder: (
- id: string,
- title: string,
- onLoad?: () => void | Promise,
- onSelect?: () => void
- ) => void
+ openFolder: (id: string, onLoad?: () => void | Promise) => void
closeFolder: () => void
currentFolder: string | null
isInFolder: boolean
- folderTitle: string | null
- onFolderSelect: (() => void) | null
size: PopoverSize
colorScheme: PopoverColorScheme
- searchQuery: string
- setSearchQuery: (query: string) => void
/** ID of the last hovered item (for hover submenus) */
lastHoveredItem: string | null
setLastHoveredItem: (id: string | null) => void
@@ -216,9 +199,6 @@ const Popover: React.FC = ({
}) => {
const insideModal = React.useContext(InsideModalContext)
const [currentFolder, setCurrentFolder] = React.useState(null)
- const [folderTitle, setFolderTitle] = React.useState(null)
- const [onFolderSelect, setOnFolderSelect] = React.useState<(() => void) | null>(null)
- const [searchQuery, setSearchQuery] = React.useState('')
const [lastHoveredItem, setLastHoveredItem] = React.useState(null)
const [isKeyboardNav, setIsKeyboardNav] = React.useState(false)
const [selectedIndex, setSelectedIndex] = React.useState(-1)
@@ -241,9 +221,6 @@ const Popover: React.FC = ({
/** Resets all navigation state to initial values */
const resetState = React.useCallback(() => {
setCurrentFolder(null)
- setFolderTitle(null)
- setOnFolderSelect(null)
- setSearchQuery('')
setLastHoveredItem(null)
setIsKeyboardNav(false)
setSelectedIndex(-1)
@@ -266,22 +243,15 @@ const Popover: React.FC = ({
[onOpenChange]
)
- const openFolder = React.useCallback(
- (id: string, title: string, onLoad?: () => void | Promise, onSelect?: () => void) => {
- setCurrentFolder(id)
- setFolderTitle(title)
- setOnFolderSelect(() => onSelect ?? null)
- if (onLoad) {
- void Promise.resolve(onLoad())
- }
- },
- []
- )
+ const openFolder = React.useCallback((id: string, onLoad?: () => void | Promise) => {
+ setCurrentFolder(id)
+ if (onLoad) {
+ void Promise.resolve(onLoad())
+ }
+ }, [])
const closeFolder = React.useCallback(() => {
setCurrentFolder(null)
- setFolderTitle(null)
- setOnFolderSelect(null)
}, [])
const setKeyboardNav = React.useCallback((value: boolean) => {
@@ -296,12 +266,8 @@ const Popover: React.FC = ({
closeFolder,
currentFolder,
isInFolder: currentFolder !== null,
- folderTitle,
- onFolderSelect,
size,
colorScheme,
- searchQuery,
- setSearchQuery,
lastHoveredItem,
setLastHoveredItem,
isKeyboardNav,
@@ -316,11 +282,8 @@ const Popover: React.FC = ({
openFolder,
closeFolder,
currentFolder,
- folderTitle,
- onFolderSelect,
size,
colorScheme,
- searchQuery,
lastHoveredItem,
isKeyboardNav,
setKeyboardNav,
@@ -864,8 +827,6 @@ interface PopoverFolderProps extends Omit,
icon?: React.ReactNode
/** Callback when folder opens (for lazy loading) */
onOpen?: () => void | Promise
- /** Callback when folder title is selected from within folder view */
- onSelect?: () => void
/** Folder contents */
children?: React.ReactNode
/** Whether currently active/selected */
@@ -881,23 +842,12 @@ interface PopoverFolderProps extends Omit,
/**
* Expandable folder that shows nested content.
* Supports two modes:
- * - Click mode (default): Replaces parent content, shows back button
+ * - Click mode (default): Replaces parent content
* - Hover mode (expandOnHover): Shows floating submenu alongside parent
*/
const PopoverFolder = React.forwardRef(
(
- {
- className,
- id,
- title,
- icon,
- onOpen,
- onSelect,
- children,
- active,
- expandOnHover = false,
- ...props
- },
+ { className, id, title, icon, onOpen, children, active, expandOnHover = false, ...props },
ref
) => {
const {
@@ -946,7 +896,7 @@ const PopoverFolder = React.forwardRef(
if (currentFolder === id) return <>{children}>
const handleClickOpen = () => {
- openFolder(id, title, onOpen, onSelect)
+ openFolder(id, onOpen)
}
const handleClick = (e: React.MouseEvent) => {
@@ -1041,149 +991,6 @@ const PopoverFolder = React.forwardRef(
PopoverFolder.displayName = 'PopoverFolder'
-interface PopoverBackButtonProps extends React.HTMLAttributes {
- /** Ref callback for folder title element */
- folderTitleRef?: (el: HTMLElement | null) => void
- /** Whether folder title is active/selected */
- folderTitleActive?: boolean
- /** Callback on folder title mouse enter */
- onFolderTitleMouseEnter?: () => void
-}
-
-/**
- * Back button shown inside folders. Hidden at root level.
- */
-const PopoverBackButton = React.forwardRef(
- ({ className, folderTitleRef, folderTitleActive, onFolderTitleMouseEnter, ...props }, ref) => {
- const { isInFolder, closeFolder, folderTitle, onFolderSelect, size, colorScheme } =
- usePopoverContext()
-
- if (!isInFolder) return null
-
- return (
-
-
{
- e.stopPropagation()
- closeFolder()
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.stopPropagation()
- closeFolder()
- }
- }}
- {...props}
- >
-
- Back
-
- {folderTitle && onFolderSelect && (
-
{
- e.stopPropagation()
- onFolderSelect()
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.stopPropagation()
- onFolderSelect()
- }
- }}
- onMouseEnter={onFolderTitleMouseEnter}
- >
- {folderTitle}
-
- )}
- {folderTitle && !onFolderSelect && (
-
- {folderTitle}
-
- )}
-
- )
- }
-)
-
-PopoverBackButton.displayName = 'PopoverBackButton'
-
-interface PopoverSearchProps extends React.HTMLAttributes {
- /**
- * Placeholder text
- * @default 'Search...'
- */
- placeholder?: string
- /** Callback when query changes */
- onValueChange?: (value: string) => void
-}
-
-/**
- * Search input for filtering popover items.
- */
-const PopoverSearch = React.forwardRef(
- ({ className, placeholder = 'Search...', onValueChange, ...props }, ref) => {
- const { searchQuery, setSearchQuery, size, colorScheme } = usePopoverContext()
- const inputRef = React.useRef(null)
-
- const handleChange = (e: React.ChangeEvent) => {
- const value = e.target.value
- setSearchQuery(value)
- onValueChange?.(value)
- }
-
- React.useEffect(() => {
- setSearchQuery('')
- onValueChange?.('')
- inputRef.current?.focus()
- }, [setSearchQuery, onValueChange])
-
- return (
-
-
-
-
- )
- }
-)
-
-PopoverSearch.displayName = 'PopoverSearch'
-
interface PopoverDividerProps extends React.HTMLAttributes {
/** Only show when not inside any folder */
rootOnly?: boolean
@@ -1221,8 +1028,6 @@ export {
PopoverItem,
PopoverSection,
PopoverFolder,
- PopoverBackButton,
- PopoverSearch,
PopoverDivider,
usePopoverContext,
}
diff --git a/packages/emcn/src/components/table/table.tsx b/packages/emcn/src/components/table/table.tsx
index daa661774d9..12643485369 100644
--- a/packages/emcn/src/components/table/table.tsx
+++ b/packages/emcn/src/components/table/table.tsx
@@ -62,21 +62,6 @@ const TableBody = React.forwardRef<
))
TableBody.displayName = 'TableBody'
-const TableFooter = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
- tr]:last:border-b-0',
- className
- )}
- {...props}
- />
-))
-TableFooter.displayName = 'TableFooter'
-
const TableRow = React.forwardRef>(
({ className, ...props }, ref) => (
->(({ className, ...props }, ref) => (
-
-))
-TableCaption.displayName = 'TableCaption'
-
-export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption }
+export { Table, TableHeader, TableBody, TableHead, TableRow, TableCell }
diff --git a/packages/emcn/src/components/tag-input/tag-input.tsx b/packages/emcn/src/components/tag-input/tag-input.tsx
index 7dee9855621..0f747897d92 100644
--- a/packages/emcn/src/components/tag-input/tag-input.tsx
+++ b/packages/emcn/src/components/tag-input/tag-input.tsx
@@ -3,9 +3,9 @@
*
* @example
* ```tsx
- * import { TagInput, type TagItem } from '../../index'
+ * import { TagInput } from '@sim/emcn'
*
- * const [items, setItems] = useState([])
+ * const [items, setItems] = useState<{ value: string; isValid: boolean }[]>([])
*
* ) {
- return (
-
-
-
-
-
-
- )
-}
diff --git a/packages/emcn/src/icons/index.ts b/packages/emcn/src/icons/index.ts
index ec59f6d3006..3ace6c97a65 100644
--- a/packages/emcn/src/icons/index.ts
+++ b/packages/emcn/src/icons/index.ts
@@ -54,7 +54,6 @@ export { Dashboard } from './dashboard'
export { Database } from './database'
export { DatabaseX } from './database-x'
export { DefaultFileIcon } from './default-file-icon'
-export { DocumentAttachment } from './document-attachment'
export { DocxIcon } from './docx-icon'
export { Download } from './download'
export { Duplicate } from './duplicate'
@@ -112,7 +111,6 @@ export { Moon } from './moon'
export { MoreHorizontal } from './more-horizontal'
export { MoreVertical } from './more-vertical'
export { Music } from './music'
-export { NoWrap } from './no-wrap'
export { Palette } from './palette'
export { PanelLeft } from './panel-left'
export { Paperclip } from './paperclip'
diff --git a/packages/emcn/src/icons/no-wrap.tsx b/packages/emcn/src/icons/no-wrap.tsx
deleted file mode 100644
index 0bcabfa5f28..00000000000
--- a/packages/emcn/src/icons/no-wrap.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { SVGProps } from 'react'
-
-/**
- * NoWrap icon component - shows text extending horizontally without wrapping
- * @param props - SVG properties including className, fill, etc.
- */
-export function NoWrap(props: SVGProps) {
- return (
-
-
-
-
-
-
-
- )
-}
diff --git a/packages/emcn/src/index.ts b/packages/emcn/src/index.ts
index 57ad244f26f..8d268e5a95a 100644
--- a/packages/emcn/src/index.ts
+++ b/packages/emcn/src/index.ts
@@ -33,9 +33,7 @@ export {
export {
Table,
TableBody,
- TableCaption,
TableCell,
- TableFooter,
TableHead,
TableHeader,
TableRow,
diff --git a/packages/security/src/egress.test.ts b/packages/security/src/egress.test.ts
index 19031287dae..8eb5c80d9c3 100644
--- a/packages/security/src/egress.test.ts
+++ b/packages/security/src/egress.test.ts
@@ -197,14 +197,6 @@ describe('loopback is vouched by name, never by resolved address', () => {
})
})
-describe('allowPrivate — the deprecated blanket flag', () => {
- const legacy = createEgressPolicy({ insecureHttp: 'whenVouched', allowPrivate: true })
-
- it('still cannot reach cloud metadata', () => {
- expect(reason(legacy, 'https://metadata/', '169.254.169.254')).toBe('address-metadata')
- })
-})
-
describe('denied ports', () => {
it.each([
['22', 'SSH'],
@@ -333,7 +325,7 @@ describe('createEgressPolicy validates wildcard entries too', () => {
describe('a scope id does not change what an address is', () => {
it('still reads a zoned metadata address as metadata', () => {
- const policy = createEgressPolicy({ allowPrivate: true })
+ const policy = createEgressPolicy({ allowedRanges: 'fd00::/8' })
expect(reason(policy, 'https://pg.corp/', 'fd00:ec2::254%eth0')).toBe('address-metadata')
})
})
diff --git a/packages/security/src/egress.ts b/packages/security/src/egress.ts
index be06e68ffc5..342ddc95e3b 100644
--- a/packages/security/src/egress.ts
+++ b/packages/security/src/egress.ts
@@ -126,12 +126,6 @@ export interface EgressPolicy {
* case, not a privilege.
*/
readonly allowLoopback: boolean
- /**
- * Vouches for every private address without naming one. Exists only to
- * reproduce the deprecated `ALLOW_PRIVATE_DATABASE_HOSTS`, which bypassed the
- * address check outright; a named allowlist is the supported form.
- */
- readonly allowPrivate: boolean
readonly allowedHosts: readonly HostPattern[]
readonly allowedRanges: readonly CidrRange[]
}
@@ -149,8 +143,6 @@ export interface EgressPolicySpec {
readonly insecureHttp?: InsecureHttpPolicy
/** Whether loopback destinations are vouched for without being allowlisted. */
readonly allowLoopback?: boolean
- /** Whether every private address is vouched for. See {@link EgressPolicy.allowPrivate}. */
- readonly allowPrivate?: boolean
/**
* Names of the settings these lists came from, used verbatim in the error a
* malformed entry throws so the operator knows which value to fix.
@@ -248,7 +240,6 @@ export function createEgressPolicy(spec: EgressPolicySpec = {}): EgressPolicy {
return {
insecureHttp: spec.insecureHttp ?? 'never',
allowLoopback: spec.allowLoopback ?? false,
- allowPrivate: spec.allowPrivate ?? false,
allowedHosts: splitEntries(spec.allowedHosts).map((entry) =>
parseHostPattern(entry, sourceNames.hosts)
),
@@ -464,9 +455,9 @@ type Vouch = 'allowlist' | 'loopback' | null
/**
* How the policy vouches for this destination. A hostname match alone is enough
* — the operator named that host, so wherever it points is their call.
- * Otherwise the loopback carve-out, the legacy blanket private grant, or a
- * resolved address inside an allowlisted range vouches for it, which is why the
- * last two cannot be decided before DNS for a hostname destination.
+ * Otherwise the loopback carve-out or a resolved address inside an allowlisted
+ * range vouches for it, which is why the latter cannot be decided before DNS for
+ * a hostname destination.
*/
function isVouched(url: URL, address: string | undefined, policy: EgressPolicy): Vouch {
if (matchesHostAllowlist(url.hostname, policy)) return 'allowlist'
@@ -474,10 +465,7 @@ function isVouched(url: URL, address: string | undefined, policy: EgressPolicy):
// The operator's explicit grants are checked first, so a deployment that named
// a loopback range gets more than one that named nothing — the carve-out below
// is the weaker of the two.
- if (address !== undefined) {
- if (policy.allowPrivate && isPrivateIp(unwrapIpv6Brackets(address))) return 'allowlist'
- if (matchesRangeAllowlist(address, policy)) return 'allowlist'
- }
+ if (address !== undefined && matchesRangeAllowlist(address, policy)) return 'allowlist'
if (policy.allowLoopback && isLoopbackDestination(url.hostname)) {
// Before DNS there is no address to judge; evaluateAddress rules later.
@@ -569,8 +557,7 @@ export function evaluateUrl(url: URL, policy: EgressPolicy): EgressDecision {
/**
* Whether a refusal from {@link evaluateUrl} on a hostname could still be
- * reversed by learning the resolved address — an IP-range entry, or the legacy
- * blanket private grant.
+ * reversed by learning the resolved address, which only an IP-range entry can do.
*
* A DNS-resolving caller uses this to decide whether that refusal is final. It
* is deliberately narrow: a hostname allowlist entry and the loopback carve-out
@@ -579,7 +566,7 @@ export function evaluateUrl(url: URL, policy: EgressPolicy): EgressDecision {
* hand a lookup to a destination the policy has already turned down.
*/
export function policyDefersToAddress(policy: EgressPolicy): boolean {
- return policy.allowedRanges.length > 0 || policy.allowPrivate
+ return policy.allowedRanges.length > 0
}
/**
diff --git a/packages/sim-setup/src/compose-database.test.ts b/packages/sim-setup/src/compose-database.test.ts
index 31b8353df19..b8c7498bccf 100644
--- a/packages/sim-setup/src/compose-database.test.ts
+++ b/packages/sim-setup/src/compose-database.test.ts
@@ -5,11 +5,7 @@ import { describe, expect, it } from 'vitest'
import { choosePostgresPassword, LEGACY_POSTGRES_PASSWORD } from './compose-database'
const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..')
-const COMPOSE_FILES = [
- 'docker-compose.prod.yml',
- 'docker-compose.local.yml',
- 'docker-compose.ollama.yml',
-] as const
+const COMPOSE_FILES = ['docker-compose.prod.yml', 'docker-compose.local.yml'] as const
function composePath(file: string): string {
return path.join(REPO_ROOT, file)
diff --git a/packages/testing/src/mocks/env-flags.mock.ts b/packages/testing/src/mocks/env-flags.mock.ts
index 1358c26f772..cbe8b400603 100644
--- a/packages/testing/src/mocks/env-flags.mock.ts
+++ b/packages/testing/src/mocks/env-flags.mock.ts
@@ -21,7 +21,6 @@ interface EnvFlagsMockState {
isAuthDisabled: boolean
egressAllowedHosts: string | undefined
egressAllowedIpRanges: string | undefined
- legacyPrivateDatabaseAccess: boolean
isRegistrationDisabled: boolean
isEmailPasswordEnabled: boolean
isSignupMxValidationEnabled: boolean
@@ -73,7 +72,6 @@ const defaultEnvFlagsState: EnvFlagsMockState = {
isAuthDisabled: false,
egressAllowedHosts: undefined,
egressAllowedIpRanges: undefined,
- legacyPrivateDatabaseAccess: false,
isRegistrationDisabled: false,
isEmailPasswordEnabled: true,
isSignupMxValidationEnabled: false,
@@ -139,9 +137,6 @@ export const envFlagsMockFns = {
getEgressAllowedIpRanges: vi.fn<() => string | undefined>(() =>
envFlagsState.isHosted ? undefined : envFlagsState.egressAllowedIpRanges
),
- isLegacyPrivateDatabaseAccessAllowed: vi.fn<() => boolean>(
- () => !envFlagsState.isHosted && envFlagsState.legacyPrivateDatabaseAccess
- ),
getAllowedIntegrationsFromEnv: vi.fn<() => string[] | null>(() => null),
getPreviewBlocksFromEnv: vi.fn<() => string[]>(() => []),
getBlacklistedProvidersFromEnv: vi.fn<() => string[]>(() => []),
@@ -186,9 +181,6 @@ export function resetEnvFlagsMock(): void {
.mockImplementation(() =>
envFlagsState.isHosted ? undefined : envFlagsState.egressAllowedIpRanges
)
- envFlagsMockFns.isLegacyPrivateDatabaseAccessAllowed
- .mockReset()
- .mockImplementation(() => !envFlagsState.isHosted && envFlagsState.legacyPrivateDatabaseAccess)
}
/**
diff --git a/packages/testing/src/mocks/schema-tables.generated.ts b/packages/testing/src/mocks/schema-tables.generated.ts
index 29d85c5a3dd..97029acb014 100644
--- a/packages/testing/src/mocks/schema-tables.generated.ts
+++ b/packages/testing/src/mocks/schema-tables.generated.ts
@@ -124,7 +124,6 @@ export const GENERATED_SCHEMA_TABLES = {
'createdAt',
],
workflowSubflows: ['id', 'workflowId', 'type', 'config', 'createdAt', 'updatedAt'],
- waitlist: ['id', 'email', 'status', 'createdAt', 'updatedAt'],
workflowExecutionSnapshots: ['id', 'workflowId', 'stateHash', 'stateData', 'createdAt'],
workflowExecutionLogs: [
'id',
@@ -474,7 +473,6 @@ export const GENERATED_SCHEMA_TABLES = {
'sessionPolicySettings',
'securityPolicyVersion',
'requireSso',
- 'whitelabelSettings',
'dataRetentionSettings',
'orgUsageLimit',
'storageUsedBytes',
@@ -874,20 +872,6 @@ export const GENERATED_SCHEMA_TABLES = {
'contentUpdatedAt',
'secretProvenanceVersion',
],
- workspaceFileSearchIndex: [
- 'fileId',
- 'workspaceId',
- 'sourceContentUpdatedAt',
- 'status',
- 'partial',
- 'failureReason',
- 'lineCount',
- 'indexedBytes',
- 'dispatchedAt',
- 'createdAt',
- 'updatedAt',
- ],
- workspaceFileSearchDispatchQueue: ['workspaceId', 'enqueuedAt', 'lastDispatchedAt', 'updatedAt'],
fileSearchDispatchQueue: [
'entityType',
'entityId',
@@ -904,16 +888,6 @@ export const GENERATED_SCHEMA_TABLES = {
'completedAt',
'updatedAt',
],
- workspaceFileSearchSegment: [
- 'fileId',
- 'workspaceId',
- 'sourceContentUpdatedAt',
- 'lineNumber',
- 'segmentNumber',
- 'segmentStart',
- 'lineLength',
- 'content',
- ],
workspaceFileSearchBuild: [
'id',
'fileId',
diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts
index 3243689d7fc..25638af0a88 100644
--- a/scripts/check-api-validation-contracts.ts
+++ b/scripts/check-api-validation-contracts.ts
@@ -151,9 +151,6 @@ const INDIRECT_ZOD_ROUTES = new Set([
'apps/sim/app/api/mcp/copilot/route.ts',
'apps/sim/app/api/mcp/copilot/.well-known/oauth-authorization-server/route.ts',
'apps/sim/app/api/mcp/copilot/.well-known/oauth-protected-resource/route.ts',
- // Deprecated v1 headless copilot chat API: gated to always return 410 Gone
- // and consumes no client-supplied input.
- 'apps/sim/app/api/v1/copilot/chat/route.ts',
])
const CONTRACT_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/contracts(?:\/[^'"]*)?['"]/
@@ -163,7 +160,7 @@ const DECLARATIVE_ROUTE_BUILDER_USAGE_PATTERN =
/\b(?:defineInternalJsonRoute|defineV2JsonRoute|defineV2BodyLifecycleRoute|defineInternalBinaryRoute|defineV2BinaryRoute|defineScimRoute)\s*\(/
const SERVER_VALIDATION_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/server(?:\/validation)?['"]/
const SCHEMA_PARSE_PATTERN = /\b\w+Schema\.(?:safeParse|parse)\(/
-const CONTRACT_SERVER_HELPER_PATTERN = /\bvalidateShimEnvelope\(/
+const CONTRACT_SERVER_HELPER_PATTERN = /\bvalidateChatPostEnvelope\(/
const CANONICAL_HELPER_USAGE_PATTERN =
/\b(?:isZodError|validationErrorResponse|validationErrorResponseFromError|getValidationErrorMessage)\s*\(/
const CONTRACT_MAP_PARSE_PATTERN =
diff --git a/scripts/check-explicit-any.baseline.json b/scripts/check-explicit-any.baseline.json
index 7b91a1b044a..3a0ababd737 100644
--- a/scripts/check-explicit-any.baseline.json
+++ b/scripts/check-explicit-any.baseline.json
@@ -1058,8 +1058,6 @@
"apps/sim/app/api/billing/invoices/route.ts": 2,
"apps/sim/app/api/billing/route.ts": 1,
"apps/sim/app/api/chat/[identifier]/route.ts": 1,
- "apps/sim/app/api/copilot/chat/stream/route.test.ts": 1,
- "apps/sim/app/api/copilot/chat/stream/route.ts": 1,
"apps/sim/app/api/copilot/chats/route.ts": 2,
"apps/sim/app/api/credential-groups/enroll/[token]/oauth/[optionId]/route.test.ts": 1,
"apps/sim/app/api/credential-groups/oauth-callback.test.ts": 4,
diff --git a/scripts/check-source-conventions.baseline.json b/scripts/check-source-conventions.baseline.json
index 496b8324fd3..bc0c41b2690 100644
--- a/scripts/check-source-conventions.baseline.json
+++ b/scripts/check-source-conventions.baseline.json
@@ -2,7 +2,6 @@
"relative-import": {
"apps/sim/app/(landing)/knowledge/components/knowledge-product-previews/index.ts": 1,
"apps/sim/app/api/chat/[identifier]/otp/route.test.ts": 1,
- "apps/sim/app/api/copilot/chat/stream/route.test.ts": 1,
"apps/sim/app/api/copilot/confirm/route.test.ts": 1,
"apps/sim/app/api/copilot/tool-permission/route.test.ts": 1,
"apps/sim/app/api/cron/renew-subscriptions/route.test.ts": 1,
@@ -660,8 +659,7 @@
"apps/sim/app/api/workspaces/route.ts": 2
},
"bare-route-handler": {
- "apps/sim/app/api/health/route.ts": 1,
- "apps/sim/app/api/mothership/chat/stream/route.ts": 1
+ "apps/sim/app/api/health/route.ts": 1
},
"log-message-tag": {}
}
diff --git a/scripts/check-test-types.baseline.json b/scripts/check-test-types.baseline.json
index da9f1aff787..ec40781e0ec 100644
--- a/scripts/check-test-types.baseline.json
+++ b/scripts/check-test-types.baseline.json
@@ -90,12 +90,6 @@
"apps/sim/app/api/copilot/api-keys/validate/route.test.ts": {
"TS2554": 52
},
- "apps/sim/app/api/copilot/chat/stop/route.test.ts": {
- "TS18046": 2,
- "TS2345": 1,
- "TS2554": 1,
- "TS2571": 2
- },
"apps/sim/app/api/copilot/feedback/route.test.ts": {
"TS2554": 1
},
@@ -209,6 +203,12 @@
"apps/sim/app/api/mcp/servers/test-connection/route.test.ts": {
"TS2554": 5
},
+ "apps/sim/app/api/mothership/chat/stop/route.test.ts": {
+ "TS18046": 2,
+ "TS2345": 1,
+ "TS2554": 1,
+ "TS2571": 2
+ },
"apps/sim/app/api/mothership/chats/[chatId]/fork/route.test.ts": {
"TS2488": 1,
"TS2571": 3
diff --git a/scripts/check-unused-exports.baseline.json b/scripts/check-unused-exports.baseline.json
index 561acf9b2be..29825fd0579 100644
--- a/scripts/check-unused-exports.baseline.json
+++ b/scripts/check-unused-exports.baseline.json
@@ -1263,30 +1263,23 @@
"apps/sim/lib/api/contracts/contact.ts#ContactRequestBody",
"apps/sim/lib/api/contracts/contact.ts#contactResponseSchema",
"apps/sim/lib/api/contracts/contact.ts#submitContactBodySchema",
- "apps/sim/lib/api/contracts/copilot.ts#AddCopilotChatResourceBody",
"apps/sim/lib/api/contracts/copilot.ts#CopilotConfirmBody",
"apps/sim/lib/api/contracts/copilot.ts#CopilotToolExecuteInternalBody",
"apps/sim/lib/api/contracts/copilot.ts#CopilotToolPermissionBody",
"apps/sim/lib/api/contracts/copilot.ts#CreateWorkflowCopilotChatBody",
"apps/sim/lib/api/contracts/copilot.ts#DeleteCopilotChatBody",
- "apps/sim/lib/api/contracts/copilot.ts#RemoveCopilotChatResourceBody",
- "apps/sim/lib/api/contracts/copilot.ts#ReorderCopilotChatResourcesBody",
"apps/sim/lib/api/contracts/copilot.ts#ValidateCopilotApiKeyBody",
"apps/sim/lib/api/contracts/copilot.ts#ValidateCopilotApiKeyError",
"apps/sim/lib/api/contracts/copilot.ts#ValidateCopilotApiKeyResponse",
"apps/sim/lib/api/contracts/copilot.ts#ValidateCopilotByokBody",
"apps/sim/lib/api/contracts/copilot.ts#copilotApiKeySchema",
- "apps/sim/lib/api/contracts/copilot.ts#copilotChatAbortBodySchema",
"apps/sim/lib/api/contracts/copilot.ts#copilotChatListItemSchema",
"apps/sim/lib/api/contracts/copilot.ts#copilotChatSteerBodySchema",
- "apps/sim/lib/api/contracts/copilot.ts#copilotChatStreamQuerySchema",
"apps/sim/lib/api/contracts/copilot.ts#copilotToolPermissionBodySchema",
"apps/sim/lib/api/contracts/copilot.ts#copilotToolPermissionDecisionSchema",
"apps/sim/lib/api/contracts/copilot.ts#createWorkflowCopilotChatBodySchema",
"apps/sim/lib/api/contracts/copilot.ts#deleteCopilotChatBodySchema",
"apps/sim/lib/api/contracts/copilot.ts#generateCopilotApiKeyBodySchema",
- "apps/sim/lib/api/contracts/copilot.ts#removeCopilotChatResourceBodySchema",
- "apps/sim/lib/api/contracts/copilot.ts#reorderCopilotChatResourcesBodySchema",
"apps/sim/lib/api/contracts/copilot.ts#submitCopilotFeedbackBodySchema",
"apps/sim/lib/api/contracts/copilot.ts#validateCopilotApiKeyBillingBlockedSchema",
"apps/sim/lib/api/contracts/copilot.ts#validateCopilotApiKeyErrorSchema",
@@ -1648,7 +1641,6 @@
"apps/sim/lib/api/contracts/mothership-chats.ts#MarkMothershipChatReadBody",
"apps/sim/lib/api/contracts/mothership-chats.ts#MothershipExecuteBody",
"apps/sim/lib/api/contracts/mothership-chats.ts#MothershipExecuteHeaders",
- "apps/sim/lib/api/contracts/mothership-chats.ts#addMothershipChatResourceBodySchema",
"apps/sim/lib/api/contracts/mothership-chats.ts#createMothershipChatBodySchema",
"apps/sim/lib/api/contracts/mothership-chats.ts#createMothershipChatResponseSchema",
"apps/sim/lib/api/contracts/mothership-chats.ts#forkMothershipChatBodySchema",
diff --git a/vitest.integration-durations.json b/vitest.integration-durations.json
index ff9b41f3cbc..7f9eb82242e 100644
--- a/vitest.integration-durations.json
+++ b/vitest.integration-durations.json
@@ -9,9 +9,9 @@
"apps/sim/app/api/auth/oauth2/token/route.integration.ts": 6.1,
"apps/sim/app/api/billing/update-cost/route.integration.ts": 3.9,
"apps/sim/app/api/chat/[identifier]/otp/route.integration.ts": 2.2,
- "apps/sim/app/api/copilot/chat/stream/desktop-executor.integration.ts": 7.1,
"apps/sim/app/api/folders/reorder/route.integration.ts": 0.8,
"apps/sim/app/api/knowledge/connectors/member-sync/route.integration.ts": 2.4,
+ "apps/sim/app/api/mothership/chat/stream/desktop-executor.integration.ts": 7.1,
"apps/sim/app/api/v1/knowledge/route.integration.ts": 4,
"apps/sim/app/api/webhooks/agentmail/sender-authentication.integration.ts": 1.4,
"apps/sim/app/api/webhooks/agentmail/thread-scope.integration.ts": 1.2,