-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy path0000_lame_rage.sql
More file actions
179 lines (179 loc) · 7.21 KB
/
0000_lame_rage.sql
File metadata and controls
179 lines (179 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
CREATE TABLE "accounts" (
"id" text PRIMARY KEY NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "memberships" (
"account_id" text NOT NULL,
"organization_id" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "memberships_account_id_organization_id_pk" PRIMARY KEY("account_id","organization_id")
);
--> statement-breakpoint
CREATE TABLE "organizations" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "blob" (
"namespace" text NOT NULL,
"key" text NOT NULL,
"value" text NOT NULL,
CONSTRAINT "blob_namespace_key_pk" PRIMARY KEY("namespace","key")
);
--> statement-breakpoint
CREATE TABLE "definition" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"source_id" text NOT NULL,
"plugin_id" text NOT NULL,
"name" text NOT NULL,
"schema" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
CONSTRAINT "definition_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "graphql_operation" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"source_id" text NOT NULL,
"binding" jsonb NOT NULL,
CONSTRAINT "graphql_operation_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "graphql_source" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"name" text NOT NULL,
"endpoint" text NOT NULL,
"headers" jsonb,
CONSTRAINT "graphql_source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "mcp_binding" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"source_id" text NOT NULL,
"binding" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
CONSTRAINT "mcp_binding_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "mcp_oauth_session" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"session" jsonb NOT NULL,
"expires_at" integer NOT NULL,
"created_at" timestamp NOT NULL,
CONSTRAINT "mcp_oauth_session_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "mcp_source" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"name" text NOT NULL,
"config" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
CONSTRAINT "mcp_source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "openapi_oauth_session" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"session" jsonb NOT NULL,
"created_at" timestamp NOT NULL,
CONSTRAINT "openapi_oauth_session_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "openapi_operation" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"source_id" text NOT NULL,
"binding" jsonb NOT NULL,
CONSTRAINT "openapi_operation_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "openapi_source" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"name" text NOT NULL,
"spec" text NOT NULL,
"base_url" text,
"headers" jsonb,
"oauth2" jsonb,
"invocation_config" jsonb NOT NULL,
CONSTRAINT "openapi_source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "secret" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"name" text NOT NULL,
"provider" text NOT NULL,
"created_at" timestamp NOT NULL,
CONSTRAINT "secret_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "source" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"plugin_id" text NOT NULL,
"kind" text NOT NULL,
"name" text NOT NULL,
"url" text,
"can_remove" boolean DEFAULT true NOT NULL,
"can_refresh" boolean DEFAULT false NOT NULL,
"can_edit" boolean DEFAULT false NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "source_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "tool" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"source_id" text NOT NULL,
"plugin_id" text NOT NULL,
"name" text NOT NULL,
"description" text NOT NULL,
"input_schema" jsonb,
"output_schema" jsonb,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
CONSTRAINT "tool_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
CREATE TABLE "workos_vault_metadata" (
"id" text NOT NULL,
"scope_id" text NOT NULL,
"name" text NOT NULL,
"purpose" text,
"created_at" timestamp NOT NULL,
CONSTRAINT "workos_vault_metadata_scope_id_id_pk" PRIMARY KEY("scope_id","id")
);
--> statement-breakpoint
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
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
CREATE INDEX "definition_scope_id_idx" ON "definition" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "definition_source_id_idx" ON "definition" USING btree ("source_id");--> statement-breakpoint
CREATE INDEX "definition_plugin_id_idx" ON "definition" USING btree ("plugin_id");--> statement-breakpoint
CREATE INDEX "graphql_operation_scope_id_idx" ON "graphql_operation" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "graphql_operation_source_id_idx" ON "graphql_operation" USING btree ("source_id");--> statement-breakpoint
CREATE INDEX "graphql_source_scope_id_idx" ON "graphql_source" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "mcp_binding_scope_id_idx" ON "mcp_binding" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "mcp_binding_source_id_idx" ON "mcp_binding" USING btree ("source_id");--> statement-breakpoint
CREATE INDEX "mcp_oauth_session_scope_id_idx" ON "mcp_oauth_session" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "mcp_source_scope_id_idx" ON "mcp_source" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "openapi_oauth_session_scope_id_idx" ON "openapi_oauth_session" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "openapi_operation_scope_id_idx" ON "openapi_operation" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "openapi_operation_source_id_idx" ON "openapi_operation" USING btree ("source_id");--> statement-breakpoint
CREATE INDEX "openapi_source_scope_id_idx" ON "openapi_source" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "secret_scope_id_idx" ON "secret" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "secret_provider_idx" ON "secret" USING btree ("provider");--> statement-breakpoint
CREATE INDEX "source_scope_id_idx" ON "source" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "source_plugin_id_idx" ON "source" USING btree ("plugin_id");--> statement-breakpoint
CREATE INDEX "tool_scope_id_idx" ON "tool" USING btree ("scope_id");--> statement-breakpoint
CREATE INDEX "tool_source_id_idx" ON "tool" USING btree ("source_id");--> statement-breakpoint
CREATE INDEX "tool_plugin_id_idx" ON "tool" USING btree ("plugin_id");--> statement-breakpoint
CREATE INDEX "workos_vault_metadata_scope_id_idx" ON "workos_vault_metadata" USING btree ("scope_id");