Is it possible to truffle migrate only one specific file?

I found this on the internet: https://github.com/trufflesuite/truffle-migrate/issues/23

but truffle migrate -from 2 starts to migrate from file 2_... and goes then to the next. My goal is to migrate only file 2_...

  • 1
    In the issue you're linking, people are also mentioning a --to parameter. Did you try -f 2 --to 2? It worked for me. – ivicaa Apr 24 '18 at 17:55
  • @ivicaa Sorry my bad, I miss read this. Thanks a lot for your help - its working :) Just another question: when I run truffle migrate for file 3_... and this deploy fails - how can I retry only this deploy 3_... again? Because it says "network is up to date" but the transaction failed and isnt even visible on rinkeby network. When I use --reset it starts to deploy again all files. – fabem Apr 27 '18 at 12:52
  • Did you try to add the --reset prameter? – ivicaa Apr 27 '18 at 12:53
  • yes, with --reset its working but he is going to deploy then all files again and my goal is to redeploy only one file after its somehow failed. I just had this situation on rinkeby: I ran truffle migrate 3_... it contains 2 SC, one he deployed fine the second one ran into a problem (I think it was a problem of rinkeby network). I saw on my geth node that it received the deploy transaction but it didnt arrive to rinkeby network – fabem Apr 27 '18 at 14:07
  • the console log of this situation: pastebin.com/DB6whBTH and when I retried to deploy it again it said network is up to date. But obviously it ran into a problem. The only help in this situation was --reset and rename all other migration files to x_... so he did deploy only 3_... I am just not sure if this was the best solution :p – fabem Apr 27 '18 at 14:16

Use the flag -f for the first migration and --to for the last migration like this:

truffle migrate -f 2 --to 2

Source: https://github.com/trufflesuite/truffle-migrate/issues/23#issuecomment-401290273

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.