PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_customers` (
	`id` text PRIMARY KEY NOT NULL,
	`phone` text NOT NULL,
	`name` text NOT NULL,
	`tier` text,
	`national_id` text,
	`national_card_file` text,
	`password_hash` text,
	`birth_date` text,
	`created_branch_id` text NOT NULL,
	`status` text DEFAULT 'active' NOT NULL,
	`provisional` integer DEFAULT false NOT NULL,
	`created_at` integer NOT NULL,
	`updated_at` integer NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_customers`("id", "phone", "name", "tier", "national_id", "national_card_file", "password_hash", "birth_date", "created_branch_id", "status", "provisional", "created_at", "updated_at") SELECT "id", "phone", "name", "tier", NULL, NULL, "password_hash", "birth_date", "created_branch_id", "status", "provisional", "created_at", "updated_at" FROM `customers`;--> statement-breakpoint
DROP TABLE `customers`;--> statement-breakpoint
ALTER TABLE `__new_customers` RENAME TO `customers`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE UNIQUE INDEX `customers_phone_uq` ON `customers` (`phone`);--> statement-breakpoint
CREATE UNIQUE INDEX `customers_national_id_uq` ON `customers` (`national_id`);