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

Multiple schema support or tricks #818

Open
1 of 3 tasks
legithubdeaymeric opened this issue May 17, 2023 · 1 comment
Open
1 of 3 tasks

Multiple schema support or tricks #818

legithubdeaymeric opened this issue May 17, 2023 · 1 comment

Comments

@legithubdeaymeric
Copy link

I'm submitting a...

  • Bug report
  • Feature request
  • Question

Current behavior

Good morning

Quick question.
Is there a way to manipulate tables other than the default schema.

for example I would like to create a table in several schemas

db.createTable('OTHER_SCHEMA.table', { id: { type: 'int', primaryKey: true }, name: 'string' });

Thanks !

Environment


db-migrate version: 0.11.13
db-migrate-pg with versions: 1.3.0
@wzrdtales
Copy link
Member

wzrdtales commented May 17, 2023

not officially supported. You can have multiple scopes: https://db-migrate.readthedocs.io/en/latest/Getting%20Started/commands/#scoping . Scopes have db switching support.

https://github.com/db-migrate/pg/blob/b64a02aefff39af750099c5c57bb74ab47937d05/index.js#L128
This is the relevant endpoint, for pg you can actually only switch the schema not the database. Which is due to this method also theoretically callable from the driver and the non guarantee of being able to switch the db on the same connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants