Skip to content

Commit 92235b0

Browse files
committed
Restore cloud migration history
1 parent bac9acc commit 92235b0

31 files changed

Lines changed: 21177 additions & 451 deletions

.oxfmtrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"bun.lock",
1212
"*.tsbuildinfo",
1313
"executor-*.tgz",
14-
"**/routeTree.gen.ts"
14+
"**/routeTree.gen.ts",
15+
"apps/cloud/src/services/executor-schema.ts"
1516
]
1617
}
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
CREATE TABLE "accounts" (
2+
"id" text PRIMARY KEY NOT NULL,
3+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
4+
);
5+
--> statement-breakpoint
6+
CREATE TABLE "memberships" (
7+
"account_id" text NOT NULL,
8+
"organization_id" text NOT NULL,
9+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
10+
CONSTRAINT "memberships_account_id_organization_id_pk" PRIMARY KEY("account_id","organization_id")
11+
);
12+
--> statement-breakpoint
13+
CREATE TABLE "organizations" (
14+
"id" text PRIMARY KEY NOT NULL,
15+
"name" text NOT NULL,
16+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
17+
);
18+
--> statement-breakpoint
19+
CREATE TABLE "blob" (
20+
"namespace" text NOT NULL,
21+
"key" text NOT NULL,
22+
"value" text NOT NULL,
23+
CONSTRAINT "blob_namespace_key_pk" PRIMARY KEY("namespace","key")
24+
);
25+
--> statement-breakpoint
26+
CREATE TABLE "definition" (
27+
"id" text NOT NULL,
28+
"scope_id" text NOT NULL,
29+
"source_id" text NOT NULL,
30+
"plugin_id" text NOT NULL,
31+
"name" text NOT NULL,
32+
"schema" jsonb NOT NULL,
33+
"created_at" timestamp NOT NULL,
34+
CONSTRAINT "definition_scope_id_id_pk" PRIMARY KEY("scope_id","id")
35+
);
36+
--> statement-breakpoint
37+
CREATE TABLE "graphql_operation" (
38+
"id" text NOT NULL,
39+
"scope_id" text NOT NULL,
40+
"source_id" text NOT NULL,
41+
"binding" jsonb NOT NULL,
42+
CONSTRAINT "graphql_operation_scope_id_id_pk" PRIMARY KEY("scope_id","id")
43+
);
44+
--> statement-breakpoint
45+
CREATE TABLE "graphql_source" (
46+
"id" text NOT NULL,
47+
"scope_id" text NOT NULL,
48+
"name" text NOT NULL,
49+
"endpoint" text NOT NULL,
50+
"headers" jsonb,
51+
CONSTRAINT "graphql_source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
52+
);
53+
--> statement-breakpoint
54+
CREATE TABLE "mcp_binding" (
55+
"id" text NOT NULL,
56+
"scope_id" text NOT NULL,
57+
"source_id" text NOT NULL,
58+
"binding" jsonb NOT NULL,
59+
"created_at" timestamp NOT NULL,
60+
CONSTRAINT "mcp_binding_scope_id_id_pk" PRIMARY KEY("scope_id","id")
61+
);
62+
--> statement-breakpoint
63+
CREATE TABLE "mcp_oauth_session" (
64+
"id" text NOT NULL,
65+
"scope_id" text NOT NULL,
66+
"session" jsonb NOT NULL,
67+
"expires_at" integer NOT NULL,
68+
"created_at" timestamp NOT NULL,
69+
CONSTRAINT "mcp_oauth_session_scope_id_id_pk" PRIMARY KEY("scope_id","id")
70+
);
71+
--> statement-breakpoint
72+
CREATE TABLE "mcp_source" (
73+
"id" text NOT NULL,
74+
"scope_id" text NOT NULL,
75+
"name" text NOT NULL,
76+
"config" jsonb NOT NULL,
77+
"created_at" timestamp NOT NULL,
78+
CONSTRAINT "mcp_source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
79+
);
80+
--> statement-breakpoint
81+
CREATE TABLE "openapi_oauth_session" (
82+
"id" text NOT NULL,
83+
"scope_id" text NOT NULL,
84+
"session" jsonb NOT NULL,
85+
"created_at" timestamp NOT NULL,
86+
CONSTRAINT "openapi_oauth_session_scope_id_id_pk" PRIMARY KEY("scope_id","id")
87+
);
88+
--> statement-breakpoint
89+
CREATE TABLE "openapi_operation" (
90+
"id" text NOT NULL,
91+
"scope_id" text NOT NULL,
92+
"source_id" text NOT NULL,
93+
"binding" jsonb NOT NULL,
94+
CONSTRAINT "openapi_operation_scope_id_id_pk" PRIMARY KEY("scope_id","id")
95+
);
96+
--> statement-breakpoint
97+
CREATE TABLE "openapi_source" (
98+
"id" text NOT NULL,
99+
"scope_id" text NOT NULL,
100+
"name" text NOT NULL,
101+
"spec" text NOT NULL,
102+
"base_url" text,
103+
"headers" jsonb,
104+
"oauth2" jsonb,
105+
"invocation_config" jsonb NOT NULL,
106+
CONSTRAINT "openapi_source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
107+
);
108+
--> statement-breakpoint
109+
CREATE TABLE "secret" (
110+
"id" text NOT NULL,
111+
"scope_id" text NOT NULL,
112+
"name" text NOT NULL,
113+
"provider" text NOT NULL,
114+
"created_at" timestamp NOT NULL,
115+
CONSTRAINT "secret_scope_id_id_pk" PRIMARY KEY("scope_id","id")
116+
);
117+
--> statement-breakpoint
118+
CREATE TABLE "source" (
119+
"id" text NOT NULL,
120+
"scope_id" text NOT NULL,
121+
"plugin_id" text NOT NULL,
122+
"kind" text NOT NULL,
123+
"name" text NOT NULL,
124+
"url" text,
125+
"can_remove" boolean DEFAULT true NOT NULL,
126+
"can_refresh" boolean DEFAULT false NOT NULL,
127+
"can_edit" boolean DEFAULT false NOT NULL,
128+
"created_at" timestamp NOT NULL,
129+
"updated_at" timestamp NOT NULL,
130+
CONSTRAINT "source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
131+
);
132+
--> statement-breakpoint
133+
CREATE TABLE "tool" (
134+
"id" text NOT NULL,
135+
"scope_id" text NOT NULL,
136+
"source_id" text NOT NULL,
137+
"plugin_id" text NOT NULL,
138+
"name" text NOT NULL,
139+
"description" text NOT NULL,
140+
"input_schema" jsonb,
141+
"output_schema" jsonb,
142+
"created_at" timestamp NOT NULL,
143+
"updated_at" timestamp NOT NULL,
144+
CONSTRAINT "tool_scope_id_id_pk" PRIMARY KEY("scope_id","id")
145+
);
146+
--> statement-breakpoint
147+
CREATE TABLE "workos_vault_metadata" (
148+
"id" text NOT NULL,
149+
"scope_id" text NOT NULL,
150+
"name" text NOT NULL,
151+
"purpose" text,
152+
"created_at" timestamp NOT NULL,
153+
CONSTRAINT "workos_vault_metadata_scope_id_id_pk" PRIMARY KEY("scope_id","id")
154+
);
155+
--> statement-breakpoint
156+
ALTER TABLE "memberships" ADD CONSTRAINT "memberships_account_id_accounts_id_fk" FOREIGN KEY ("account_id") REFERENCES "public"."accounts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
157+
ALTER TABLE "memberships" ADD CONSTRAINT "memberships_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
158+
CREATE INDEX "definition_scope_id_idx" ON "definition" USING btree ("scope_id");--> statement-breakpoint
159+
CREATE INDEX "definition_source_id_idx" ON "definition" USING btree ("source_id");--> statement-breakpoint
160+
CREATE INDEX "definition_plugin_id_idx" ON "definition" USING btree ("plugin_id");--> statement-breakpoint
161+
CREATE INDEX "graphql_operation_scope_id_idx" ON "graphql_operation" USING btree ("scope_id");--> statement-breakpoint
162+
CREATE INDEX "graphql_operation_source_id_idx" ON "graphql_operation" USING btree ("source_id");--> statement-breakpoint
163+
CREATE INDEX "graphql_source_scope_id_idx" ON "graphql_source" USING btree ("scope_id");--> statement-breakpoint
164+
CREATE INDEX "mcp_binding_scope_id_idx" ON "mcp_binding" USING btree ("scope_id");--> statement-breakpoint
165+
CREATE INDEX "mcp_binding_source_id_idx" ON "mcp_binding" USING btree ("source_id");--> statement-breakpoint
166+
CREATE INDEX "mcp_oauth_session_scope_id_idx" ON "mcp_oauth_session" USING btree ("scope_id");--> statement-breakpoint
167+
CREATE INDEX "mcp_source_scope_id_idx" ON "mcp_source" USING btree ("scope_id");--> statement-breakpoint
168+
CREATE INDEX "openapi_oauth_session_scope_id_idx" ON "openapi_oauth_session" USING btree ("scope_id");--> statement-breakpoint
169+
CREATE INDEX "openapi_operation_scope_id_idx" ON "openapi_operation" USING btree ("scope_id");--> statement-breakpoint
170+
CREATE INDEX "openapi_operation_source_id_idx" ON "openapi_operation" USING btree ("source_id");--> statement-breakpoint
171+
CREATE INDEX "openapi_source_scope_id_idx" ON "openapi_source" USING btree ("scope_id");--> statement-breakpoint
172+
CREATE INDEX "secret_scope_id_idx" ON "secret" USING btree ("scope_id");--> statement-breakpoint
173+
CREATE INDEX "secret_provider_idx" ON "secret" USING btree ("provider");--> statement-breakpoint
174+
CREATE INDEX "source_scope_id_idx" ON "source" USING btree ("scope_id");--> statement-breakpoint
175+
CREATE INDEX "source_plugin_id_idx" ON "source" USING btree ("plugin_id");--> statement-breakpoint
176+
CREATE INDEX "tool_scope_id_idx" ON "tool" USING btree ("scope_id");--> statement-breakpoint
177+
CREATE INDEX "tool_source_id_idx" ON "tool" USING btree ("source_id");--> statement-breakpoint
178+
CREATE INDEX "tool_plugin_id_idx" ON "tool" USING btree ("plugin_id");--> statement-breakpoint
179+
CREATE INDEX "workos_vault_metadata_scope_id_idx" ON "workos_vault_metadata" USING btree ("scope_id");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "openapi_source" ADD COLUMN "source_url" text;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "mcp_oauth_session" ALTER COLUMN "expires_at" SET DATA TYPE bigint;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE TABLE "connection" (
2+
"id" text NOT NULL,
3+
"scope_id" text NOT NULL,
4+
"provider" text NOT NULL,
5+
"kind" text NOT NULL,
6+
"identity_label" text,
7+
"access_token_secret_id" text NOT NULL,
8+
"refresh_token_secret_id" text,
9+
"expires_at" bigint,
10+
"scope" text,
11+
"provider_state" jsonb,
12+
"created_at" timestamp NOT NULL,
13+
"updated_at" timestamp NOT NULL,
14+
CONSTRAINT "connection_scope_id_id_pk" PRIMARY KEY("scope_id","id")
15+
);
16+
--> statement-breakpoint
17+
ALTER TABLE "secret" ADD COLUMN "owned_by_connection_id" text;--> statement-breakpoint
18+
CREATE INDEX "connection_scope_id_idx" ON "connection" USING btree ("scope_id");--> statement-breakpoint
19+
CREATE INDEX "connection_provider_idx" ON "connection" USING btree ("provider");--> statement-breakpoint
20+
CREATE INDEX "secret_owned_by_connection_id_idx" ON "secret" USING btree ("owned_by_connection_id");
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CREATE TABLE "openapi_source_binding" (
2+
"id" text NOT NULL,
3+
"source_id" text NOT NULL,
4+
"source_scope_id" text NOT NULL,
5+
"target_scope_id" text NOT NULL,
6+
"slot" text NOT NULL,
7+
"value" jsonb NOT NULL,
8+
"created_at" timestamp NOT NULL,
9+
"updated_at" timestamp NOT NULL,
10+
CONSTRAINT "openapi_source_binding_id_pk" PRIMARY KEY("id")
11+
);
12+
--> statement-breakpoint
13+
CREATE INDEX "openapi_source_binding_source_id_idx" ON "openapi_source_binding" USING btree ("source_id");
14+
--> statement-breakpoint
15+
CREATE INDEX "openapi_source_binding_source_scope_id_idx" ON "openapi_source_binding" USING btree ("source_scope_id");
16+
--> statement-breakpoint
17+
CREATE INDEX "openapi_source_binding_target_scope_id_idx" ON "openapi_source_binding" USING btree ("target_scope_id");
18+
--> statement-breakpoint
19+
CREATE INDEX "openapi_source_binding_slot_idx" ON "openapi_source_binding" USING btree ("slot");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "connection" DROP COLUMN "kind";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CREATE TABLE "tool_policy" (
2+
"id" text NOT NULL,
3+
"scope_id" text NOT NULL,
4+
"pattern" text NOT NULL,
5+
"action" text NOT NULL,
6+
-- Fractional-indexing key (Jira lexorank style). Lex-ordered text;
7+
-- always subdivisible by lengthening, so reorders never run out of
8+
-- room.
9+
"position" text NOT NULL,
10+
"created_at" timestamp NOT NULL,
11+
"updated_at" timestamp NOT NULL,
12+
CONSTRAINT "tool_policy_scope_id_id_pk" PRIMARY KEY("scope_id","id")
13+
);
14+
--> statement-breakpoint
15+
-- List queries are always `WHERE scope_id = ? ORDER BY position`, so the
16+
-- composite index serves both the filter and the sort from one btree.
17+
CREATE INDEX "tool_policy_scope_id_position_idx" ON "tool_policy" USING btree ("scope_id", "position");
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CREATE TABLE "oauth2_session" (
2+
"id" text NOT NULL,
3+
"scope_id" text NOT NULL,
4+
"plugin_id" text NOT NULL,
5+
"strategy" text NOT NULL,
6+
"connection_id" text NOT NULL,
7+
"token_scope" text NOT NULL,
8+
"redirect_url" text NOT NULL,
9+
"payload" jsonb NOT NULL,
10+
"expires_at" bigint NOT NULL,
11+
"created_at" timestamp NOT NULL,
12+
CONSTRAINT "oauth2_session_scope_id_id_pk" PRIMARY KEY("scope_id","id")
13+
);
14+
--> statement-breakpoint
15+
DROP TABLE "mcp_oauth_session" CASCADE;--> statement-breakpoint
16+
DROP TABLE "openapi_oauth_session" CASCADE;--> statement-breakpoint
17+
ALTER TABLE "graphql_source" ADD COLUMN "query_params" jsonb;--> statement-breakpoint
18+
ALTER TABLE "graphql_source" ADD COLUMN "auth" jsonb;--> statement-breakpoint
19+
ALTER TABLE "openapi_source" ADD COLUMN "query_params" jsonb;--> statement-breakpoint
20+
CREATE INDEX "oauth2_session_scope_id_idx" ON "oauth2_session" USING btree ("scope_id");--> statement-breakpoint
21+
CREATE INDEX "oauth2_session_plugin_id_idx" ON "oauth2_session" USING btree ("plugin_id");--> statement-breakpoint
22+
CREATE INDEX "oauth2_session_connection_id_idx" ON "oauth2_session" USING btree ("connection_id");

0 commit comments

Comments
 (0)