GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — improvement(migrations): log better errors by icecrasher321 · Pull Request #4260 · simstudioai/sim Conversation
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
PR SummaryMedium Risk Overview Enhances Reviewed by Cursor Bugbot for commit 96a3b51. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Greptile SummaryThis PR makes two improvements to the migration tooling: it moves the Confidence Score: 5/5Safe to merge; the SQL fix is correct and the only finding is a P2 naming mismatch in the logging helper Both changes are low-risk: the SQL migration fix is a correctness improvement to an existing migration, and the migrate.ts change only affects error logging output. The one identified issue (snake_case vs camelCase field names) means a few diagnostic fields would silently not print, but does not affect migration correctness or CI. packages/db/scripts/migrate.ts — camelCase field names should be verified against the postgres.js driver Important Files Changed
Sequence DiagramsequenceDiagram
participant Runner as migrate.ts
participant Drizzle as drizzle migrate()
participant PG as PostgreSQL
Runner->>Drizzle: migrate(client, { migrationsFolder })
Drizzle->>PG: Apply SQL statements
alt Success
PG-->>Drizzle: OK
Drizzle-->>Runner: resolved
Runner->>Runner: console.log("Migrations applied successfully.")
else Error
PG-->>Drizzle: PostgresError (code, detail, hint, constraint, ...)
Drizzle-->>Runner: throws error
Runner->>Runner: printMigrationError(error)
Note over Runner: Logs message, PG fields,<br/>failing query, cause chain, stack
Runner->>Runner: process.exit(1)
end
Runner->>PG: client.end()
Reviews (1): Last reviewed commit: "improvement(migrations): log better erro..." | Re-trigger Greptile |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const pgFields = [ | ||
| 'code', | ||
| 'severity', | ||
| 'severity_local', | ||
| 'detail', | ||
| 'hint', | ||
| 'schema', | ||
| 'schema_name', | ||
| 'table', | ||
| 'table_name', | ||
| 'column', | ||
| 'column_name', | ||
| 'constraint', | ||
| 'constraint_name', | ||
| 'data_type', | ||
| 'where', | ||
| 'internal_query', | ||
| 'internal_position', | ||
| 'position', | ||
| 'routine', | ||
| 'file', | ||
| 'line', | ||
| ] as const |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Some snake_case field names won't match postgres.js error fields
The postgres (porsager/postgres) driver uses camelCase for several extended error fields. The entries internal_query, internal_position, data_type, and severity_local will never match a property on a PostgresError object — the driver actually exposes internalQuery, internalPosition, dataType, and severityLocal. These fields are silent no-ops today, meaning useful diagnostics (especially internalQuery, which shows the PL/pgSQL statement that failed) are silently dropped.
| const pgFields = [ | |
| 'code', | |
| 'severity', | |
| 'severity_local', | |
| 'detail', | |
| 'hint', | |
| 'schema', | |
| 'schema_name', | |
| 'table', | |
| 'table_name', | |
| 'column', | |
| 'column_name', | |
| 'constraint', | |
| 'constraint_name', | |
| 'data_type', | |
| 'where', | |
| 'internal_query', | |
| 'internal_position', | |
| 'position', | |
| 'routine', | |
| 'file', | |
| 'line', | |
| ] as const | |
| const pgFields = [ | |
| 'code', | |
| 'severity', | |
| 'severityLocal', | |
| 'detail', | |
| 'hint', | |
| 'schema', | |
| 'schemaName', | |
| 'table', | |
| 'tableName', | |
| 'column', | |
| 'columnName', | |
| 'constraint', | |
| 'constraintName', | |
| 'dataType', | |
| 'dataTypeName', | |
| 'where', | |
| 'internalQuery', | |
| 'internalPosition', | |
| 'position', | |
| 'routine', | |
| 'file', | |
| 'line', | |
| ] as const |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
96a3b513
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.