Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider collision avoidance on create #2324

Closed
dereuromark opened this issue Nov 26, 2024 · 3 comments · Fixed by #2325
Closed

Consider collision avoidance on create #2324

dereuromark opened this issue Nov 26, 2024 · 3 comments · Fixed by #2325

Comments

@dereuromark
Copy link
Member

https://github.com/cakephp/phinx/blob/0.x/src/Phinx/Console/Command/Create.php
You could apply sth similar here we currently evaluate for Migrations:
cakephp/migrations#773

When you generate multiple ones, this will otherwise create exceptions when reading/using.

@MasterOdin
Copy link
Member

Interesting bug, not sure how often it'd come up before now. I think that my preferred solution would be to take the timestamp, and if there's an existing one, then just increment it by 1 until we hit a timestamp that's valid. This would be BC, and that I don't think anyone really cares about the timestamp prefix value beyond it just enforcing the right numerical order of files in the file tree / migration list.

@dereuromark
Copy link
Member Author

Isnt that exactly how I fixed it in the linked PR? :)

@MasterOdin
Copy link
Member

Hah, for some reason I swear I thought that your PR was appending an incrementing ## to the end of the timestamp if there was a collision. My bad, yeah, that looks pretty perfect to port into phinx as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants