CREATE TABLE "client_account" (
	"id" text PRIMARY KEY NOT NULL,
	"company_name" text NOT NULL,
	"contact_name" text NOT NULL,
	"contact_email" text NOT NULL,
	"plan" text DEFAULT 'presence' NOT NULL,
	"status" text DEFAULT 'actif' NOT NULL,
	"notes" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "client_site" (
	"id" text PRIMARY KEY NOT NULL,
	"client_account_id" text NOT NULL,
	"domain" text NOT NULL,
	"label" text,
	"status" text DEFAULT 'en_preparation' NOT NULL,
	"plan" text DEFAULT 'presence' NOT NULL,
	"monthly_amount_cents" integer DEFAULT 0 NOT NULL,
	"search_console_site_url" text,
	"ga4_property_id" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "client_account_id" text;--> statement-breakpoint
ALTER TABLE "client_site" ADD CONSTRAINT "client_site_client_account_id_client_account_id_fk" FOREIGN KEY ("client_account_id") REFERENCES "public"."client_account"("id") ON DELETE cascade ON UPDATE no action;