Merge gitea/main into the Motion branch
Motion was written against a base five commits behind main, so the integration is the interesting part of this commit: - The migration is renumbered 0014 -> 0015. Main shipped 0014_piggy_conversations, and two migrations sharing an index is a journal that applies one of them. - The seed-idempotency gate keeps main's all-tables diff rather than the motion_templates counter this branch added; the general check subsumes the specific one. - Nav gains a Motion group alongside main's new Workspace group, and Piggy keeps the mark main gave it. - Stat keeps main's container-scaled figure, which already carries the min-w-0 this branch added for the same reason. - Piggy's page labels keep main's refusal wording for the four pages with no tool of their own, and gain the three Motion routes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
-- Generated by drizzle-kit, then trimmed. Three statements it emitted are not
|
||||
-- here, and deleting them is the point rather than an oversight.
|
||||
--
|
||||
-- 0005, 0012 and 0013 were hand-written and left no snapshot, so drizzle
|
||||
-- diffed against 0011 and re-proposed their work: `ALTER TYPE pig_team_role
|
||||
-- ADD VALUE 'viewer'` (0012, and without the IF NOT EXISTS that made that one
|
||||
-- safe) and a drop-and-add of the learn_resources provider CHECK (0013). On
|
||||
-- any database those migrations have already touched, the first fails outright
|
||||
-- and the second is a needless drop of a live constraint. The 0014 snapshot
|
||||
-- beside this file is kept in full, because it describes the schema as it
|
||||
-- actually is — which is what re-synchronises the snapshot chain with the
|
||||
-- hand-written migrations for whoever generates 0015.
|
||||
--
|
||||
-- Everything below is additive: two new tables and one new nullable column.
|
||||
-- Nothing here reads or rewrites an existing row, so it cannot fail on data.
|
||||
CREATE TABLE "piggy_conversations" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"model" text,
|
||||
"mode" text,
|
||||
"read_capability" text DEFAULT 'book:read' NOT NULL,
|
||||
"context" jsonb,
|
||||
"last_message_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "piggy_conversations_mode_check" CHECK ("piggy_conversations"."mode" IS NULL OR "piggy_conversations"."mode" IN ('read_only', 'confirm', 'auto')),
|
||||
CONSTRAINT "piggy_conversations_read_capability_check" CHECK ("piggy_conversations"."read_capability" IN ('book:read', 'economics:read', 'team:read')),
|
||||
CONSTRAINT "piggy_conversations_title_check" CHECK (length("piggy_conversations"."title") > 0)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "piggy_messages" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"conversation_id" uuid NOT NULL,
|
||||
"seq" integer NOT NULL,
|
||||
"role" text NOT NULL,
|
||||
"content" text DEFAULT '' NOT NULL,
|
||||
"reasoning" text,
|
||||
"model" text,
|
||||
"mode" text,
|
||||
"input_tokens" integer,
|
||||
"output_tokens" integer,
|
||||
"cost_micro_cents" integer,
|
||||
"finish_reason" text,
|
||||
"tool_call_id" text,
|
||||
"tool_name" text,
|
||||
"tool_arguments" jsonb,
|
||||
"tool_result" jsonb,
|
||||
"tool_ok" boolean,
|
||||
"approval_id" text,
|
||||
"approval_change" jsonb,
|
||||
"approval_decision" text,
|
||||
"approval_decided_at" timestamp with time zone,
|
||||
"error" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "piggy_messages_role_check" CHECK ("piggy_messages"."role" IN ('user', 'assistant', 'tool')),
|
||||
CONSTRAINT "piggy_messages_mode_check" CHECK ("piggy_messages"."mode" IS NULL OR "piggy_messages"."mode" IN ('read_only', 'confirm', 'auto')),
|
||||
CONSTRAINT "piggy_messages_approval_decision_check" CHECK ("piggy_messages"."approval_decision" IS NULL OR "piggy_messages"."approval_decision" IN ('apply', 'reject')),
|
||||
CONSTRAINT "piggy_messages_seq_check" CHECK ("piggy_messages"."seq" >= 0)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "agent_runs" ADD COLUMN "piggy_conversation_id" uuid;--> statement-breakpoint
|
||||
ALTER TABLE "piggy_conversations" ADD CONSTRAINT "piggy_conversations_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "piggy_messages" ADD CONSTRAINT "piggy_messages_conversation_id_piggy_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."piggy_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "agent_runs" ADD CONSTRAINT "agent_runs_piggy_conversation_id_piggy_conversations_id_fk" FOREIGN KEY ("piggy_conversation_id") REFERENCES "public"."piggy_conversations"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "piggy_conversations_user_recent_idx" ON "piggy_conversations" USING btree ("user_id","last_message_at" DESC NULLS LAST);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "piggy_messages_conversation_seq_key" ON "piggy_messages" USING btree ("conversation_id","seq");--> statement-breakpoint
|
||||
CREATE INDEX "agent_runs_piggy_conversation_idx" ON "agent_runs" USING btree ("piggy_conversation_id");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -104,7 +104,14 @@
|
||||
"idx": 14,
|
||||
"version": "7",
|
||||
"when": 1786800000000,
|
||||
"tag": "0014_motion",
|
||||
"tag": "0014_piggy_conversations",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 15,
|
||||
"version": "7",
|
||||
"when": 1786900000000,
|
||||
"tag": "0015_motion",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user