CREATE TABLE "auto_messages" (
	"id" serial PRIMARY KEY,
	"user_id" text NOT NULL,
	"event" text NOT NULL,
	"phone" text NOT NULL,
	"message" text NOT NULL,
	"status" text NOT NULL,
	"error" text,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "accounts" ADD COLUMN "name" text;--> statement-breakpoint
ALTER TABLE "accounts" ADD COLUMN "phone" text;--> statement-breakpoint
ALTER TABLE "accounts" ADD COLUMN "sms_alerts" boolean DEFAULT true NOT NULL;--> statement-breakpoint
CREATE INDEX "auto_messages_created_idx" ON "auto_messages" ("created_at");--> statement-breakpoint
ALTER TABLE "auto_messages" ADD CONSTRAINT "auto_messages_user_id_accounts_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "accounts"("user_id");