2016-07-14 23:01
浏览 88


I'm discovering Symfony and Doctrine. I was able to generate a file containing a class for my migration using

php bin/console doctrine:migrations:diff

It's great but the name of my file (and my class) is : Version20160714233422.

It's not really understable (even though it's the date) and I would like to call it Version1 for example.

I guess it would be possible to change manually the names but is there a way to do it automatically ?

I looked on the help :

php bin/console doctrine:migrations:diff --help

but this feature doesn't seems to be implemented. Am I wrong ?

Is there a reason it's not possible ? Does setting a code like 0.1, 0.2... is a bad idea ?

If someone could explain this to me it would be very much appreciated !

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douqin231881 2016-07-15 09:33

    Well I guess you would like to use a subversion repository. Lets see why the version name is generated as a timestamp in format Ymdhis there is a small chance that two developers working on the same project will generate the migration in exact same second. Which would resolve in conflict state.

    On the other hand, sequential naming would resolve in conflict states very often. Two developers have the branch from master and both see last migration version Version20. They both decide to create new migration with name Version21.

    That is why the migrations is generated with the timestamp name. If you want to change it you have to do it manually.

    解决 无用
    打赏 举报

相关推荐 更多相似问题