You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Proposal] Migration "definition" files should be synthetic #4539
Migrations are tricky, especially if two developers are working on different ones concurrently and land them out of order. Consider Branch A and Branch B, both of which add a migration. If Branch B lands first, Branch A's definition files now lack knowledge of Branch B's migration's changes.
Branch A is now faced with difficult resolution options or leaving incomplete and misleading "definition" files in the codebase.
Proposal
Database schema "definition" files should be generated on the fly whenever the system needs them and should not be source controlled artifacts.
Because the serverpod create-migration command can produce these definition files in (what seems to be) several hundred milliseconds, their generation could probably be deferred until such time as they are read.
Use Case
See the Branch A and Branch B scenario above.
Alternatives
The primary alternative would be to leave the system how it is.
Additional context
❤️
How experienced are you with this library?
Intermediate - Familiar with the basics or have used it in a few projects
@t-kietzmann Does this mean every developer runs the create-migration command as needed after a git pull introduces a different branch's new models? That seems like a reasonable workaround, but also I think suggests that these definition files should always be generated on-demand. If they were, I imagine you wouldn't feel a need to do that.
@craiglabenz I'd like to quickly answer your question: yes, that's exactly how we do it. We had many problems/conflicts in the beginning (a very long time ago) when several developers worked on the same project (and modules), but since we've been doing it this way, everything runs smoothly.
Activity
t-kietzmann commentedon Jan 7, 2026
We are not pushing any migrations to GitHub. Every dev has its own local migrations.
We have something like a "deploy branch" in our pipeline which has its own migrations then. Maybe this approach helps.
craiglabenz commentedon Jan 7, 2026
@t-kietzmann Does this mean every developer runs the
create-migrationcommand as needed after agit pullintroduces a different branch's new models? That seems like a reasonable workaround, but also I think suggests that these definition files should always be generated on-demand. If they were, I imagine you wouldn't feel a need to do that.craiglabenz commentedon Jan 7, 2026
Closing as dupe of #4503.
t-kietzmann commentedon Jan 7, 2026
@craiglabenz I'd like to quickly answer your question: yes, that's exactly how we do it. We had many problems/conflicts in the beginning (a very long time ago) when several developers worked on the same project (and modules), but since we've been doing it this way, everything runs smoothly.