Typeorm not detecting any pending migrations

17 Views Asked by At

I am able to generate migrations properly, but I am having issues running the migrations, here is the output from the command.

> npx typeorm-ts-node-commonjs migration:run -d database.config.ts

query: SELECT VERSION() AS `version`
query: SELECT * FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = 'Spotify_Playlist_Showcase_Dev' AND `TABLE_NAME` = 'migrations'
query: SELECT * FROM `Spotify_Playlist_Showcase_Dev`.`migrations` `migrations` ORDER BY `id` DESC
No migrations are pending

My datasource options are below, in the root directory of the project.

export const dataSourceConfig: DataSourceOptions = {
    type: 'mysql',
    host: process.env.DATABASE_HOST,
    port: parseInt(process.env.DATABASE_PORT, 10),
    username: process.env.DATABASE_USERNAME,
    password: process.env.DATABASE_PASSWORD,
    database: process.env.DATABASE_NAME,
    entities: ['src/**/entities/*.entity.{js, ts}'],
    migrationsTableName: 'migrations',
    migrations: ['src/migrations/*.ts'],
    synchronize: false,
    logging: false
}

I have tried changing the datasource options to look in the dist/migrations directory, and I get the same result.

The migrations table exists in my database, but is an empty set. From what I understand, the migrations table is only a record of what migrations have already been ran, so I don't think this is the culprit.

I feel like I've tried everything to get this to work and would appreciate some help on this.

0

There are 0 best solutions below