Skip to content

Conversation

@artengin
Copy link
Contributor

@artengin artengin commented Sep 11, 2025

Added a warning that the migration name already exists and included the --check-duplicate option to prevent creating duplicate migrations with the same name, regardless of the timestamp.

Added a check to detect existing migrations and prevent creating duplicates, regardless of the timestamp.
@artengin
Copy link
Contributor Author

Hi 👋
I’ve added a check to prevent creating duplicate migrations.
Now the command will detect existing migrations with the same name (regardless of their timestamp) and stop with an error message.

I hope my contribution will be useful, thank you! 🙏

@shaedrich
Copy link
Contributor

This might work for CREATE migrations but less so for UPDATE ones. This would require verbose naming sometimes.

So if this is considered to be supported, there has to be an opt-in mechanism.

@artengin
Copy link
Contributor Author

Thank you for your attention!
I’ve implemented a check for migrations based on the exact migration name being created.
This means that if you need to create multiple update migrations, for example for the users table, the migration names should not be exactly the same (update_users_table.php). Instead, they should include a bit more detail in the name to avoid any confusion.

For example:

2025_09_11_120000_add_status_to_users_table.php — adds a status column to users.
2025_09_11_121500_add_profile_picture_to_users_table.php — adds a profile_picture column for user avatars.

This way, each migration clearly describes the specific change it introduces.

Thanks again for your time and review! 🙏

@shaedrich
Copy link
Contributor

Is that for you to decide?

Just make it a warning and let people decide themselves what works best for them.

@artengin
Copy link
Contributor Author

Thanks for your review and guidance. I’ve made all the updates and hope I got it right.

@shaedrich
Copy link
Contributor

Looks good—thanks 👍🏻

@artengin
Copy link
Contributor Author

artengin commented Sep 12, 2025

Hi! 😊
Would you mind sharing why my code might not be the best fit?
It would really help me understand and improve.
Thanks a lot!

@browner12
Copy link
Contributor

there's not necessarily anything wrong with the code, usually means he doesn't want this feature in the framework.

@artengin
Copy link
Contributor Author

Got it, thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants