Skip to content

Commit

Permalink
Fix behavior of keystone start --with-migrations (keystonejs#8354)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Calder <josh@opensaas.com.au>
  • Loading branch information
acburdine and borisno2 authored Mar 2, 2023
1 parent f4d4f5c commit c3ce0da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-keys-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': patch
---

Fixes behavior of `keystone start --with-migrations`
4 changes: 2 additions & 2 deletions packages/core/src/lib/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ function logWarnings(warnings: string[]) {
}
}

export async function deployMigrations(dbUrl: string) {
return withMigrate(process.cwd(), async migrate => {
export async function deployMigrations(schemaPath: string, dbUrl: string) {
return withMigrate(schemaPath, async migrate => {
const before = Date.now();
const migration = await runMigrateWithDbUrl(dbUrl, undefined, () => migrate.applyMigrations());
if (migration.appliedMigrationNames.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/scripts/run/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const start = async (
await keystone.connect();
if (withMigrations) {
console.log('✨ Applying database migrations');
await deployMigrations(config.db.url);
await deployMigrations(paths.schema.prisma, config.db.url);
}

console.log('✨ Creating server');
Expand Down

0 comments on commit c3ce0da

Please sign in to comment.