Skip to content

Commit

Permalink
fix(migrations): allow generating named initial migration
Browse files Browse the repository at this point in the history
Closes #4271
  • Loading branch information
B4nan committed Apr 25, 2023
1 parent d2d9cc0 commit 01d6a39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/migrations/src/Migrator.ts
Expand Up @@ -49,7 +49,7 @@ export class Migrator implements IMigrator {
*/
async createMigration(path?: string, blank = false, initial = false, name?: string): Promise<MigrationResult> {
if (initial) {
return this.createInitialMigration(path);
return this.createInitialMigration(path, name);
}

await this.ensureMigrationsDirExists();
Expand Down Expand Up @@ -77,12 +77,12 @@ export class Migrator implements IMigrator {
/**
* @inheritDoc
*/
async createInitialMigration(path?: string): Promise<MigrationResult> {
async createInitialMigration(path?: string, name?: string): Promise<MigrationResult> {
await this.ensureMigrationsDirExists();
const schemaExists = await this.validateInitialMigration();
const diff = await this.getSchemaDiff(false, true);
await this.storeCurrentSchema();
const migration = await this.generator.generate(diff, path);
const migration = await this.generator.generate(diff, path, name);

if (schemaExists) {
await this.storage.logMigration({ name: migration[1], context: null });
Expand Down

0 comments on commit 01d6a39

Please sign in to comment.