migrations doesnt run even after doing everything
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
I am working on a project with typeorm on nestjs. the problem is even after running mgration after generating migration files, i get No migrations are pending
The commands i am using are
"typeorm": "NODE_ENV=dev ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config src/config/typeorm.config.ts",
"typeorm:migrate": "npm run typeorm migration:generate -- -n",
"typeorm:run": "npm run typeorm migration:run"
I am doing
npm run typeorm:migrate test
npm run typeorm:run
BTW: my ormconfig looks like this
import config from '@config/index';
import { join } from 'path';
import { ConnectionOptions } from 'typeorm';
const typeormConfig: ConnectionOptions = {
type: 'postgres',
host: config.db.host,
port: config.db.port,
logging: ['error'],
username: config.db.username,
password: config.db.password,
database: config.db.database,
entities: [join(__dirname, '../entities/**{.ts,.js}')],
synchronize: false,
migrations: ['migrations/**/*{.ts,.js}'],
cli: {
migrationsDir: 'migration',
},
};
export = typeormConfig;
Issue Analytics
- State:
- Created 4 years ago
- Comments:33 (2 by maintainers)
Top Results From Across the Web
TypeORM: "No migrations pending" when attempting to run ...
I have a new web app and I've written a migrator to create a user table. However, no matter what I try, typeorm...
Read more >Migration troubleshooting in development - Prisma
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database.
Read more >Troubleshoot the data migration service - Google Support
For details on using a search operator, go to Search operators you can use with Gmail. If the message can't be found in...
Read more >Troubleshooting Migration Manager - Microsoft 365
Verify that the Windows account associated with the agent has read ... The CSV file used to do bulk migration cannot have duplicate...
Read more >Use the Jira Cloud Migration Assistant to migrate
It won't delete anything from either your Server or Cloud sites. ... After you agree to app migration, you can still select Revoke...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This
No migrations are pending
means that somewhere in the migration table it says that you have already run the migration for your migration file. Follow this steps:dist
folder (Just to make sure you dont get anDuplicated migration
error).migration
table.Hope this solves you problem.
This is what I am using as the ormconfig.ts
From this we started using dotenv as well for configuration with a file kinda like this:
One tip that isn’t immediately obvious if you are using dotenv and use any of the typeorm default env variables like these:
The cli will use those over the top of your ormconfig.ts for whatever reason so if that is not the behaviour you want then you need to alter your .env.
If you are wondering what that database-index.ts thing we have going on is it is (simplified):