Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wesmahler's avatar

Migration Best Practices Question

When you deploy to a production environment and run a migrate command. If you want to ever update the tables, do you always just make new migration files everytime you want to do a schema change? It seems like then it’s really hard to see what the actual schema is because there would be hundreds of migration files for a single table if you’ve made changes over time. But do you just create a new migration file every time, to make sure the production database is aligned with the development?

Or do you ever just tweak a migration file, not run it on production, and just ALTER TABLE on the production database?

0 likes
1 reply
tykus's avatar
tykus
Best Answer
Level 104

In development, try to change the original migration for the table as your project progresses; thereafter, once project has been deployed, your ongoing migration should deal with the totality of schema change rather than instantaneous changes within a feature.

2 likes

Please or to participate in this conversation.