Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
NPM TypeORM - "Error: Duplicate migrations" after modifying/deleting migration file

I previously add a column to an existing table using, npm run migration:generate <filename>.

However, I later realized that I misspelled the column name so I wanted to rename the column. (showComission -> showCommission)

Since it was just in a local environment, I modified the column name on the migration file and run npm run migration:run.

The duplicated migration error occurred and here's the log.

**addShowCommissionToCorporationProfile1643792138368 is the modified export class name.

typeorm migration:run

query: SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'abc' AND TABLE_NAME = 'migrations'

query: SELECT * FROM abc.migrations migrations ORDER BY id DESC

Error during migration run:
Error: Duplicate migrations: addShowCommissionToCorporationProfile1643792138368

at MigrationExecutor.checkForDuplicateMigrations
at MigrationExecutor.getMigrations
at MigrationExecutor.<anonymous> 
at step 
at Object.next 
at fulfilled 
at processTicksAndRejections npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! abc-api@1.0.0 migration:run: `typeorm migration:run`

npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the abc-api@1.0.0 migration:run script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

After that I try to revert npm run migration:revert, but the exact same error occurred. So instead, I changed the migration file back to its initial state and use npm run migration:generate --filename to create migration file for renaming the column but the same error stills occurred. Lastly, I deleted newly created migration file and run only the original migration file (initial state) and run migration again, but the same error stills occurred.

Can anyone advise me how could I fixed this mess?

I just wanted to rename the column...

Please let me know if you need any additional info or more clarification about the situation.

Appreciate all your helps.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I exec npm run build and the problem solved.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!