Skip to content

Database Migrations

Stephen Yeargin edited this page Oct 29, 2021 · 2 revisions

Unlike some platforms, Google App Engine Standard does not have the ability to run an arbitrary command on a given running instance (such as a database migration). The solution is to run migrations by passing in a configuration setting to the Doctrine script.

Add credentials for target

Use this this file to save the connection information, removing the .dist extension. Note that the naming of the file is relevant to how you define the target later in the process.

Connect to target via SQL Cloud Proxy

cloud_sql_proxy -dir=./ -instances=<instance name>:us-central1:<database name>tcp:<available port>

Verify migration connection

This should show that there is one or more pending migrations.

MIGRATION_TARGET=<target> bin/console doctrine:migrations:status --db-configuration=./dev_config/migrations-db.php

Run the migration

MIGRATION_TARGET=<target> bin/console doctrine:migrations:migrate --db-configuration=./dev_config/migrations-db.php
Clone this wiki locally