I can't, for the life of me, find documentation on how to handle migrations using Google App Engine and CloudSQL.I am using the Go runtime.
Clearly an application's schema will change and evolve as time goes by, and migrations will need to be run. Currently I run the migrations by hand. This is not scalable.
Is there anyone who has a solution?
I see some specific challenges:
I can get the version of the current
app.yaml
deployed version using VersionID. However, how do I check if a migration happened for this version? I would have to keep a version number in a db table and check against that in theinit()
function?However, when you upload a new version of the app, with the new schema GAE will slowly migrate your traffic which means once the first instance of
init()
in your new version runs, and the migration completes, traffic to the old version will fail in those db transactions.I could somewhat mitigate the issue above by versioning my API. But this limits the migration strategies, such as dropping tables, etc.
Lastly, I am disappointed there is no documentation on this as far as I can tell.