Information for: DEVELOPERS   PARTNERS

Custom Drush commands for Cloud Platform

Cloud Platform provides the following custom Drush commands for your use:

Command Description
ah-db-backup Creates a database backup from the command line.
ah-db-import Imports a database from the command line. For more information, see Downloading database backups from the command line or Importing your database.
ah-site-archive-import Imports a website archive file, as described in Importing an existing application using Drush.
ah-sql-cli Opens a MySQL command-line interface using Drupal’s credentials.
ah-sql-connect Display a MySQL command for connecting to an Cloud Platform database.

Note

For a list of the deprecated commands provided as part of Cloud Platform API v1, see Drush command reference for Cloud Platform API v1.

ah-db-backup

This command is incompatible with Drush 9.

This command backs up a database on Cloud Platform from the command line.

Alias Arguments
(none)
  • site: Specify a website to back up.
  • roles: The comma-separated list of database roles to back up. Defaults to all database roles for the website.

This command accepts the following options, in the format --option=value:

  • retain: The number of daily backups to retain.
  • ah-syslog: Log the output of this command via syslog,
  • structure-tables-list: Comma-separated list of tables to backup only the structure (no data, only the CREATE TABLE command)
  • skip-tables-list: Comma-separated list of tables to skip in the backup.
  • structure-tables-key: A key in the $structure_tables array. See example.drushrc.php.
  • skip-tables-key: A key in the $skip_tables array. See example.drushrc.php.

ah-db-import

This command is incompatible with Drush 9.

Imports a Drupal database, using MySQL, converting tables to InnoDB format in the process.

Alias Arguments
(none) file: The SQL file to import, with a file path relative to the Drupal root. If the filename ends in .gz, the file will first be extracted to $TMP.

ah-site-archive-import

This command is incompatible with Drush 9.

Import a Drupal site archive file into Cloud Platform. This command requires a Drush alias for the Cloud Platform environment into which to import, such as drush @[sitename].[env] ah-sari ./archive.tgz.

Alias Arguments
ah-sar-import, ah-sari filename: The archive file to import.

This command accepts the following option, in the format --option=value:

  • extract-into: The temporary directory into which to extract the archive.

ah-sql-cli

Open a SQL command-line interface using Drupal’s credentials.

Alias Arguments
ah-sqlc (none)

This command accepts the following option, in the format --option=value:

  • db: The environment-agnostic database name. Defaults to the default primary Drupal database for the website. For more information, see Viewing database information.

Note

When you run drush ah-sql-cli, Cloud Platform may display the following message:

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

The -A option is a MySQL option and not a drush ah-sql-cli option. You should ignore it when you run drush ah-sql-cli.

ah-sql-connect

Display a MySQL command for connecting to an Cloud Platform database.

Alias Arguments
(none) (none)

This command accepts the following option:

  • db: The environment-agnostic database name. Defaults to the default primary Drupal database for the website. For more information, see Viewing database information.