1

I have a very weird behavior happening whenever I run "truffle migrate". Ideally, as per the documentation, it states:

This will run all migrations located within your project's migrations directory. At their simplest, migrations are simply a set of managed deployment scripts. If your migrations were previously run successfully, truffle migrate will start execution from the last migration that ran, running only newly created migrations. If no new migrations exist, truffle migrate won't perform any action at all

But for me, on the contrary, it's running all migration every time i.e. starting from 1_initial_migration till the last migration file I have. I am using Ganache for local testing. Is it something related to the code setup or am I missing anything important that needs to be done for migration.

Output of running truffle migrate:

Using network 'development'.

Running migration: 1_initial_migration.js   Replacing Migrations...   
...0xf698fa2021847daaef0cedfc008976fbcc499eafc6f9c1eac6cc011faca77593 
Migrations: 0xecfcab0a285d3380e488a39b4bb21e777f8a4eac Saving 
successful migration to network...   ... 
0x64df98e7d3f1cf5dc7eaa5264011714bf49802d9fda56003e202434903c2581b 
Saving artifacts... Running migration: 
2_factory_name_registry_migration.js   
Didn't deploy FactoryNameRegistry; using 
0x345ca3e014aaf5dca488057592ee47305d9b3e10  
...0x0f90f0c9086735cd74a83b30f597fa5363764eb8920d5ae0b47cb6b3267be627 
Saving successful migration to network...   ... 
0xf048fc893066a845ec584920ab57630b213db48a619e85fc12f8d3e966fb3525   
...0x81a7a0b188eadb39e207bd22fb3598830d166beb6b3f3bc7852f73dd303af6ef 
Saving artifacts...

Edit: this is happening without restarting Ganache, as I do understand restarting the server will cause this behaviour to happen naturally

  • the documentation says it will run all migrations from your migration folder. that is exactly what the truffle migrate command is doing. there is not problem here. – Kaki Master Of Time Apr 23 '18 at 10:23
  • you are skipping later part of the statment that says: If your migrations were previously run successfully, truffle migrate will start execution from the last migration that was ran, running only newly created migrations. If no new migrations exists, truffle migrate won't perform any action at all – Shuja Ahmed Apr 23 '18 at 10:24
  • when migrating, truffle reads a network version from its deployed migration contract, if version has not changed truffle will not save the contracts to the network ( send transaction ). in your case it is saving its migration contract and the contract you have just changed. as you can see one of your contracts was not deployed to the network since you didn't change anything in it. – Kaki Master Of Time Apr 23 '18 at 10:28
  • yes, I am aware of it, and that's the thing I am not changing anything on any contract. I am just running truffle migrate successively and it runs all migration file. The reason it's not running the one you are referring to is that with that particular Contract I am using {overwrite: false} in 2_factory_name_registry_migration.js – Shuja Ahmed Apr 23 '18 at 10:31
  • 1
    It is probably a problem with the migration contract, maybe you edited it or something. – Kaki Master Of Time Apr 23 '18 at 10:45

Your Answer

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

Browse other questions tagged or ask your own question.