CREATE TABLE "campaign_assets" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"campaign_id" uuid NOT NULL,
	"file_id" varchar(255) NOT NULL,
	"file_name" varchar(500) NOT NULL,
	"original_name" varchar(500),
	"mime_type" varchar(255),
	"file_type" varchar(50),
	"drive_url" varchar(500),
	"size" bigint,
	"uploaded_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "users" DROP CONSTRAINT "users_email_unique";--> statement-breakpoint
ALTER TABLE "campaigns" ADD COLUMN "asset_folder_id" varchar(255);--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "tiktok_access_token" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "tiktok_refresh_token" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "tiktok_user_id" varchar(255);--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "youtube_access_token" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "youtube_refresh_token" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "youtube_channel_id" varchar(255);--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "instagram_access_token" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "instagram_refresh_token" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "instagram_user_id" varchar(255);--> statement-breakpoint
ALTER TABLE "campaign_assets" ADD CONSTRAINT "campaign_assets_campaign_id_campaigns_id_fk" FOREIGN KEY ("campaign_id") REFERENCES "public"."campaigns"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "users_email_role_unique" ON "users" USING btree ("email","role");