Skip to content

Commit

Permalink
Merge pull request #222 from humanmade/backport-217-to-v5-branch
Browse files Browse the repository at this point in the history
[Backport v5-branch] 182 document importing sql files
  • Loading branch information
roborourke authored Oct 6, 2020
2 parents 29b905c + 463a6cf commit d01ae2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The subdomain used for the project can be configured via the `modules.local-serv
* `composer server logs <service>` - Tail the logs from a given service, defaults to `php`, available options are `nginx`, `php`, `db`, `redis`, `cavalcade`, `tachyon`, `s3` and `elasticsearch`.
* `composer server shell` - Logs in to the PHP container.
* `composer server cli -- <command>` - Runs a WP CLI command, you should omit the 'wp' for example `composer server cli -- info`
* `composer server cli -- db import database.sql` - Imports a database file located in the project root.
* `composer server exec -- <command>` - Runs any command on the PHP container.
* `composer server db` - Logs into MySQL on the DB container.
* `composer server db info` - Print MySQL connection details.
Expand Down
10 changes: 8 additions & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ To install a new language file and activate it:
composer server cli -- language core install fr_FR
```

CLI commands via Local Server also support piping, for example import a database SQL file:
CLI commands via Local Server also support piping for more complex shell commands.

### Importing a database backup

To import a database backup with local server, you will need to have a database backup file in a location that is accessible from the project root.

```sh
composer server cli -- db import - < ~/Downloads/database.sql
composer server cli -- db import database.sql
```

**Note:** For privacy reasons any database backups that are version controlled should have any personally identifiable information removed and extra care should be taken to avoid committing database backup files containing personal data.

0 comments on commit d01ae2d

Please sign in to comment.