Skip to content

[#878] Create 6 airdrop campaign DB tables#898

Merged
realproject7 merged 3 commits intomainfrom
task/878-airdrop-db-tables
Apr 20, 2026
Merged

[#878] Create 6 airdrop campaign DB tables#898
realproject7 merged 3 commits intomainfrom
task/878-airdrop-db-tables

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Added migration 00035_airdrop_tables.sql with 6 tables for the airdrop campaign:
    • pl_points — append-only point ledger (buy, referral, write, rate actions)
    • pl_referrals — referral relationships
    • pl_referral_codes — one code per wallet, supports Farcaster usernames
    • pl_streaks — daily check-in streak tracking
    • pl_daily_prices — PLOT price snapshots for TWAP
    • pl_weekly_snapshots — weekly campaign stats
  • Added TypeScript types for all 6 tables in lib/supabase.ts
  • Indexes on pl_points (address, action) and pl_referrals (referrer_address)

Files Changed

  • supabase/migrations/00035_airdrop_tables.sql — new migration
  • lib/supabase.ts — table types + convenience aliases
  • package.json — patch bump 0.1.25 → 0.1.26

Test plan

  • Run migration against Supabase (verify all 6 tables + indexes created)
  • Verify TypeScript types match the SQL schema
  • npm run typecheck passes

Fixes #878

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Apr 20, 2026 11:30pm

Request Review

realproject7 and others added 2 commits April 21, 2026 08:29
Add migration 00035 with: pl_points (append-only ledger), pl_referrals,
pl_referral_codes, pl_streaks, pl_daily_prices, pl_weekly_snapshots.
Add corresponding TypeScript types to lib/supabase.ts.

Fixes #878

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@realproject7 realproject7 force-pushed the task/878-airdrop-db-tables branch from 4c52776 to d618b78 Compare April 20, 2026 23:29
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: REQUEST CHANGES

Summary

The migration mostly matches the ticket scope, but the added lib/supabase.ts types do not currently match the nullability of the SQL schema. That misses one of the stated acceptance checks for this PR.

Findings

  • [medium] Several Row fields are typed as non-null in lib/supabase.ts, but the migration does not declare those columns NOT NULL, so Supabase can return null for them.
    • File: supabase/migrations/00035_airdrop_tables.sql:11
    • Suggestion: either add NOT NULL to the defaulted columns that are intended to always exist (created_at, is_farcaster_username, current_streak, longest_streak, new_stories, token_buys, new_referrals, total_pl_earned) or relax the generated TypeScript row types to allow null.
  • [medium] The mismatch is visible in the new table typings themselves: for example pl_points.Row.created_at, pl_referrals.Row.created_at, pl_referral_codes.Row.is_farcaster_username, pl_streaks.Row.current_streak, and pl_weekly_snapshots.Row.created_at are all declared non-null even though the SQL columns are nullable today.
    • File: lib/supabase.ts:347
    • Suggestion: bring the TS definitions into exact alignment with the migration before merging.

Decision

Requesting changes because the PR says the Supabase types match the schema, but they currently do not.

Align SQL schema with TypeScript types — columns with DEFAULT values
should be NOT NULL since they always have values.

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.

Verdict: APPROVE

Summary

The schema/type mismatch from my previous review is resolved. The migration now marks the defaulted columns as NOT NULL, which brings the SQL schema into line with the added lib/supabase.ts row types.

Findings

  • No blocking findings in the updated patch.

Decision

Approving from a code-review standpoint. The migration matches the ticket scope, the indexes are present, and the TypeScript types now align with the schema.

@realproject7 realproject7 merged commit 15e72fb into main Apr 20, 2026
4 checks 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.

[Airdrop P1] Create airdrop DB tables

2 participants