Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrator class doesn't allow specifying a schema to put migration tables #80

Closed
DanielFGray opened this issue Apr 16, 2022 · 7 comments
Closed
Labels
api Related to library's API enhancement New feature or request postgres Related to PostgreSQL

Comments

@DanielFGray
Copy link

DanielFGray commented Apr 16, 2022

It would be really nice if users could specify a schema to put the kysely_migration tables in (at least when using postgres I'm not sure how it would translate in other databases)

If this is already an existing feature I couldn't find it in the docs..

@koskimas
Copy link
Member

So kysely should also create the schema right? Or can we expect it to exist?

@DanielFGray
Copy link
Author

Great question. create schema if not exists would make sense to me, and I can't think of any reason why this wouldn't be desirable, except if you typo'd the schema name

@koskimas
Copy link
Member

You can specify the schema like this

new Migrator({
  migrationTableSchema: 'some_schema'
})

in the next version.

@koskimas
Copy link
Member

Released in 0.18.1

@igalklebanov igalklebanov added enhancement New feature or request postgres Related to PostgreSQL api Related to library's API labels Oct 11, 2022
@Marko351
Copy link

Is there any implementation available for MSSQL?

@rafaelbsky
Copy link

I'm having an issue where, even though I did:

new Migrator({
  migrationTableSchema: 'my_schema'
})

it creates the 2 kysely tables (migrations and lock) in the correct schema I specified but still creates the migration tables in the public schema.

@koskimas
Copy link
Member

@rafaelbsky that's what it's supposed to do. migrationTableSchema === "Schema for the migration tables". Not for your own tables.

You can bind your Kysely instance you give to Migrator to the schema using db.withSchema('my_schema') https://kysely-org.github.io/kysely-apidoc/classes/QueryCreator.html#withSchema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API enhancement New feature or request postgres Related to PostgreSQL
Projects
None yet
Development

No branches or pull requests

5 participants