Typeorm migration:create ignores migrationsDir from the config

Viewed 468

Based on configuration, I expect migrations to be created inside migrations folder in the root of the project. But no matter what I do typeorm migration:create -n Test creates a file in the root folder and not in the migrations folder.

At some point I tried passing -c ormconfig.js and --config ormconfig.js as arguments, but the result is the same.

I also tried changing the folder, and passing the migration folder that was created by running typeorm init command inside the src folder, but it was also ignored.

This is my ormconfig.js configuration:

const { join } = require('path');

require('dotenv-safe').load({
  allowEmptyValues: false,
  path: join(__dirname, '.env'),
  sample: join(__dirname, '.env.example'),
});

module.exports = {
  cli: { migrationsDir: 'migrations' },
  entities: ['./build/entities/*.js'],
  logging: 'all',
  migrations: ['./migrations/*.ts'],
  type: 'postgres',
  url: process.env.POSTGRES_URL,
};

And folder structure:

enter image description here

0 Answers
Related