Download a database backup from Pantheon and import it into the local development environment. Can also be triggered by requests like "clone the live database", "load the dev db", or "pull the database from production".
When this skill is invoked — either via /load-db or through a natural language request like "clone the live database from december 12" — download a database backup from Pantheon and load it into the local development environment.
/load-db # Interactive: choose environment and backup
/load-db live # Use latest backup from live environment
/load-db dev 2026-02-10 # Use backup from dev matching the given date
"clone the live database" # Natural language: infer environment=live, pick latest
"load the db from test dec 12" # Natural language: infer environment=test, date=dec 12
"pull down the production database"# Natural language: default to live, pick latest
When invoked through conversation rather than a slash command:
2026-02-10 for matching.live environment.Parse Arguments and Context:
Select Environment:
terminus env:list ${TERMINUS_SITE} --format=list --fields=id
live, test, dev, qa, then otherslive as the default choice since it has production dataDownload Backup:
backup:list step entirely. Use terminus backup:get without --file to get the latest database backup URL directly, then download it in one command:
curl -L "$(terminus backup:get ${TERMINUS_SITE}.{environment} --element=db)" --output /tmp/pantheon-db-backup.sql.gz
This avoids fetching and parsing the full backup list JSON, which is large and wastes context tokens.terminus backup:list ${TERMINUS_SITE}.{environment} --element=db --format=json
Filter to entries whose filename contains the target date string (e.g., 2026-02-10), then download:
curl -L "$(terminus backup:get ${TERMINUS_SITE}.{environment} --element=db --file={backup_filename})" --output /tmp/pantheon-db-backup.sql.gz
TERMINUS_SITE is not set, inform the user they need to set it (should be myeap2 for this project)terminus auth:loginterminus backup:create--element=db filtered command above and use AskUserQuestion to let the user pick:
Import Database:
db-rebuild.sh script prepends $(pwd)/ to positional file arguments (see line 80 of the script). You MUST either:
cd /tmp before invoking the script and pass the relative filename, OR-- separator to avoid the path prependingcd /tmp && /usr/local/bin/db-rebuild.sh pantheon-db-backup.sql.gz
drush deploy to apply config and migrationsClean Up:
rm -f /tmp/pantheon-db-backup.sql.gz