了解迁移脚本

Understanding migration script

假设我使用迁移脚本 2_deploy_contract.js 成功部署了 contract.sol 。后来合同有变,怎么办?

  1. contract.sol 中的更改和重新 运行 truffle 迁移了吗?
  2. 不修改 contract.sol,而是克隆新文件 contract2.sol 和 3_deploy_contract2.js 以及 运行 迁移?

根据解释,松露迁移实际上是:

Migrations contract stores the number of the last deployment script applied. Truffle will not run those scripts again. On the other hand, in the future, your app may need to have a modified, or new, contract deployed. For that to happen, you create a new script with an increased number that describes the steps that need to take place. Then, again, after they have run once, they will not run again.

https://ethereum.stackexchange.com/questions/8299/what-are-truffle-migrations

我想说的是,在您更改某些内容后,您必须编写新的迁移。