PHPackages                             juampynr/syncdb - 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. [Database &amp; ORM](/categories/database)
4. /
5. juampynr/syncdb

ActiveDrupal-drush[Database &amp; ORM](/categories/database)

juampynr/syncdb
===============

Import and export large Drupal databases faster using Drush.

2835.1k5[6 issues](https://github.com/juampynr/syncdb/issues)PHP

Since Jan 12Pushed 8y ago4 watchersCompare

[ Source](https://github.com/juampynr/syncdb)[ Packagist](https://packagist.org/packages/juampynr/syncdb)[ RSS](/packages/juampynr-syncdb/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Drush syncdb plugin
===================

[](#drush-syncdb-plugin)

This project implements [two Drush commands to export and import large Drupal 7 or 8 databases faster](https://www.lullabot.com/articles/importing-huge-databases-faster "Lullabot article"). It does it by splitting tables into separate files and importing them afterwards in parallel.

Here is a description of each command:

- `drush dumpdb` dumps database tables into the temporary directory of the current environment.
- `drush syncdb @example.dev` downloads sql files from `@example.dev` and installs them in the current environment.
- `drush importdb --dump-dir=/foo/bar` imports all `*.sql` files from `/foo/bar` using the same method as `syncdb`.

There is no .module nor .info files because this is not a module. It is a Drush command. Drush can find commands in certain directories such as `$HOME/.drush/`or `sites/all/drush`. Run `drush topic docs-commands` on a terminal to see other places where this project can be placed so Drush can discover it. Depending on your needs you may decide to leave this command with or without your project's versioned code.

Requirements
------------

[](#requirements)

- Drush: version 6 or higher.
- Drupal 7 or Drupal 8.
- Database: it has been tested just on MySQL.

It highly recommended that you install [GNU-parallel](http://www.gnu.org/software/parallel)in the machine(s) that contain the data that you want to import. On Ubuntu, run `sudo apt-get install parallel`. On Mac, run `brew install parallel`. This is not a hard requirement, though. `drush syncdb` will still be able to import tables witout GNU-parallel, but it will take longer to complete.

Installation
------------

[](#installation)

Go to your project's root directory and run the following command:

```
composer require juampynr/syncdb

```

This will normally download the command into `/path-to-drush/drush/commands/syncdb`. If you want to move it somewhere within your project so it is under version control, move it to sites/all/drush or run drush dl --destination=sites/all/drush syncdb.

Next, log into the remote server which will server as the source from which the team will download tables into their local environments. Install the command there.

Usage
-----

[](#usage)

You should set up a periodic job that runs `drush dumpdb` at the remote environment that is designated as the source. This would normally be the Development environment. This can be set up through [crontab](https://help.ubuntu.com/community/CronHowto)or [Jenkins](https://jenkins.io/). Here is how you can set this up in crontab:

```
drush @example.dev ssh
crontab -e
# Paste the following command at the bottom of the opened file:
30 2 * * * drush --root=/path/to/your/drupalroot --quiet dumpdb --structure-tables-key=common

```

Once this job is set up, run it once in the remote environment so it will export tables into, for example, `/tmp/syncdb-tables`. Now you can import these tables into your local environment with the following command:

```
drush syncdb @example.dev

```

Customizing the command
-----------------------

[](#customizing-the-command)

You can use the `--structure-tables-key` option in the same way it works for the `sql-sync` command. This option will export structure tables into a file called `structure.sql`.

If you install `parallel`, have a look at is options by reading the contents of the command `man parallel`. There could be ways for you to optimize the command even further.

Usage examples
--------------

[](#usage-examples)

Here are a few screenshots of a terminal session using these two commands:

[![drush dumpdb](/screenshots/Selection_001.jpg?raw=true "Dumping database")](/screenshots/Selection_001.jpg?raw=true)

[![drush dumpdb 2](/screenshots/Selection_002.jpg?raw=true "Dumping database (part 2)")](/screenshots/Selection_002.jpg?raw=true)

[![drush syncdb](/screenshots/Selection_003.jpg?raw=true "Importing database")](/screenshots/Selection_003.jpg?raw=true)

[![drush syncdb 2](/screenshots/Selection_004.jpg?raw=true "Importing database (part 2)")](/screenshots/Selection_004.jpg?raw=true)

Acknowledgements
----------------

[](#acknowledgements)

- Andrew Berry ([@deviantintegral](https://twitter.com/deviantintegral)) for creating [MySQL Parallel](https://github.com/deviantintegral/mysql-parallel)where I took some of the ideas.
- Mateu Aguiló Bosh ([@e0ipso](https://twitter.com/e0ipso)) for showing me how mysql-parallel works.
- Dave Reid [@davereid](https://twitter.com/davereid), for writing [Concurrent Queue](https://www.drupal.org/project/concurrent_queue), from where I took the `drush_invoke_concurrent()` approach when GNU-parallel is not available.
- Kris Bulman ([@krisbulman](https://twitter.com/krisbulman)), for reminding me every week how slow was to download a large database.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.2% 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://avatars.githubusercontent.com/u/108130?v=4)[Juampy NR](/maintainers/juampynr)[@juampynr](https://github.com/juampynr)

---

Top Contributors

[![juampynr](https://avatars.githubusercontent.com/u/108130?v=4)](https://github.com/juampynr "juampynr (15 commits)")[![weitzman](https://avatars.githubusercontent.com/u/7740?v=4)](https://github.com/weitzman "weitzman (4 commits)")[![davereid](https://avatars.githubusercontent.com/u/62967?v=4)](https://github.com/davereid "davereid (1 commits)")[![osopolar](https://avatars.githubusercontent.com/u/1523215?v=4)](https://github.com/osopolar "osopolar (1 commits)")[![ragnarkurmwunder](https://avatars.githubusercontent.com/u/28702260?v=4)](https://github.com/ragnarkurmwunder "ragnarkurmwunder (1 commits)")[![theodorosploumis](https://avatars.githubusercontent.com/u/1315321?v=4)](https://github.com/theodorosploumis "theodorosploumis (1 commits)")

### Embed Badge

![Health badge](/badges/juampynr-syncdb/health.svg)

```
[![Health](https://phpackages.com/badges/juampynr-syncdb/health.svg)](https://phpackages.com/packages/juampynr-syncdb)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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