ALTER TABLE "materials" ADD COLUMN "access_scope" TEXT NOT NULL DEFAULT 'general'; ALTER TABLE "materials" ADD CONSTRAINT "materials_access_scope_check" CHECK ("access_scope" IN ('general', 'operations_g')); ALTER TABLE "materials" ADD CONSTRAINT "materials_operations_g_shared_check" CHECK ("access_scope" <> 'operations_g' OR "task_detail_private" = false); CREATE INDEX "materials_access_scope_idx" ON "materials" ("access_scope");