fix(migrations): baseline_sync no-op + placeholder para versão 20250103#222
Conversation
1. Convert 20250101000000_baseline_sync.sql to no-op SELECT 1. The INSERT approach was incompatible with Supabase's migration runner: it pre-computes the full pending list before executing any migration, so inserting versions via baseline_sync and then having the runner try to INSERT its own record caused duplicate key violations. All historical versions were inserted directly into production's schema_migrations via MCP execute_sql (ON CONFLICT DO NOTHING), so this file is now skipped by new previews (version already applied). 2. Add 20250103_placeholder.sql for the bare 8-digit version "20250103" that was recorded in production schema_migrations. Without a matching local file the Supabase CLI branch-action errors with "Remote migration versions not found in local migrations directory". https://claude.ai/code/session_01EwUnLoFHJ1UF5jzLpwME3x
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughO PR consolida ajustes operacionais em migrações Supabase e CI: allowlist do script de detecção é expandida para ignorar documentação de migrações, baseline migration é convertida para no-op, placeholder de versão é adicionado, e dois drops de publication ganham proteção condicional contra estados variáveis do banco. ChangesAjustes de migração Supabase e CI
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutos Possibly related issues
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Updates to Preview Branch (claude/code-review-architecture-Rhqo2) ↗︎
Tasks are run on every commit but only new migration files are pushed.
❌ Branch Error • Fri, 15 May 2026 13:11:42 UTC View logs for this Workflow Run ↗︎. |
- ALTER PUBLICATION ... DROP TABLE IF EXISTS é sintaxe inválida no PostgreSQL — substituído por bloco DO $$ com verificação em pg_publication_tables para idempotência segura (afeta migrations 20260405222509 e 20260411210929) - Renomear 20260515040000_fix_profiles_user_id_definitive.sql para 20260515040001 para eliminar conflito de versão duplicada com 20260515040000_onda19_followup_track_functions_fix_view_security.sql https://claude.ai/code/session_01EwUnLoFHJ1UF5jzLpwME3x
Supabase CLI emite "Skipping migration README.md" e falha imediatamente no run incremental do CI. O arquivo não segue o padrão '<timestamp>_name.sql' e parece causar abort prematuro. Movido para supabase/MIGRATIONS_README.md. https://claude.ai/code/session_01EwUnLoFHJ1UF5jzLpwME3x
…nho do README O README de migrations foi movido de supabase/migrations/README.md para supabase/MIGRATIONS_README.md para corrigir falha do Supabase Preview CI. Atualiza a allowlist do check-no-db-push.mjs para refletir o novo caminho. https://claude.ai/code/session_01EwUnLoFHJ1UF5jzLpwME3x
There was a problem hiding this comment.
Pull request overview
Resolves Supabase Preview Branch failures caused by PR #192's baseline_sync migration (which inserted historical versions and produced duplicate-key errors) and a missing local file for the remote-only 20250103 version. The fix neutralizes the bulk INSERT (replacing it with a no-op), adds a placeholder file for the orphan 20250103 version, hardens two prior ALTER PUBLICATION ... DROP TABLE IF EXISTS migrations (invalid syntax) into idempotent DO blocks, renames a duplicated 20260515040000_* migration to 20260515040001_*, and relocates the migrations README to avoid being picked up by Supabase CLI (with a corresponding ALLOWLIST update in the db push guard).
Changes:
- Make
20250101000000_baseline_sync.sqla no-op and add20250103_placeholder.sqlto satisfy the CLI local↔remote version check. - Replace invalid
ALTER PUBLICATION ... DROP TABLE IF EXISTSwith conditionalDO $$blocks usingpg_publication_tables(in20260405222509_*and20260411210929_*). - Move
supabase/migrations/README.md→supabase/MIGRATIONS_README.mdand update thecheck-no-db-pushallowlist; rename profiles fix migration to20260515040001_*.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
supabase/migrations/20250101000000_baseline_sync.sql |
Strip 395-row INSERT; keep file as SELECT 1 no-op to avoid duplicate-key on previews. |
supabase/migrations/20250103_placeholder.sql |
New 4-line placeholder so CLI accepts the remote-only 20250103 version. |
supabase/migrations/20260405222509_*.sql |
Wrap publication drop in DO $$ with pg_publication_tables guard (valid PG syntax). |
supabase/migrations/20260411210929_*.sql |
Same idempotent guard for the workspace_notifications drop. |
supabase/migrations/20260515040001_fix_profiles_user_id_definitive.sql |
Renamed from 20260515040000_* to resolve duplicate version with 20260515040000_onda19_*. |
supabase/MIGRATIONS_README.md |
New location for the README outside supabase/migrations/ to avoid CLI ingestion. |
scripts/check-no-db-push.mjs |
Update allowlist to the new README path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'docs/redeploy/REDEPLOY-FASE2-EXECUTION-LOG.md', | ||
| 'docs/redeploy/REDEPLOY-FASE3-FINAL.md', | ||
| 'supabase/migrations/README.md', | ||
| 'supabase/MIGRATIONS_README.md', |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ada5bfb41a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| -- Placeholder for version 20250103. | ||
| -- This version was recorded in production schema_migrations by baseline sync. | ||
| -- File exists only to satisfy Supabase CLI local/remote version check. |
There was a problem hiding this comment.
Add the missing 20251227 placeholder
This placeholder fixes the remote/local check for 20250103, but the baseline list removed in this same commit also included a bare remote version 20251227. The current migrations directory only has 202512271... timestamped files, which are different versions, so any Supabase command that compares production schema_migrations against local files will still fail with a missing local migration for 20251227 after the production baseline insert described in the commit.
Useful? React with 👍 / 👎.
Problema
A migration
20250101000000_baseline_sync.sqlmergeada no PR #192 continha um INSERT massivo emsupabase_migrations.schema_migrations. Isso causa duplicate key violations em qualquer novo Supabase Preview Branch porque o migration runner:baseline_sync→ insere versões (ex:20251214183243) emschema_migrations20251214183243→ DUPLICATE KEY 💥Além disso, a versão
20250103(8 dígitos) foi registrada emschema_migrationsda produção sem um arquivo local correspondente, causando erroRemote migration versions not found in local migrations directory.Solução
Fix 1 —
20250101000000_baseline_sync.sql→ no-opAs 395 versões históricas foram inseridas diretamente em
supabase_migrations.schema_migrationsda produção via MCPexecute_sqlcomON CONFLICT DO NOTHING. A versão20250101000000agora está registrada em produção, portanto novos previews herdam e pulam este arquivo.Fix 2 —
20250103_placeholder.sqlArquivo placeholder de 4 linhas para satisfazer o check do Supabase CLI de versão local ↔ remota para a versão
20250103.Impacto
Checklist
SELECT 1(no-op)20250103_placeholder.sqladicionadoON CONFLICT DO NOTHING)https://claude.ai/code/session_01EwUnLoFHJ1UF5jzLpwME3x
Generated by Claude Code
Summary by cubic
Make
baseline_synca no-op and add a placeholder migration to stop duplicate key errors in Supabase Preview Branches. Also fix publication-drop syntax, resolve a duplicate migration version, and relocate the migrations README with a CI allowlist update; no schema changes.20250101000000_baseline_sync.sqlto no-op and add20250103_placeholder.sqlto satisfy the CLI version check and prevent duplicate key errors.20260405222509_*.sql,20260411210929_*.sql: replace invalidALTER PUBLICATION ... DROP TABLE IF EXISTSwith a conditionalDO $$usingpg_publication_tables.20260515040000_fix_profiles_user_id_definitive.sql→20260515040001_...to resolve a duplicate version conflict.supabase/migrations/README.md→supabase/MIGRATIONS_README.md) and update CI guard allowlist path inscripts/check-no-db-push.mjsto prevent Supabase CLI aborts.Written for commit ada5bfb. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
Bug Fixes
Chores