You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using comment in @Property annotations for a postgresql database, the generated SQL only uses the table name, and not the fully qualified schema name and table name (e.g. comment on "table_name"."column_name" is \'hello world\'; instead of comment on "schema_name"."table_name"."column_name" is \'hello world\';). This causes migrations to fail when the schema is not public
Stack trace
example of a migration when comment is used on an entity property.
MigrationError: Migration Migration20230307174746 (up) failed: Original error: comment on column "table_name"."column_name" is 'Hello world'; - relation "table_name" does not exist
at /Users/yeedle/project/node_modules/umzug/src/umzug.ts:259:12
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Umzug.runCommand (/Users/yeedle/project/node_modules/umzug/src/umzug.ts:208:11)
at async Migrator.runInTransaction (/Users/yeedle/project/node_modules/@mikro-orm/migrations/Migrator.js:299:21)
at async PostgreSqlConnection.transactional (/Users/yeedle/project/node_modules/@mikro-orm/knex/AbstractSqlConnection.js:36:25)
at async Function.handleFreshCommand (/Users/yeedle/project/node_modules/@mikro-orm/cli/commands/MigrationCommandFactory.js:153:9)
at async Function.handleMigrationCommand (/Users/yeedle/project/node_modules/@mikro-orm/cli/commands/MigrationCommandFactory.js:88:17) {
cause: TableNotFoundException: comment on column "table_name"."column_name" is 'Hello world'; - relation "table_name" does not exist
To Reproduce
Steps to reproduce the behavior:
Add a comment to an entity @Property
run migration:create
run migration:up
Expected behavior
Generated SQL should include the table schema so that migrations succeed
Additional context
I'm happy to make a PR fixing this issue for Postgresql.
Versions
Dependency
Version
node
16.14.2
typescript
1.22.15
mikro-orm
5.6.8
your-driver
PostgreSQL
The text was updated successfully, but these errors were encountered:
Sounds about right. Do you mind if I open a PR with a fix for this (my approach would be to pass in tableSchema as an optional arg set to null by default, and use it in PostgreSqlSchemaHelper.ts for getChangeColumnSet and getAlterColumnAutoIncrement) ?
Describe the bug
When using
comment
in@Property
annotations for a postgresql database, the generated SQL only uses the table name, and not the fully qualified schema name and table name (e.g.comment on "table_name"."column_name" is \'hello world\';
instead ofcomment on "schema_name"."table_name"."column_name" is \'hello world\';
). This causes migrations to fail when the schema is not publicStack trace
example of a migration when
comment
is used on an entity property.To Reproduce
Steps to reproduce the behavior:
comment
to an entity@Property
migration:create
migration:up
Expected behavior
Generated SQL should include the table schema so that migrations succeed
Additional context
I'm happy to make a PR fixing this issue for Postgresql.
Versions
The text was updated successfully, but these errors were encountered: