CREATE TYPE "public"."announcement_scope" AS ENUM('COMPANY', 'DEPARTMENT', 'TERRITORY');--> statement-breakpoint
CREATE TABLE "announcements" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"tenant_id" uuid NOT NULL,
	"title" text NOT NULL,
	"body" text NOT NULL,
	"scope_type" "announcement_scope" DEFAULT 'COMPANY' NOT NULL,
	"scope_id" uuid,
	"created_by" uuid,
	"is_active" boolean DEFAULT true NOT NULL,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX "announcements_tenant_active_idx" ON "announcements" USING btree ("tenant_id","is_active");