ALTER TABLE "saas_packages" ALTER COLUMN "features" SET DEFAULT '[]';--> statement-breakpoint
ALTER TABLE "tenants" ALTER COLUMN "licenses" SET DEFAULT '{}';--> statement-breakpoint
ALTER TABLE "tenants" ALTER COLUMN "brand_color" SET DEFAULT '#0b5cff';--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "package_id" uuid;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "license_number" text;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "media_engine_strategy" text DEFAULT 'XCU_GLOBAL_MESH' NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "chat_engine_strategy" text DEFAULT 'XTM_GLOBAL_MESH' NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "byok_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "byok_key" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "byok_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "byok_key" text;--> statement-breakpoint
ALTER TABLE "tenants" ADD CONSTRAINT "tenants_package_id_saas_packages_id_fk" FOREIGN KEY ("package_id") REFERENCES "public"."saas_packages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "tenants" ADD CONSTRAINT "tenants_license_number_unique" UNIQUE("license_number");