Files
waggle-os/packages/server/drizzle/0001_redundant_sauron.sql
Oleg Maslov 0c3e2ead3b
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled
moving
2026-09-02 10:10:29 +02:00

45 lines
2.9 KiB
SQL

CREATE TABLE "team_capability_overrides" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"team_id" uuid NOT NULL,
"capability_name" text NOT NULL,
"capability_type" text NOT NULL,
"decision" text NOT NULL,
"reason" text DEFAULT '' NOT NULL,
"decided_by" uuid NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"decided_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "team_capability_policies" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"team_id" uuid NOT NULL,
"role" text NOT NULL,
"allowed_sources" jsonb DEFAULT '[]'::jsonb NOT NULL,
"blocked_tools" jsonb DEFAULT '[]'::jsonb NOT NULL,
"approval_threshold" text DEFAULT 'none' NOT NULL,
"updated_by" uuid,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "team_capability_requests" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"team_id" uuid NOT NULL,
"requested_by" uuid NOT NULL,
"capability_name" text NOT NULL,
"capability_type" text NOT NULL,
"justification" text NOT NULL,
"status" text DEFAULT 'pending' NOT NULL,
"decided_by" uuid,
"decision_reason" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"decided_at" timestamp with time zone
);
--> statement-breakpoint
ALTER TABLE "team_capability_overrides" ADD CONSTRAINT "team_capability_overrides_team_id_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."teams"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_capability_overrides" ADD CONSTRAINT "team_capability_overrides_decided_by_users_id_fk" FOREIGN KEY ("decided_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_capability_policies" ADD CONSTRAINT "team_capability_policies_team_id_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."teams"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_capability_policies" ADD CONSTRAINT "team_capability_policies_updated_by_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_capability_requests" ADD CONSTRAINT "team_capability_requests_team_id_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."teams"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_capability_requests" ADD CONSTRAINT "team_capability_requests_requested_by_users_id_fk" FOREIGN KEY ("requested_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_capability_requests" ADD CONSTRAINT "team_capability_requests_decided_by_users_id_fk" FOREIGN KEY ("decided_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;