https://github.com/raiseandfall/wpmigrate
A tool to migrate Wordpress databases between environments
https://github.com/raiseandfall/wpmigrate
Last synced: 8 months ago
JSON representation
A tool to migrate Wordpress databases between environments
- Host: GitHub
- URL: https://github.com/raiseandfall/wpmigrate
- Owner: raiseandfall
- License: mit
- Created: 2015-05-22T22:26:09.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-07-16T15:47:01.000Z (almost 6 years ago)
- Last Synced: 2023-08-02T03:11:41.986Z (almost 3 years ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WORDPRESS DB MIGRATE
> A CL tool to migrate a Wordpress Database between different environments ( dev, staging, prod, ... ).
Inspired by [grunt-wordpress-deploy](https://github.com/webrain/grunt-wordpress-deploy/).
Modified to run as a Node package.
## REQUIREMENTS
- ```mysqldump```
## USAGE
### 1. Create a configuration file ```.wprc```
This file can be wherever on your computer but you'll need to call wpmigrate on the same level.
#### IMPORTANT: It's safer to place the file outside of the git rep since it should never be tracked by git (contains database credentials).
This file contains the configuration of the different environments databases. You can create as much env as you want.
Each environment object contains its database credentials as well as the URL of the Wordpress project on this environment.
__NOTE__
- The ```url``` field needs to have a protocol & the full host used in the Wordpress config. No trailing slash !
- The ```options``` object contains the backup directory name you want to use. Backups are made every time any migration happens.
```json
{
"options": {
"backup_dir": "backups"
},
"environments": {
"development": {
"title": "development",
"database": "DB_NAME",
"user": "USER_DEV",
"pass": "PASSWORD_DEV",
"host": "HOST_DEV",
"url": "http://development.url"
},
"staging": {
"title": "staging",
"database": "DB_NAME",
"user": "USER_STAGING",
"pass": "PASSWORD_STAGING",
"host": "HOST_STAGING",
"url": "http://staging.url"
},
"production": {
"title": "production",
"database": "DB_NAME",
"user": "USER_PROD",
"pass": "PASSWORD_PROD",
"host": "HOST_PROD",
"url": "http://prod.url"
}
}
}
```
### 2. Run
```shell
$ wpmigrate --from= --to=
```
- ```from``` flag is the source environment
- ```to``` flag is the target environment
Example:
```shell
$ wpmigrate --from=development --to=staging
```
This will migrate the database from the development env to the staging env.