Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

182 document importing sql files #217

Merged
merged 7 commits into from
Sep 18, 2020
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 8 additions & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -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 be scrubbed as to be free from any personal identifying information and care should be taken that database backup files committed to the repository are free from personal data.
roborourke marked this conversation as resolved.
Show resolved Hide resolved