Skip to content

Supabase - new table - memory_emails#2

Merged
sweetmantech merged 2 commits into
mainfrom
sweetmantech/myc-3787-supabase-new-table-memory_emails
Dec 18, 2025
Merged

Supabase - new table - memory_emails#2
sweetmantech merged 2 commits into
mainfrom
sweetmantech/myc-3787-supabase-new-table-memory_emails

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Added backend support for associating emails with memories, enabling reliable linking between emails and saved memories.
    • Improved data integrity and security for email-memory records and added optimizations for faster retrieval.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 18, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a SQL migration that creates the memory_emails table (id, email_id, memory, message_id, created_at) with primary key, unique constraints, a foreign key to memories(id) with cascade rules, row-level security enabled, and indexes on memory and created_at.

Changes

Cohort / File(s) Change Summary
Database Migration
supabase/migrations/20251218123402_create_memory_emails_table.sql
Creates public.memory_emails with id (uuid, pk, default gen_random_uuid()), email_id (uuid, not null, unique), memory (uuid, not null, fk → memories(id) ON UPDATE/DELETE CASCADE), message_id (text, not null, unique), created_at (timestamptz, not null, default now()). Enables ROW LEVEL SECURITY. Adds indexes memory_emails_memory_idx (memory) and memory_emails_created_at_idx (created_at).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check foreign key cascade behavior in memory_emails_memory_fkey and existence/schema of memories(id).
  • Confirm uniqueness requirements for email_id and message_id.
  • Validate index choices match expected query patterns and consider missing indexes if needed.
  • Verify RLS intent and associated policies exist elsewhere.

Possibly related PRs

Poem

🐰
I dug a fresh table beneath moonlit beams,
Linking messages, emails, and memory dreams.
With cascading hops and guarded rows tight,
Indexes hum softly through day and night. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new memory_emails table to Supabase, which matches the migration file and its purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3b1389 and 2c7d528.

📒 Files selected for processing (1)
  • supabase/migrations/20251218123402_create_memory_emails_table.sql (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@supabase

supabase Bot commented Dec 18, 2025

Copy link
Copy Markdown

Updates to Preview Branch (sweetmantech/myc-3787-supabase-new-table-memory_emails) ↗︎

Deployments Status Updated
Database Thu, 18 Dec 2025 17:46:11 UTC
Services Thu, 18 Dec 2025 17:46:11 UTC
APIs Thu, 18 Dec 2025 17:46:11 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Thu, 18 Dec 2025 17:46:11 UTC
Migrations Thu, 18 Dec 2025 17:46:11 UTC
Seeding Thu, 18 Dec 2025 17:46:11 UTC
Edge Functions Thu, 18 Dec 2025 17:46:11 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
supabase/migrations/20251218123402_create_memory_emails_table.sql (1)

24-30: Redundant indexes on columns with unique constraints.

PostgreSQL automatically creates indexes to enforce unique constraints. The indexes on email_id (lines 25-26) and message_id (lines 29-30) are redundant since unique constraints already exist on these columns (lines 11-12). These duplicate indexes consume unnecessary storage and add maintenance overhead.

🔎 Apply this diff to remove redundant indexes:
--- Create index on email_id for faster lookups
-CREATE INDEX IF NOT EXISTS memory_emails_email_id_idx 
-  ON public.memory_emails(email_id);
-
--- Create index on message_id for faster lookups
-CREATE INDEX IF NOT EXISTS memory_emails_message_id_idx 
-  ON public.memory_emails(message_id);
-
 -- Create index on created_at for sorting
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4821cad and d3b1389.

📒 Files selected for processing (1)
  • supabase/migrations/20251218123402_create_memory_emails_table.sql (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Supabase Preview

Comment thread supabase/migrations/20251218123402_create_memory_emails_table.sql
Comment thread supabase/migrations/20251218123402_create_memory_emails_table.sql
@sweetmantech sweetmantech merged commit 751b8a8 into main Dec 18, 2025
0 of 2 checks passed
sweetmantech added a commit that referenced this pull request Jul 6, 2026
…win rows (#40)

Companion to recoupable/api#755 (normalizeProfileUrl canonicalization).
Merges 403 twitter/x twin pairs (repointing 7 FK columns with unique-
constraint guards) and renames 23,622 twinless twitter.com keys in place.
Post-condition check raises if any twitter.com key survives.

Tracking: recoupable/chat#1851 (PR #2 of 2 required).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant