CREATE TABLE IF NOT EXISTS `company_profiles` (
    `id`             INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `user_id`        INT UNSIGNED NOT NULL,
    `name`           VARCHAR(160) NOT NULL,
    `slug`           VARCHAR(120) NOT NULL,
    `city_id`        INT UNSIGNED NULL,
    `address`        VARCHAR(255) NULL,
    `phone`          VARCHAR(30) NULL,
    `website`        VARCHAR(255) NULL,
    `description_lv` TEXT NULL,
    `description_ru` TEXT NULL,
    `description_en` TEXT NULL,
    `logo`           VARCHAR(255) NULL,
    `is_verified`    TINYINT(1) NOT NULL DEFAULT 0,
    `is_active`      TINYINT(1) NOT NULL DEFAULT 1,
    `created_at`     DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`     DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `company_profiles_user_id_unique` (`user_id`),
    UNIQUE KEY `company_profiles_slug_unique` (`slug`),
    CONSTRAINT `fk_cp_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
    CONSTRAINT `fk_cp_city` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
