-- Profile-jump identities are intentionally separate from legacy HMAC identities. -- No username-based backfill. Existing-account binding requires reviewed explicit IDs. CREATE TABLE IF NOT EXISTS platform_external_identity ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, issuer VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, tenant_id VARCHAR(96) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, external_user_id VARCHAR(96) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, user_id BIGINT UNSIGNED NOT NULL, created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), UNIQUE KEY uq_external_identity (issuer,tenant_id,external_user_id), UNIQUE KEY uq_external_platform_user (user_id), CONSTRAINT fk_external_identity_user FOREIGN KEY(user_id) REFERENCES platform_user(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;