TypeORM migrations Cannot detect the relation changes

Viewed 466

I have a problem with generating migrations.

I tried to change the relation between entity, but I got an error

No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command
error Command failed with exit code 1.

I also got the same error when I change the column / attribute type. However, it will detect changes (and migration file will be created) if I modify the name of column / remove it.

Here is the connection options

const connectionOptions: ConnectionOptions = {
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: configuration().ENV === CONFIG_DEFAULTS.ENV ? process.env.usr : '',
  password: configuration().ENV === CONFIG_DEFAULTS.ENV ? process.env.pwd : '',
  database: 'cave',
  entities: [__dirname + '/../**/*.entity{.ts,.js}'],
  synchronize: configuration().ENV === CONFIG_DEFAULTS.ENV ? true : false,
  migrationsRun: true,
  logging: ['warn', 'error'],
  migrationsTableName: 'migrationsData',
  migrations: [__dirname + 'migration/*{.ts/.js}'],
  cli: {
    migrationsDir: 'src/migrations',
  },
};

export default connectionOptions;

how to make TypeORM can detect the relation changes ?

Thank you in advance

0 Answers
Related