CREATE TABLE `countries` (
	`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
	`slug` text NOT NULL,
	`flag` text,
	`sort_order` integer DEFAULT 0 NOT NULL,
	`created_at` integer NOT NULL,
	`updated_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `countries_slug_unique` ON `countries` (`slug`);--> statement-breakpoint
CREATE TABLE `country_locales` (
	`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
	`country_id` integer NOT NULL,
	`locale` text NOT NULL,
	`title` text NOT NULL,
	`description` text NOT NULL,
	`body` text,
	`duration` text,
	`cost_range` text,
	`benefits` text DEFAULT '[]' NOT NULL,
	`roles` text DEFAULT '[]' NOT NULL,
	`process` text DEFAULT '[]' NOT NULL,
	`faq` text DEFAULT '[]' NOT NULL,
	`seo_title` text,
	`seo_description` text,
	FOREIGN KEY (`country_id`) REFERENCES `countries`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `country_locales_country_locale_unique` ON `country_locales` (`country_id`,`locale`);--> statement-breakpoint
INSERT INTO `countries` (`slug`, `flag`, `sort_order`, `created_at`, `updated_at`) VALUES
  ('philippines', '🇵🇭', 0, unixepoch(), unixepoch()),
  ('kenya', '🇰🇪', 1, unixepoch(), unixepoch()),
  ('ethiopia', '🇪🇹', 2, unixepoch(), unixepoch()),
  ('india', '🇮🇳', 3, unixepoch(), unixepoch()),
  ('egypt', '🇪🇬', 4, unixepoch(), unixepoch()),
  ('pakistan', '🇵🇰', 5, unixepoch(), unixepoch()),
  ('bangladesh', '🇧🇩', 6, unixepoch(), unixepoch()),
  ('sri-lanka', '🇱🇰', 7, unixepoch(), unixepoch()),
  ('ghana', '🇬🇭', 8, unixepoch(), unixepoch()),
  ('burundi', '🇧🇮', 9, unixepoch(), unixepoch()),
  ('indonesia', '🇮🇩', 10, unixepoch(), unixepoch());
--> statement-breakpoint
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_cvs` (
	`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
	`slug` text NOT NULL,
	`locale` text NOT NULL,
	`name` text NOT NULL,
	`photo` text,
	`bio` text,
	`country` text NOT NULL,
	`profession` text NOT NULL,
	`age` integer NOT NULL,
	`experience_years` integer DEFAULT 0 NOT NULL,
	`experience_note` text,
	`religion` text,
	`marital_status` text,
	`salary` integer,
	`has_video` integer DEFAULT false NOT NULL,
	`featured` integer DEFAULT false NOT NULL,
	`created_at` integer NOT NULL,
	`updated_at` integer NOT NULL,
	FOREIGN KEY (`country`) REFERENCES `countries`(`slug`) ON UPDATE no action ON DELETE restrict
);
--> statement-breakpoint
INSERT INTO `__new_cvs`("id", "slug", "locale", "name", "photo", "bio", "country", "profession", "age", "experience_years", "experience_note", "religion", "marital_status", "salary", "has_video", "featured", "created_at", "updated_at") SELECT "id", "slug", "locale", "name", "photo", "bio", "country", "profession", "age", "experience_years", "experience_note", "religion", "marital_status", "salary", "has_video", "featured", "created_at", "updated_at" FROM `cvs`;--> statement-breakpoint
DROP TABLE `cvs`;--> statement-breakpoint
ALTER TABLE `__new_cvs` RENAME TO `cvs`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE UNIQUE INDEX `cvs_slug_locale_unique` ON `cvs` (`slug`,`locale`);