I'm trying to generate migrations with TypeOrm. When I change an entity, it should detect this change and generate a new migration.
I get the following error message:
No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command
Why am I getting this error message when I changed something in my entities files?
I'm using this command to run TypeOrm:
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config src/typeormConfig.ts",
This is my typeormConfig.ts file:
import { ConnectionOptions } from "typeorm";
import * as path from "path";
import * as dotEnv from 'dotenv'
console.log(path.resolve(__dirname, 'entity/**.entity.ts'))
const result = dotEnv.config({ path: './ormconfig.env' });
if (result.error) {
throw result.error
}
const config: ConnectionOptions = {
type: 'mysql',
host: process.env.TYPEORM_HOST,
port: +process.env.TYPEORM_PORT,
username: process.env.TYPEORM_USERNAME,
password: process.env.TYPEORM_PASSWORD,
database: process.env.TYPEORM_DATABASE,
//synchronize: true,
synchronize: false,
// migrationsRun: false,
entities: [path.resolve(__dirname, 'entity/**.entity.*')],
migrations: [path.resolve(__dirname, 'migration/**')],
cli: {
entitiesDir: "src/entity",
migrationsDir: "src/migration"
}
}
export default config;
export default configbyexport = config? - Diogo Domanski