You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(dashboard-agent-db): collapse the agent's migrations into one
The datastore's 21 migrations recorded the development history of a feature
that has never shipped, including a column added in 0019 and dropped in 0020.
Regenerated from the schema with drizzle-kit, so the single file is exactly
what `src/schema.ts` declares.
Replaying from an empty database gives the same 8 tables, 118 columns, 26
indexes and 9 constraints as the 21 files did; only the physical column order
differs, because a column added by ALTER lands at the end.
"investigate_on_attention"boolean DEFAULT false NOT NULL,
129
+
"organization_id"textNOT NULL,
130
+
"project_id"textNOT NULL,
131
+
"project_ref"text,
132
+
"environment_id"textNOT NULL,
133
+
"user_id"textNOT NULL,
134
+
"created_at"timestamp with time zone DEFAULT now() NOT NULL,
135
+
"expires_at"timestamp with time zoneNOT NULL,
136
+
"last_checked_at"timestamp with time zone,
137
+
"last_attempted_at"timestamp with time zone,
138
+
"fired_at"timestamp with time zone,
139
+
"delivery_claimed_at"timestamp with time zone,
140
+
"delivery_claim_id"text,
141
+
"delivered_at"timestamp with time zone,
142
+
"cancelled_at"timestamp with time zone,
143
+
"last_result" jsonb,
144
+
"tick_count"integer DEFAULT 0NOT NULL,
145
+
"alert_dispatch_key"text,
146
+
"retention_at"timestamp with time zone GENERATED ALWAYS AS (greatest(delivered_at, cancelled_at, fired_at, last_checked_at, created_at)) STORED,
147
+
"cadence_minutes"integer GENERATED ALWAYS AS (((spec ->>'checkEveryMinutes')::int)) STORED
148
+
);
149
+
--> statement-breakpoint
150
+
CREATEINDEX "chat_messages_chat_user_role_idx" ON"trigger_dashboard_agent"."chat_messages" USING btree ("chat_id","message_id") WHERE"trigger_dashboard_agent"."chat_messages"."role"='user';--> statement-breakpoint
151
+
CREATEINDEX "chat_turn_evals_org_created_idx" ON"trigger_dashboard_agent"."chat_turn_evals" USING btree ("organization_id","created_at"DESC NULLS LAST);--> statement-breakpoint
152
+
CREATEINDEX "chat_turn_evals_created_idx" ON"trigger_dashboard_agent"."chat_turn_evals" USING btree ("created_at");--> statement-breakpoint
153
+
CREATEINDEX "chat_turn_evals_org_opps_idx" ON"trigger_dashboard_agent"."chat_turn_evals" USING btree ("organization_id","created_at"DESC NULLS LAST) WHERE"trigger_dashboard_agent"."chat_turn_evals"."capability_gap"or"trigger_dashboard_agent"."chat_turn_evals"."docs_gap"or"trigger_dashboard_agent"."chat_turn_evals"."support_opportunity"or"trigger_dashboard_agent"."chat_turn_evals"."feature_request";--> statement-breakpoint
154
+
CREATEINDEX "chats_org_user_last_msg_idx" ON"trigger_dashboard_agent"."chats" USING btree ("organization_id","user_id","last_message_at"DESC NULLS LAST) WHERE"trigger_dashboard_agent"."chats"."deleted_at" is null;--> statement-breakpoint
155
+
CREATEINDEX "investigations_chat_idx" ON"trigger_dashboard_agent"."investigations" USING btree ("chat_id");--> statement-breakpoint
156
+
CREATEINDEX "investigations_open_updated_idx" ON"trigger_dashboard_agent"."investigations" USING btree ("updated_at") WHERE"trigger_dashboard_agent"."investigations"."state"->>'outcome'='in_progress';--> statement-breakpoint
157
+
CREATEINDEX "watch_submissions_created_idx" ON"trigger_dashboard_agent"."watch_submissions" USING btree ("created_at");--> statement-breakpoint
158
+
CREATEINDEX "watches_chat_idx" ON"trigger_dashboard_agent"."watches" USING btree ("chat_id");--> statement-breakpoint
159
+
CREATEUNIQUE INDEX "watches_chat_active_identity_key" ON"trigger_dashboard_agent"."watches" USING btree ("chat_id","project_id","environment_id","identity") WHERE"trigger_dashboard_agent"."watches"."status"='active';--> statement-breakpoint
160
+
CREATEINDEX "watches_status_expires_idx" ON"trigger_dashboard_agent"."watches" USING btree ("status","expires_at");--> statement-breakpoint
161
+
CREATEINDEX "watches_pending_delivery_idx" ON"trigger_dashboard_agent"."watches" USING btree ("fired_at","last_checked_at") WHERE"trigger_dashboard_agent"."watches"."delivery_status"in ('pending', 'delivering');--> statement-breakpoint
0 commit comments