The namespace db offers tasks to handle the database configuration, structure and content.

add_default_content

Add default content from config/preseed/default_content.sql.gz to database

Usage

Used for initial setup of the project. This requires an existing database configuration (see upload_settings).

$ cap dev db:add_default_content

add_default_structure

Add structure content from config/preseed/default_structure.sql.gz to database

Usage

Used for initial setup of the project. This requires an existing database configuration (see upload_settings).

$ cap dev db:add_default_structure

Output

00:00 db:add_default_structure
      Downloading db_settings.dev.yaml 100.0%
      01 rm -f /var/www/typo3-cms-standard/htdocs/default_structure.sql
    ✔ 01 vagrant@192.168.156.14 0.043s
      02 rm -f /var/www/typo3-cms-standard/htdocs/default_structure.sql.gz
    ✔ 02 vagrant@192.168.156.14 0.005s
      Uploading config/preseed/default_structure.sql.gz 100.0%
      03 gunzip /var/www/typo3-cms-standard/htdocs/default_structure.sql.gz
    ✔ 03 vagrant@192.168.156.14 0.005s
      04 mysql --default-character-set=utf8 -u typo3 -p -h 127.0.0.1 -P 3306 typo3_cms_standard_dev -e 'source /var/www/typo3-cms-standard/htdocs/default_structure.sql'
      04 Enter password:
    ✔ 04 vagrant@project.example 0.109s
    ✔ 01 vagrant@project.example 0.004s
    ✔ 02 vagrant@project.example 0.004s

console

Run interactive MySQL console.

Usage

This function requires an existing configuration file on the target stage.

$ cap dev db:console
This task raises an error if the connection could not be established.

download

Dump complete database without cache table content to local temp folder. Triggers the task downloadstructure and download_content.

Usage

$ cap dev db:download

download_content

Dump complete database content without cache tables and structure to local temp folder

Usage

$ cap dev db:download_content

download_structure

Dumps complete database structure without content

Usage

$ cap dev db:download_structure

download_tables

Download database tables.

Usage

This task offers three parameters :file_path, :file_name and :table_names.

The variable file_path defines the path where you want to download the database dump. Default value is temp. The variable :file_name defines the name of the file where the download is stored.

The tables to be dumped are set with :table_names as a comma separated list of table names.

$ cap dev db:download_tables[file_path,file_name,table_names]

dump_table

Dump content of a database table to local folder

Usage

$ cap dev db:dump_table[table_name]

dump_tables

Dump content of a list of database tables to a local folder.

Usage

$ cap dev db:dump_tables[file_path,file_name,table_names]

update

Upload, unzip and execute database script.

Configuration

This task requires the path to the database dump and the filename to be uploaded.

The file has to be compressed by gzip.

This task raises an error if the local database dump does not exists.
This task raises an error if the database dump could not be imported.

Usage

$ cap dev db:update[file_path,zipped_db_file]

upload_settings

Upload database settings file. An existing configuration file will be deleted.

Usage

$ cap dev db:upload_settings[db_host,db_port,db_name,db_username,db_password,db_charset]
This task raises an error if the given password is empty.
This task raises an error if the given credentials are not valid.

read_db_settings

Load the database configuration from the given stage.

Configuration

This tasks requires an existing database configuration file on the target stage.

The filename containing the configuration starts with db_settings., the name of the stage. The filename ends with .yaml

Example

db_settings.dev.yaml

There are no variables that need to be configured.

Usage

This task is used internally when

  • Database content or structure is downloaded
  • Doctrine migrations are executed
$ cap dev db:read_db_settings
This task raises an error if the configuration file does not exists on the target stage.

Output

There is no output on the screen. The Yaml file is available in the temp directory.

Example for a db_settings file:

---
database:
  host: 127.0.0.1
  port: '3306'
  name: your_database
  username: your_username
  password: your_password
  charset: utf8

upload_tables

This task update database tables. Additional a MD5 hash is generated and stored on the server. If this task is executed again with the same file the MD5 hash is used to check if an updated is required.

Usage

$ cap dev db:upload_tables[file_path,file_name]

Search Results powered by Algolia Search