-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Description
Describe the bug
With the recent upgrade from v6.0 to v6.5, migrations that use knex alter operation on existing columns is failing with message:
MigrationError: Migration my-migration (up) failed: Original error: Cannot read properties of undefined (reading 'get')
The migration in question
export class MyMigration extends Migration {
async up(): Promise<void> {
await this.ctx!.schema.alterTable(TABLE_NAME, function (table) {
table.string('id', 255).alter();
});
}
async down(): Promise<void> {
await this.ctx!.schema.alterTable(TABLE_NAME, function (table) {
table.string('id', 500).alter();
});
}
}The workaround is to use raw alter queries via addSql, however we have used previous pattern extensively for our migrations so refactor is high effort for us right now.
The knex documentation is on older v2.5 version and from changelog, I'm unable to figure out what has changed or what the proper syntax is for alter in newer knex versions.
Reproduction
https://github.com/RoccoCocco/mikro-orm-migration-up-reproduction
What driver are you using?
@mikro-orm/postgresql
MikroORM version
6.5.9
Node.js version
18.20.8
Operating system
MacOS/Linux
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
No labels