Skip to content

vip dev-env import sql

Import a SQL file to a running local environment.

Usage

vip dev-env import sql [options]

Options

OptionDescription
-d, --debug Generate verbose output during command execution to help identify or fix errors or bugs.
-h, --help Retrieve a description, examples, and available options for a (sub)command.
-i, --in-place Perform a search and replace operation on the local SQL file and save the results.
-q, --quiet Skip confirmation and suppress informational messages.
-r, --search-replace Search for a string in the SQL file and replace it with a new string.
-k, --skip-reindex Skip Elasticsearch reindex after import.
-S, --skip-validate Skip file validation.
-s, --slug A unique name for a local environment. Default is “vip-local”.
-v, --version Retrieve the version number of VIP-CLI currently installed on the local machine.

Examples

- Import the SQL file named "file.sql" from a path on the user's local machine to a running local environment named "example-site".
$ vip dev-env import sql /Users/example/Downloads/file.sql --slug="example-site"

- Search for the string "example-site.com" in the SQL file and replace it with "example-site.vipdev.lndo.site" during the import.
$ vip dev-env import sql /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"

- Import the SQL file to a local environment with Elasticsearch enabled, and do not reindex after the import is completed.
$ vip dev-env import sql /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --skip-reindex --slug="example-site"

- Perform the search and replace operation on the local SQL file ("file.sql"), save the changes, and import the updated file to the local environment.
$ vip dev-env import sql /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --in-place

- Search and replace 2 pairs of strings during the import of the SQL file to a local multisite environment.
$ vip dev-env import sql /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"

Last updated: November 18, 2024