kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
10.8k stars 275 forks source link

Add a way to access the migrator schema in the migration (or to prefix the schema to types) #1268

Closed jroitgrund closed 3 hours ago

jroitgrund commented 3 hours ago

Since creating enums uses raw SQL, it doesn't benefit from the migrator schema or the withSchema schema.

This means that CREATE TYPE foo in a migration ends up creating public.foo, even if migratorSchema is set to something else than public.

Is there a way to access the schema name at migration time?

jroitgrund commented 3 hours ago

Hadn't seen db.schema.createType, sorry!