CREATE TABLE "sys"."activity_asset" ( "activity_id" text NOT NULL, "kind" text NOT NULL, "version" integer NOT NULL, "body" text NOT NULL, "effective" boolean DEFAULT false NOT NULL, "source" text NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "activity_asset_activity_id_kind_version_pk" PRIMARY KEY("activity_id","kind","version") ); --> statement-breakpoint CREATE TABLE "sys"."activity_package" ( "activity_id" text NOT NULL, "version" text NOT NULL, "name" text NOT NULL, "category" text NOT NULL, "paradigm" text NOT NULL, "manifest" jsonb NOT NULL, "artifact" text NOT NULL, "state" text DEFAULT 'active' NOT NULL, "enabled" boolean DEFAULT true NOT NULL, "installed_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "activity_package_activity_id_version_pk" PRIMARY KEY("activity_id","version") ); --> statement-breakpoint CREATE TABLE "sys"."asset_increment" ( "id" text PRIMARY KEY NOT NULL, "activity_id" text NOT NULL, "kind" text NOT NULL, "diff" text NOT NULL, "evidence_entry_ids" jsonb DEFAULT '[]'::jsonb NOT NULL, "state" text DEFAULT 'candidate' NOT NULL, "replay_report" jsonb, "released_by" text, "created_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE TABLE "sys"."chat_message" ( "id" text PRIMARY KEY NOT NULL, "task_id" text NOT NULL, "kind" text NOT NULL, "payload" jsonb NOT NULL, "at" timestamp with time zone NOT NULL ); --> statement-breakpoint CREATE TABLE "sys"."task_view" ( "task_id" text PRIMARY KEY NOT NULL, "blocks" jsonb, "html" text, "phase" text DEFAULT 'activating' NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE UNIQUE INDEX "activity_asset_effective_key" ON "sys"."activity_asset" USING btree ("activity_id","kind") WHERE "sys"."activity_asset"."effective";--> statement-breakpoint CREATE INDEX "activity_package_category_idx" ON "sys"."activity_package" USING btree ("category","paradigm");--> statement-breakpoint CREATE INDEX "asset_increment_activity_idx" ON "sys"."asset_increment" USING btree ("activity_id","state");--> statement-breakpoint CREATE INDEX "chat_message_task_idx" ON "sys"."chat_message" USING btree ("task_id","at");