-- CreateTable
CREATE TABLE `SaudiRegion` (
    `id` VARCHAR(191) NOT NULL,
    `code` VARCHAR(191) NOT NULL,
    `nameAr` VARCHAR(191) NOT NULL,
    `nameEn` VARCHAR(191) NOT NULL,
    `sortOrder` INTEGER NOT NULL DEFAULT 0,

    UNIQUE INDEX `SaudiRegion_code_key`(`code`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `SaudiCity` (
    `id` VARCHAR(191) NOT NULL,
    `slug` VARCHAR(191) NOT NULL,
    `nameAr` VARCHAR(191) NOT NULL,
    `nameEn` VARCHAR(191) NOT NULL,
    `regionCode` VARCHAR(191) NOT NULL,
    `sortOrder` INTEGER NOT NULL DEFAULT 0,

    UNIQUE INDEX `SaudiCity_slug_key`(`slug`),
    INDEX `SaudiCity_regionCode_idx`(`regionCode`),
    UNIQUE INDEX `SaudiCity_regionCode_nameEn_key`(`regionCode`, `nameEn`),
    PRIMARY KEY (`id`),
    CONSTRAINT `SaudiCity_regionCode_fkey` FOREIGN KEY (`regionCode`) REFERENCES `SaudiRegion` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
