I’m trying to set up an integration test and need to migrate the db to the latest but got this error:
const orm = await MikroORM.init(options);
await orm.getMigrator().up(); // this line cause the error
TypeError: The "path" argument must be of type string. Received undefined
The db I used is pgmock: https://github.com/stack-auth/pgmock
Initially I think, maybe I’m missing path property in options, so I console.log it, and here it is:
{
driver: [class PostgreSqlDriver extends AbstractSqlDriver],
clientUrl: 'postgresql://postgres:pgmock@localhost:12345',
logger: [Function: bound ],
extensions: [ [class Migrator], [class EntityGenerator] ],
discovery: { warnWhenNoEntities: false },
migrations: { path: 'src/migrations' },
entities: [
// ... (my entities)
],
colors: true,
dynamicImportProvider: [Function (anonymous)]
}
The path property is there, so I try this with a real postgres db instance in docker and it work.
So I think it’s not the problem with the path, it’s the problem with the db.
But the error message still seems incorrect.
Now, get back to the db that give me the error.
If I skip the migration part and try to connect to db to query stuffs, I got this error:
const length = (await orm.em.fork().findAll(MyEntity)).length;
TableNotFoundException: select "p0".* from "MyEntity" as "p0" - relation "MyEntity" does not exist
Which mean Mikro ORM is able to connect to the database, but not sure why migration doesn’t work.
I don’t know where to go from here since I have no clue what went wrong, Mikro ORM itself or the ORM config, ENV etc … .
Thank you.