tj / node-migrate

Abstract migration framework for node
MIT License
1.53k stars 221 forks source link

How we can delete old migration from NodeJS migrate? #192

Closed stackprogramer closed 2 years ago

stackprogramer commented 2 years ago

How we can delete old migration from NodeJS migrate? how can I delete old migrations? I can not any command for this operation when I delete the migration file manually I am faced with these errors...

 error : Error: Missing migration file: 1648642524660-add-pets.js
Error: Missing migration file: 1648642524660-add-pets.js
    at /home/sp/.nvm/versions/node/v16.13.2/lib/node_modules/migrate/lib/load-migrations.js:57:44
    at Array.forEach (<anonymous>)
    at /home/sp/.nvm/versions/node/v16.13.2/lib/node_modules/migrate/lib/load-migrations.js:55:44
    at FSReqCallback.oncomplete (node:fs:188:23)
stackprogramer commented 2 years ago

Finally, I found the solution, in the root directory that there is a file package.json, There is a hi dden file .migrate , you should delete the old migration file from the migration folder and file .migrate from root directory...

sp@sp:~/Documents/express$ ls -a . index.js '.migrate (copy)' node_modules package-lock.json .. .migrate migrations package.json

Now run the command: migrate Now new migration will be updated and everything works... Good luck