Skip to content

[#95] Add DB-level lowercase CHECK on rater_address#103

Merged
realproject7 merged 1 commit intomainfrom
task/95-ratings-address-check
Mar 15, 2026
Merged

[#95] Add DB-level lowercase CHECK on rater_address#103
realproject7 merged 1 commit intomainfrom
task/95-ratings-address-check

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

Fixes #95

  • Added migration 00006_ratings_address_check.sql with CHECK constraint: rater_address = lower(rater_address)
  • Defense-in-depth: prevents mixed-case addresses from breaking the UNIQUE dedup if writes bypass the API

Test plan

  • Migration applies cleanly on a fresh DB
  • Migration applies cleanly on existing DB (all existing addresses are already lowercase via API)
  • Inserting a mixed-case address directly via SQL is rejected
  • Normal API flow (which lowercases) continues to work

🤖 Generated with Claude Code

Defense-in-depth: ensures rater_address is always lowercase at the DB
level, preventing dedup issues if writes bypass the API's toLowerCase().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2b Review — APPROVE

Clean migration — single CHECK constraint enforcing rater_address = lower(rater_address). Correct defense-in-depth for address normalization.

Migration file naming follows existing convention (00006_ sequence). No application code changes needed.

LGTM ✓

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

This adds the requested DB-level lowercase constraint on ratings.rater_address via a focused migration, which reinforces the existing API normalization and protects the unique dedup key from mixed-case writes.

Findings

  • No blocking findings.

Decision

Approving because the migration matches issue #95, fits the current schema cleanly, and the refreshed lint/typecheck run passed.

@realproject7 realproject7 merged commit ab8fab6 into main Mar 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] No DB-level address normalization constraint on ratings table

2 participants