Skip to content

Commit f2950c7

Browse files
committed
readd migrations
1 parent 88b4a1f commit f2950c7

File tree

4 files changed

+10315
-2
lines changed

4 files changed

+10315
-2
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
CREATE TYPE "public"."a2a_task_status" AS ENUM('submitted', 'working', 'input-required', 'completed', 'failed', 'canceled', 'rejected', 'auth-required', 'unknown');--> statement-breakpoint
2+
CREATE TABLE "a2a_agent" (
3+
"id" text PRIMARY KEY NOT NULL,
4+
"workspace_id" text NOT NULL,
5+
"workflow_id" text NOT NULL,
6+
"created_by" text NOT NULL,
7+
"name" text NOT NULL,
8+
"description" text,
9+
"version" text DEFAULT '1.0.0' NOT NULL,
10+
"capabilities" jsonb DEFAULT '{}' NOT NULL,
11+
"skills" jsonb DEFAULT '[]' NOT NULL,
12+
"authentication" jsonb DEFAULT '{}' NOT NULL,
13+
"signatures" jsonb DEFAULT '[]',
14+
"is_published" boolean DEFAULT false NOT NULL,
15+
"published_at" timestamp,
16+
"created_at" timestamp DEFAULT now() NOT NULL,
17+
"updated_at" timestamp DEFAULT now() NOT NULL
18+
);
19+
--> statement-breakpoint
20+
CREATE TABLE "a2a_push_notification_config" (
21+
"id" text PRIMARY KEY NOT NULL,
22+
"task_id" text NOT NULL,
23+
"url" text NOT NULL,
24+
"token" text,
25+
"auth_schemes" jsonb DEFAULT '[]',
26+
"auth_credentials" text,
27+
"is_active" boolean DEFAULT true NOT NULL,
28+
"created_at" timestamp DEFAULT now() NOT NULL,
29+
"updated_at" timestamp DEFAULT now() NOT NULL
30+
);
31+
--> statement-breakpoint
32+
CREATE TABLE "a2a_task" (
33+
"id" text PRIMARY KEY NOT NULL,
34+
"agent_id" text NOT NULL,
35+
"session_id" text,
36+
"status" "a2a_task_status" DEFAULT 'submitted' NOT NULL,
37+
"messages" jsonb DEFAULT '[]' NOT NULL,
38+
"artifacts" jsonb DEFAULT '[]',
39+
"execution_id" text,
40+
"metadata" jsonb DEFAULT '{}',
41+
"created_at" timestamp DEFAULT now() NOT NULL,
42+
"updated_at" timestamp DEFAULT now() NOT NULL,
43+
"completed_at" timestamp
44+
);
45+
--> statement-breakpoint
46+
ALTER TABLE "a2a_agent" ADD CONSTRAINT "a2a_agent_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
47+
ALTER TABLE "a2a_agent" ADD CONSTRAINT "a2a_agent_workflow_id_workflow_id_fk" FOREIGN KEY ("workflow_id") REFERENCES "public"."workflow"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
48+
ALTER TABLE "a2a_agent" ADD CONSTRAINT "a2a_agent_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
49+
ALTER TABLE "a2a_push_notification_config" ADD CONSTRAINT "a2a_push_notification_config_task_id_a2a_task_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."a2a_task"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
50+
ALTER TABLE "a2a_task" ADD CONSTRAINT "a2a_task_agent_id_a2a_agent_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."a2a_agent"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
51+
CREATE INDEX "a2a_agent_workspace_id_idx" ON "a2a_agent" USING btree ("workspace_id");--> statement-breakpoint
52+
CREATE INDEX "a2a_agent_workflow_id_idx" ON "a2a_agent" USING btree ("workflow_id");--> statement-breakpoint
53+
CREATE INDEX "a2a_agent_created_by_idx" ON "a2a_agent" USING btree ("created_by");--> statement-breakpoint
54+
CREATE UNIQUE INDEX "a2a_agent_workspace_workflow_unique" ON "a2a_agent" USING btree ("workspace_id","workflow_id");--> statement-breakpoint
55+
CREATE INDEX "a2a_push_notification_config_task_id_idx" ON "a2a_push_notification_config" USING btree ("task_id");--> statement-breakpoint
56+
CREATE UNIQUE INDEX "a2a_push_notification_config_task_unique" ON "a2a_push_notification_config" USING btree ("task_id");--> statement-breakpoint
57+
CREATE INDEX "a2a_task_agent_id_idx" ON "a2a_task" USING btree ("agent_id");--> statement-breakpoint
58+
CREATE INDEX "a2a_task_session_id_idx" ON "a2a_task" USING btree ("session_id");--> statement-breakpoint
59+
CREATE INDEX "a2a_task_status_idx" ON "a2a_task" USING btree ("status");--> statement-breakpoint
60+
CREATE INDEX "a2a_task_execution_id_idx" ON "a2a_task" USING btree ("execution_id");--> statement-breakpoint
61+
CREATE INDEX "a2a_task_created_at_idx" ON "a2a_task" USING btree ("created_at");

packages/db/migrations/meta/0136_snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9330,4 +9330,4 @@
93309330
"schemas": {},
93319331
"tables": {}
93329332
}
9333-
}
9333+
}

0 commit comments

Comments
 (0)