-- 001_create_users_table.sql
CREATE TABLE IF NOT EXISTS `users` (
    `id`                    BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    `ho_ten`                VARCHAR(150) NOT NULL,
    `email`                 VARCHAR(191) NOT NULL,
    `mat_khau`              VARCHAR(255) NOT NULL,
    `so_dien_thoai`         VARCHAR(20) DEFAULT NULL,
    `vai_tro`               ENUM('admin','landlord','tenant') NOT NULL DEFAULT 'tenant',
    `trang_thai_kich_hoat`  TINYINT(1) NOT NULL DEFAULT 1,
    `xac_thuc_email_luc`    TIMESTAMP NULL DEFAULT NULL,
    `deleted_at`            TIMESTAMP NULL DEFAULT NULL,
    `created_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `users_email_unique` (`email`),
    KEY `users_vai_tro_index` (`vai_tro`),
    KEY `users_deleted_at_index` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
