CREATE TABLE `user_oauth_identity` (
    `id`               BINARY(16)   NOT NULL,
    `user_id`          BINARY(16)   NOT NULL,
    `provider`         VARCHAR(32)  NOT NULL,
    `provider_user_id` VARCHAR(191) NOT NULL,
    `email_at_link`    VARCHAR(255) NOT NULL,
    `created_at`       DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uniq_provider_subject` (`provider`, `provider_user_id`),
    KEY `idx_user_id` (`user_id`),
    CONSTRAINT `fk_user_oauth_identity_user`
        FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
