Conversation
The `db:migrations:apply` script in package.json referenced a `scripts:apply-migrations` entry that didn't exist. This adds the missing `scripts/apply-migrations.ts` that reads SQL files from the migrations/ directory and executes them in order against the database. Already-applied migrations are detected and skipped. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Artitus is attempting to deploy a commit to the E2B Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17bb553cbf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if ( | ||
| err.message.includes('already exists') || | ||
| err.message.includes('duplicate') | ||
| ) { |
There was a problem hiding this comment.
Treating any “duplicate” error as already-applied migration
The script skips a migration whenever the error message contains “already exists” or “duplicate”. That’s broader than “schema already applied”: data migrations can legitimately fail with duplicate key value violates unique constraint when inserting rows, or unique-index creation can fail due to real data conflicts. In those cases the migration has not been applied, but this code will log it as skipped and continue, leaving the DB in a partially migrated state without surfacing the failure. Consider using a dedicated migrations table or only skipping known idempotent DDL errors tied to the specific migration.
Useful? React with 👍 / 👎.
Replace the manual migration instructions with the new `bun run db:migrations:apply` command, while keeping the manual approach as an alternative. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
scripts/apply-migrations.tsthat thedb:migrations:applypackage.json script referenced but never existed.sqlfiles frommigrations/in timestamp order and executes them against the database using thepostgrespackagescripts:apply-migrationsentry inpackage.jsonUsage
Test plan
Made with Cursor