-- CreateTable
CREATE TABLE `car_variants` (
    `id` VARCHAR(191) NOT NULL,
    `model_id` VARCHAR(191) NOT NULL,
    `name` VARCHAR(120) NOT NULL,
    `slug` VARCHAR(200) NOT NULL,
    `is_active` BOOLEAN NOT NULL DEFAULT true,
    `deleted_at` DATETIME(3) NULL,
    `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updated_at` DATETIME(3) NOT NULL,

    UNIQUE INDEX `car_variants_slug_key`(`slug`),
    INDEX `car_variants_model_id_deleted_at_idx`(`model_id`, `deleted_at`),
    INDEX `car_variants_is_active_deleted_at_idx`(`is_active`, `deleted_at`),
    UNIQUE INDEX `car_variants_model_id_name_key`(`model_id`, `name`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `car_variants` ADD CONSTRAINT `car_variants_model_id_fkey` FOREIGN KEY (`model_id`) REFERENCES `car_models`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
