|
| 1 | +-- Create "external_mcp_attachments" table |
| 2 | +CREATE TABLE "external_mcp_attachments" ( |
| 3 | + "id" uuid NOT NULL DEFAULT generate_uuidv7(), |
| 4 | + "deployment_id" uuid NOT NULL, |
| 5 | + "registry_id" uuid NOT NULL, |
| 6 | + "name" text NOT NULL, |
| 7 | + "slug" text NOT NULL, |
| 8 | + "created_at" timestamptz NOT NULL DEFAULT clock_timestamp(), |
| 9 | + "updated_at" timestamptz NOT NULL DEFAULT clock_timestamp(), |
| 10 | + "deleted_at" timestamptz NULL, |
| 11 | + "deleted" boolean NOT NULL GENERATED ALWAYS AS (deleted_at IS NOT NULL) STORED, |
| 12 | + PRIMARY KEY ("id"), |
| 13 | + CONSTRAINT "external_mcp_attachments_deployment_id_fkey" FOREIGN KEY ("deployment_id") REFERENCES "deployments" ("id") ON UPDATE NO ACTION ON DELETE CASCADE, |
| 14 | + CONSTRAINT "external_mcp_attachments_registry_id_fkey" FOREIGN KEY ("registry_id") REFERENCES "mcp_registries" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, |
| 15 | + CONSTRAINT "external_mcp_attachments_name_check" CHECK (name <> ''::text), |
| 16 | + CONSTRAINT "external_mcp_attachments_slug_check" CHECK (slug <> ''::text) |
| 17 | +); |
| 18 | +-- Create index "external_mcp_attachments_deployment_id_idx" to table: "external_mcp_attachments" |
| 19 | +CREATE INDEX "external_mcp_attachments_deployment_id_idx" ON "external_mcp_attachments" ("deployment_id") WHERE (deleted IS FALSE); |
| 20 | +-- Create index "external_mcp_attachments_deployment_id_slug_key" to table: "external_mcp_attachments" |
| 21 | +CREATE UNIQUE INDEX "external_mcp_attachments_deployment_id_slug_key" ON "external_mcp_attachments" ("deployment_id", "slug") WHERE (deleted IS FALSE); |
| 22 | +-- Create "external_mcp_tool_definitions" table |
| 23 | +CREATE TABLE "external_mcp_tool_definitions" ( |
| 24 | + "id" uuid NOT NULL DEFAULT generate_uuidv7(), |
| 25 | + "external_mcp_attachment_id" uuid NOT NULL, |
| 26 | + "tool_urn" text NOT NULL, |
| 27 | + "remote_url" text NOT NULL, |
| 28 | + "requires_oauth" boolean NOT NULL DEFAULT false, |
| 29 | + "created_at" timestamptz NOT NULL DEFAULT clock_timestamp(), |
| 30 | + "updated_at" timestamptz NOT NULL DEFAULT clock_timestamp(), |
| 31 | + "deleted_at" timestamptz NULL, |
| 32 | + "deleted" boolean NOT NULL GENERATED ALWAYS AS (deleted_at IS NOT NULL) STORED, |
| 33 | + PRIMARY KEY ("id"), |
| 34 | + CONSTRAINT "external_mcp_tool_definitions_external_mcp_attachment_id_fkey" FOREIGN KEY ("external_mcp_attachment_id") REFERENCES "external_mcp_attachments" ("id") ON UPDATE NO ACTION ON DELETE CASCADE, |
| 35 | + CONSTRAINT "external_mcp_tool_definitions_remote_url_check" CHECK (remote_url <> ''::text), |
| 36 | + CONSTRAINT "external_mcp_tool_definitions_tool_urn_check" CHECK (tool_urn <> ''::text) |
| 37 | +); |
| 38 | +-- Create index "external_mcp_tool_definitions_external_mcp_attachment_id_idx" to table: "external_mcp_tool_definitions" |
| 39 | +CREATE INDEX "external_mcp_tool_definitions_external_mcp_attachment_id_idx" ON "external_mcp_tool_definitions" ("external_mcp_attachment_id") WHERE (deleted IS FALSE); |
0 commit comments