PHPackages                             rahulsprajapati/wp-cli-db-migrate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. rahulsprajapati/wp-cli-db-migrate

ActiveWp-cli-package[CLI &amp; Console](/categories/cli)

rahulsprajapati/wp-cli-db-migrate
=================================

A WP-CLI command to run common migration commands. like: rename db prefix, merge two mu site users table.. etc.

28PHP

Since Aug 28Pushed 7y agoCompare

[ Source](https://github.com/rahulsprajapati/wp-cli-db-migrate)[ Packagist](https://packagist.org/packages/rahulsprajapati/wp-cli-db-migrate)[ RSS](/packages/rahulsprajapati-wp-cli-db-migrate/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WP CLI DB Migrate
=================

[](#wp-cli-db-migrate)

A WP-CLI command to run common migration commands. like: rename db prefix, merge two mu site users table.. etc.

#### ⚠️ Note: Take database backup before running this commands. If some error occurs it might break your site.

[](#️-note-take-database-backup-before-running-this-commands-if-some-error-occurs-it-might-break-your-site)

### Install WP-CLI Package

[](#install-wp-cli-package)

```
wp package install rahulsprajapati/wp-cli-db-migrate
```

Commands
--------

[](#commands)

### Rename Database Tables :

[](#rename-database-tables-)

Command will do following things internally:

1. Rename prefix of all database tables
2. Update prefix into wp-config.php
3. Update all user meta key prefix. i.e wp\_capabilities, wp\_user\_level keys.
4. Update prefix into option table for user roles.

```
wp db-migrate rename_prefix
```

Example:

```
wp db-migrate rename_prefix wp_old_ wp_new_
```

### Merge user tables.

[](#merge-user-tables)

Requirements:

1. Rename existing users table prefix ( other then the WP site have currently ). i.e wp\_old\_users, wp\_old\_usermeta.
2. Export users table from other site from which we want to merge user tables and import it into your database. ( Update the prefix of this users table with current table if it's not same already. Also, run rename prefix command for live site db first to update prefix in users table. ) i.e wp\_users, wp\_usermeta

Command will do following things internally:

1. Ask you for site id which is migrated and need to be update the authors id in that site. There is option to run it for all sites.
2. Case 1: Migrate Same Users \[same Id, email, user\_login\] Meta data.
3. Case 2: Migrate Diff/New Users \[Diff: Id, email, user\_login\]. Add new user and usermeta.
4. Update post and comment table authors id as per migrated data.

```
wp db-migrate merge_user_table
```

Example:

```
wp db-migrate rename_prefix wp_old_ wp_new_
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ca0fe7443cb57b0adeeee29141dcc88c711a1c22af20ac8513611e7c77fe1fd?d=identicon)[rahulsprajapati](/maintainers/rahulsprajapati)

---

Top Contributors

[![rahulsprajapati](https://avatars.githubusercontent.com/u/10358350?v=4)](https://github.com/rahulsprajapati "rahulsprajapati (2 commits)")

### Embed Badge

![Health badge](/badges/rahulsprajapati-wp-cli-db-migrate/health.svg)

```
[![Health](https://phpackages.com/badges/rahulsprajapati-wp-cli-db-migrate/health.svg)](https://phpackages.com/packages/rahulsprajapati-wp-cli-db-migrate)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M319](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M18](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
