CREATE TABLE IF NOT EXISTS t_users (
    user_id            INT AUTO_INCREMENT PRIMARY KEY,
    user_email         VARCHAR(255) NOT NULL UNIQUE,
    user_password      VARCHAR(255) NOT NULL COMMENT 'bcrypt cost=12',
    user_name          VARCHAR(255) NOT NULL,
    user_role          VARCHAR(20) NOT NULL DEFAULT 'admin',
    user_last_login_at DATETIME NULL,
    user_created_at    DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    user_updated_at    DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- DOWN

DROP TABLE IF EXISTS t_users;
