PHPackages                             schmunk42/database-command - 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. schmunk42/database-command

ActiveLibrary[Database &amp; ORM](/categories/database)

schmunk42/database-command
==========================

Yii command to create database migrations from existing schema

0.8.12(12y ago)185.9k11[7 issues](https://github.com/schmunk42/database-command/issues)[2 PRs](https://github.com/schmunk42/database-command/pulls)BSD-3-ClausePHPPHP &gt;=5.3.2

Since Sep 25Pushed 11y ago5 watchersCompare

[ Source](https://github.com/schmunk42/database-command)[ Packagist](https://packagist.org/packages/schmunk42/database-command)[ Docs](https://github.com/schmunk42/database-command)[ RSS](/packages/schmunk42-database-command/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (14)Used By (0)

database-command
================

[](#database-command)

Yii command to create database migrations from existing schema. Migration classes are created in application `runtime` folder.

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

[](#requirements)

- Yii 1.1.\*

Features
--------

[](#features)

- primary key generation
- foreign key generation (skipped for SQLite)
- complete data and schmema dump

Download
--------

[](#download)

[Get it from github](https://github.com/schmunk42/database-command/tags) and place it into your application.

Or install it via `composer require schmunk42/database-command`.

Configuration
-------------

[](#configuration)

`config/console.php`

```
'commandMap' => array(
    'database' => array(
        'class' => 'vendor.schmunk42.database-command.EDatabaseCommand',
    ),
)

```

> Note: You may have to replace `vendor.schmunk42.database-command.EDatabaseCommand` with the acutal installation path.

Usage
-----

[](#usage)

Run the command...

```
./yiic database

```

... to show the help page

```
dump [] [--prefix=] [--dbConnection=]
        [--createSchema=] [--insertData=] [--foreignKeyChecks=]
        [--ignoreMigrationTable=] [--truncateTable=]
        [--insertAutoIncrementValues=] [--migrationPath=]

```

ParamDefaultInfonamedumpmigration class name--prefixdump only tables with given prefix
(specify multiple prefixes separated by commas)--createSchema1whether to create tables--insertData1whether to create insert statements--foreignKeyChecks1set to `0` to disable foreign key checks--truncateTable0whether to remove all records from the table first--dbConnectiondbapplication component to use--migrationPathapplication.runtimedefault dump folder--ignoreMigrationTable1whether to ignore to migration table--insertAutoIncrementValues1whether to include values from auto-increment column#### Example

[](#example)

To create a migration from an existing application database schema, define an alternative database component in your application, e.g. `db-production`.

This example shows data dumping, removes all data (truncate tables) and omits foreign key checks:

```
 ./yiic database dump p3_replace_data \
   --prefix=Auth,Rights,usr,p3 --createSchema=0 \
   --foreignKeyChecks=0 --truncateTable=1

```

Separate schema and data:

```
 ./yiic database dump my_schema --insertData=0
 ./yiic database dump my_data --createSchema=0

```

Replace your whole data with data from `dbProduction`:

```
 ./yiic database dump replace_data \
   --truncateTable=1 --foreignKeyChecks=0 \
   --createSchema=0 --dbConnection=dbProduction

```

The following command dumps all tables starting with `p3_media` and omits the schema create statements:

```
./yiic database dump p3media_no_schema_production \
--prefix=p3_media --createSchema=0 --dbConnection=dbProduction

```

Resources
---------

[](#resources)

- Availble via [Phundament 3](http://phundament.com) Composer Package Repository `http://packages.phundament.com`
- Fork on [github](https://github.com/schmunk42/database-command)
- [CHANGELOG](https://github.com/schmunk42/database-command/blob/master/CHANGELOG.md)
- View at [Yii Extensions](http://www.yiiframework.com/extension/database-command/)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.1% 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.

###  Release Activity

Cadence

Every ~46 days

Recently: every ~94 days

Total

13

Last Release

4464d ago

### Community

Maintainers

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

---

Top Contributors

[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (61 commits)")[![maxxer](https://avatars.githubusercontent.com/u/240201?v=4)](https://github.com/maxxer "maxxer (7 commits)")[![addicted2sounds](https://avatars.githubusercontent.com/u/4359591?v=4)](https://github.com/addicted2sounds "addicted2sounds (1 commits)")[![marc7000](https://avatars.githubusercontent.com/u/1118837?v=4)](https://github.com/marc7000 "marc7000 (1 commits)")

---

Tags

migrationdatabasedumpcommandyiicreate

### Embed Badge

![Health badge](/badges/schmunk42-database-command/health.svg)

```
[![Health](https://phpackages.com/badges/schmunk42-database-command/health.svg)](https://phpackages.com/packages/schmunk42-database-command)
```

###  Alternatives

[lulco/phoenix

Database Migrations for PHP

179346.9k4](/packages/lulco-phoenix)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

62414.3k11](/packages/rah-danpu)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3422.6k](/packages/dragon-code-laravel-data-dumper)[hzhihua/yii2-dump

Generate the schema from an existing database

1829.6k1](/packages/hzhihua-yii2-dump)[elimuswift/db-exporter

Export your database quickly and easily as a Laravel Migration and all the data as a Seeder class.

364.7k](/packages/elimuswift-db-exporter)[codengine/laravel-custom-migrations

Custom Migrations for Laravel

131.3k](/packages/codengine-laravel-custom-migrations)

PHPackages © 2026

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