Skip to main content

Database

Fetching database

To fetch the database with the latest data from the production environment, download the latest database dump into the .data directory.

# Download latest database dump (uses cache if downloaded today)
ahoy fetch-db
# Force a fresh download regardless of cache
ahoy fetch-db --fresh
note

The database dump is stored in the .data directory instead of being directly imported into the local environment to allow for caching and reusing the database dump without needing to download it every time you need to refresh the local environment.

You can manually download the database dump from the production environment, name it db.sql, and place it in the .data directory.

Refreshing database

Import the database dump into the local environment and run all necessary updates.

# Import database and run updates
ahoy provision
# Import database without running updates
ahoy import-db

Run the provision command any time you need to reset the local environment to use the fresh database dump stored in .data.

The import-db command is useful if you want to quickly reset the database without applying any updates or changes.

Exporting database

Export timestamped database dumps from the local environment.

# Export current database to .data directory
ahoy export-db

You can use these dumps to restore the local environment to a specific state: rename the dump file to .data/db.sql and run the import command.

➡️ See Drupal > Provision