Migrations
Vortex provides optional support for a second database to power Drupal
migrations. When enabled, a database2 Docker service runs alongside the
primary database, and a settings.migration.php file registers the
$databases['migrate'] connection that Drupal's Migrate API uses by default.
Enabling the migration database
Via the installer
When running the Vortex installer, answer Yes to "Use a second database for migrations?" and select a fetch source.
Manual setup
If you already have a Vortex project and want to add migration support:
- Ensure
docker-compose.ymlcontains thedatabase2service andDATABASE2_*environment variables (copy from a fresh Vortex install with migration enabled). - Add
VORTEX_FETCH_DB2_FILE,VORTEX_FETCH_DB2_SOURCE, andVORTEX_FETCH_DB2_URLto.env. - Create
web/sites/default/settings.migration.php(see below). - Add the include in
web/sites/default/settings.php. - Add
scripts/provision-20-migration.sh.
Environment variables
| Variable | Default | Description |
|---|---|---|
VORTEX_FETCH_DB2_FILE | db2.sql | Migration database dump file name |
VORTEX_FETCH_DB2_SOURCE | url | Fetch source (url, ftp, acquia, lagoon, s3) |
VORTEX_FETCH_DB2_URL | (empty) | URL to fetch the migration database dump |
DATABASE2_HOST | database2 | Migration database host |
DATABASE2_NAME | drupal | Migration database name |
DATABASE2_USERNAME | drupal | Migration database user |
DATABASE2_PASSWORD | drupal | Migration database password |
DATABASE2_PORT | 3306 | Migration database port |
Docker service
The database2 service uses the same Lagoon MySQL image as the primary
database but does not use a custom Dockerfile or database-in-image storage.
database2:
image: uselagoon/mysql-8.4:26.1.0
environment:
<<: *default-environment
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
ports:
- '3306'
labels:
lagoon.type: none
The service is labeled lagoon.type: none because the migration database
is only used locally and in CI — it is not deployed to hosting environments.
Drupal settings
settings.migration.php
$databases['migrate']['default'] = [
'database' => getenv('DATABASE2_NAME') ?: 'drupal',
'username' => getenv('DATABASE2_USERNAME') ?: 'drupal',
'password' => getenv('DATABASE2_PASSWORD') ?: 'drupal',
'host' => getenv('DATABASE2_HOST') ?: 'localhost',
'port' => getenv('DATABASE2_PORT') ?: '',
'prefix' => '',
'driver' => 'mysql',
];
Drupal's Migrate API SqlBase source plugin uses key: migrate by default,
which resolves to this connection.
Ahoy commands
| Command | Description |
|---|---|
ahoy fetch-db2 | Fetch the migration database dump |
ahoy fetch-db2 --fresh | Force a fresh fetch |
ahoy db2 | Open the migration database in Sequel Ace |
The fetch-db2 command reuses the existing fetch-db.sh script with
VORTEX_DB_INDEX=2, which makes all scripts resolve indexed variable names
(e.g., VORTEX_FETCH_DB2_SOURCE instead of VORTEX_FETCH_DB_SOURCE,
VORTEX_DB2_IMAGE instead of VORTEX_DB_IMAGE) so all existing fetch
sources (URL, FTP, Acquia, Lagoon, S3) work for the migration database as well.