The following command returns the databases assets. In this example, there is one database named
mysite for the
➜ ddev-live list databases DATABASES NAME SITE SERVER SERVERREADY AGE mysite mysite default-9482b True 10d
Listing Database Backups¶
The following command returns the database backups. In this example, there is one database named
mysite for the
mysite site. The output is restricted to database backups with the
--db flag. Omitting the
--db flag will list both database and file backups.
➜ ddev-live list backups --db DATABASE BACKUPS NAME DATABASE AGE COMPLETE BYTES mysite-jtsg8 mysite 14m true 31556
➜ ddev-live backup database mysite Initiated database backup: ddev-demo/mysite-h9fqh
➜ ddev-live describe backup database ddev-demo/mysite-h9fqh
Configuring Database Backups¶
To configure a backup schedule, use
ddev-live config backups. One argument is required: a reference to a site. Backups are initiated daily at a randomly assigned time, and seven automated backups are retained by default.
➜ ddev-live config backups enable ddev-demo/mysite Enabled database backups for site: ddev-demo/mysite
ddev-live config backups retention command sets the number of automated backups to be retained.
This command accepts two arguments: a reference to a site and the number of backups to be retained. By default, 7 backups will be retained, equating to one week's worth of daily backups. The count can be configured to values between 1 and 365.
➜ ddev-live config backups retention ddev-demo/mysite 5 Set database backup retention count to 5 for site: ddev-demo/mysite
ddev-live push database to import a database to your site. Two arguments are required: a reference to a site and the path to a database backup asset. Database backups must be gzip-ed SQL files. When the database backup has been uploaded, a backup restore operation is initiated using the uploaded asset.
The following command pushes a database named
foo.sql.gz from local to live and initiates a backup restore.
➜ ddev-live push database mysite ./foo.sql.gz Uploaded: ./foo.sql.gz Initiated backup restore: ddev-demo/mysite-gxsrd
ddev-live describe will give you the job's status.
➜ ddev-live describe restore database ddev-demo/mysite-gxsrd Name: mysite-gxsrd Org: ddev-demo Created: 5m ago (2020-04-23 18:12:22 -0400 EDT) Database: mysite Export: Status: ImportOpFinished
➜ ddev-live pull database ddev-demo-h9fqh Downloaded: ddev-demo-h9fqh.gz
➜ ddev-live restore database mysite mysite-jtsg8 Initiated database restore ddev-demo/mysite-wd4kq
➜ ddev-live describe restore database mysite-wd4kq Name: mysite-wd4kq Org: ddev-demo Created: 23s ago (2020-04-29 09:51:27 -0400 EDT) Database: mysite Export: mysite-jtsg8 Status: ImportOpFinished