CREATE TABLE IF NOT EXISTS users_invitations (
    id_invitation INT UNSIGNED NOT NULL AUTO_INCREMENT,
    token CHAR(64) NOT NULL,
    email VARCHAR(190) NULL,
    id_user_inviter INT UNSIGNED NOT NULL,
    id_user_created INT UNSIGNED NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    expires_at DATETIME NOT NULL,
    used_at DATETIME NULL,
    PRIMARY KEY (id_invitation),
    UNIQUE KEY uniq_token (token),
    KEY idx_inviter (id_user_inviter)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
