Internes Project-Management-Tool für ToolCTRL — ergänzend zu Plane (Tickets) und Outline (Doku). Umfasst Puls-Übersicht, Tagesrhythmus (Lock-in + Reflexion), Bereichs-Detail-Views (Entwicklung/Vertrieb/Marketing), Pflicht-Minimum-Check und Blocker-Lifecycle gemäß Projektmanagement-Leitfaden v3.0. Stack: pnpm-Monorepo · Vite + React 18 + Tailwind · Fastify + tRPC v11 + Drizzle ORM · Postgres 16 · Authentik OIDC (Phase 2, Dev-Auto-Login aktiv). Planungs-Artefakte unter _bmad-output/planning-artifacts/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
2.1 KiB
SQL
40 lines
2.1 KiB
SQL
CREATE TABLE "audit_event" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"actor_user_id" uuid,
|
|
"action" text NOT NULL,
|
|
"entity_kind" text NOT NULL,
|
|
"entity_id" uuid,
|
|
"payload" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "session" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"user_id" uuid NOT NULL,
|
|
"expires_at" timestamp with time zone NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"ip_address" text,
|
|
"user_agent" text
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "user" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"authentik_sub" text NOT NULL,
|
|
"name" text NOT NULL,
|
|
"email" text NOT NULL,
|
|
"default_area_id" uuid,
|
|
"active" boolean DEFAULT true NOT NULL,
|
|
"abwesend_bis" timestamp with time zone,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "audit_event" ADD CONSTRAINT "audit_event_actor_user_id_user_id_fk" FOREIGN KEY ("actor_user_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "idx_audit_event_actor" ON "audit_event" USING btree ("actor_user_id");--> statement-breakpoint
|
|
CREATE INDEX "idx_audit_event_action" ON "audit_event" USING btree ("action");--> statement-breakpoint
|
|
CREATE INDEX "idx_audit_event_entity" ON "audit_event" USING btree ("entity_kind","entity_id");--> statement-breakpoint
|
|
CREATE INDEX "idx_session_user_id" ON "session" USING btree ("user_id");--> statement-breakpoint
|
|
CREATE INDEX "idx_session_expires_at" ON "session" USING btree ("expires_at");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "uniq_user_authentik_sub" ON "user" USING btree ("authentik_sub");--> statement-breakpoint
|
|
CREATE INDEX "idx_user_email" ON "user" USING btree ("email"); |