Skip to content

[DATA INTEGRITY][WALLET SCHEMA] Migrate duplicate walletAddress fields to one canonical key #192

Description

@Obiajulu-gif

Summary

The User model maintains both walletAddress and walletaddress as independently unique fields. Reads and writes must continually fall back between them, allowing split-brain identity and uniqueness behavior.

Repository evidence

  • models/User.ts:89-99 declares both fields with separate unique sparse indexes.
  • app/api/users/[id]/route.ts:236-242 reads either field and writes both to keep them synchronized.

Scope

  • Select one canonical field and add a conflict-detecting migration.
  • Remove fallback writes and replace both indexes with one canonical uniqueness constraint.

Acceptance criteria

  • Every user has at most one canonical wallet identity and no two users collapse during migration.
  • Old field access is removed after a measured compatibility window.

Tests

  • Cover only-old, only-new, matching-both, conflicting-both, and cross-user duplicate records.

Non-goals

  • Changing the authentication provider.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions