We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would like to migrate both dev and test database at the same time but I can't figure out a way to make it work. Here is my take:
import * as path from 'path'; import { promises as fs } from 'fs'; import { Pool } from 'pg'; import { Kysely, Migrator, PostgresDialect, FileMigrationProvider } from 'kysely'; import { run } from 'kysely-migration-cli'; const migrationFolder = path.join(__dirname, './migrations'); if (!!process.env.DATABASE_URL) { const db = new Kysely<any>({ dialect: new PostgresDialect({ pool: new Pool({ connectionString: process.env.DATABASE_URL, }), }), }); const migrator = new Migrator({ db, provider: new FileMigrationProvider({ fs, path, migrationFolder, }), }); console.log('Running development migrations...'); run(db, migrator, migrationFolder); db.destroy(); } else { console.log('No dev database url. Skipping...'); } if (!!process.env.TEST_DATABASE_URL) { const test_db = new Kysely<any>({ dialect: new PostgresDialect({ pool: new Pool({ connectionString: process.env.TEST_DATABASE_URL, }), }), }); const test_migrator = new Migrator({ db: test_db, provider: new FileMigrationProvider({ fs, path, migrationFolder, }), }); console.log('Running test migrations...'); run(test_db, test_migrator, migrationFolder); test_db.destroy(); } else { console.log('No test database. Skipping...'); }
It does run twice but always on the first database, not the second. Is there a way to do this ? Thanks !
The text was updated successfully, but these errors were encountered:
@Tyflomate Thanks for reporting.
It seems that commander.js re-use the default instance. We need to refactor the code to create commander instance every time!
Related:
parse()
parseAsync()
Sorry, something went wrong.
To resolve this issue, we need to change our architecture entirely - meaning v1.
#26
Successfully merging a pull request may close this issue.
I would like to migrate both dev and test database at the same time but I can't figure out a way to make it work. Here is my take:
It does run twice but always on the first database, not the second. Is there a way to do this ? Thanks !
The text was updated successfully, but these errors were encountered: