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
Apply DB migration via the serverpod CLI command #3119
Today DB migrations are applied using the server runtime. But DB migrations are often better to run as a deployment step that is handled separately from actual server start.
Proposal
Refactor the apply migrations logic in Serverpod server for reusability from the serverpod command, and add support for running it there.
(Issue #3118 is not strictly a prerequisite but would make using this command easier.)
Use Case
As a user, I'd like to be able to run it as an operation that stands alone from the server, via the serverpod CLI command.
Alternatives
An alternative could be to add a distinct subcommand to Serverpod server that effectively corresponds to the command line:
$ dart run bin/main.dart --role maintenance --apply-migrations
Could you elaborate more?
It seems to me that every time you apply migration you also need to deploy the new server app anyway so you might as well apply migrations when the new server is deployed and launched like it works now.
By separating the two you'd need to manually do 2 steps instead of one and if one fails you'd have a database with incompatible server or a server with incompatible database.
Activity
KristijanZic commentedon Jan 16, 2025
Could you elaborate more?
It seems to me that every time you apply migration you also need to deploy the new server app anyway so you might as well apply migrations when the new server is deployed and launched like it works now.
By separating the two you'd need to manually do 2 steps instead of one and if one fails you'd have a database with incompatible server or a server with incompatible database.
Could you expand a bit?