Replies: 4 comments 4 replies
-
I see that you're using postgres 14 |
Beta Was this translation helpful? Give feedback.
-
I don't agree this should be somehow automatically handled by the ORM. I am open for adding some hooks to schema generator so you can do it yourself. Note that you enabled the extension inside a migration - that is a different level, above schema generator. We can't track what migrations are doing from a context of schema generator, the dependency is in opposite direction. |
Beta Was this translation helpful? Give feedback.
-
This may differ between databases, but at least in the Postgres world enabled extensions are conceptually part of the database's schema. If you run |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? Any way to add the CREATE EXTENSION line on the initial migration programatically through mikroOrm? |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I'm using
orm.getSchemaGenerator().refreshDatabase()
against a test database within my test suite to ensure I have an up-to-date version of the database available for end-to-end tests.Unfortunately, since some of my models rely on Postgres extensions and the schema generator doesn't appear to detect or re-apply the required extensions, this call fails. An example failure is below.
Stack trace
To Reproduce
User
model relies on the popular "uuid-ossp" extension:yarn run mikro-orm migration:create --initial
this.addSql('CREATE EXTENSION "uuid-ossp";')
).yarn run mikro-orm migration:up
orm.getSchemaGenerator().refreshDatabase()
to abeforeAll
hook.Expected behavior
refreshDatabase()
should track the enabled extensions in a database and re-enable them once it has been refreshed and before applying the rest of the schema.Versions
Beta Was this translation helpful? Give feedback.
All reactions