2017 © Pedro Peláez
 

library database-command

Yii command to create database migrations from existing schema

image

schmunk42/database-command

Yii command to create database migrations from existing schema

  • Sunday, January 18, 2015
  • by schmunk
  • Repository
  • 5 Watchers
  • 19 Stars
  • 3,009 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 9 Open issues
  • 14 Versions
  • 2 % Grown

The README.md

database-command

Yii command to create database migrations from existing schema. Migration classes are created in application runtime folder., (*1)

Requirements

  • Yii 1.1.*

Features

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

Download

Get it from github and place it into your application., (*2)

Or install it via composer require schmunk42/database-command., (*3)

Configuration

config/console.php, (*4)

'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., (*5)

Usage

Run the command..., (*6)

./yiic database

... to show the help page, (*7)

dump [<name>] [--prefix=<table_prefix,...>] [--dbConnection=<db>]
        [--createSchema=<1|0>] [--insertData=<1|0>] [--foreignKeyChecks=<1|0>]
        [--ignoreMigrationTable=<1|0>] [--truncateTable=<0|1>]
        [--insertAutoIncrementValues=<1|0>] [--migrationPath=<application.runtime>]
Param Default Info
name dump migration class name
--prefix dump only tables with given prefixbr/(specify multiple prefixes separated by commas)
--createSchema 1 whether to create tables
--insertData 1 whether to create insert statements
--foreignKeyChecks 1 set to 0 to disable foreign key checks
--truncateTable 0 whether to remove all records from the table first
--dbConnection db application component to use
--migrationPath application.runtime default dump folder
--ignoreMigrationTable 1 whether to ignore to migration table
--insertAutoIncrementValues 1 whether to include values from auto-increment column

Example

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

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

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

Separate schema and data:, (*10)

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

Replace your whole data with data from dbProduction:, (*11)

 ./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:, (*12)

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

Resources

The Versions

18/01 2015

dev-master

9999999-dev https://github.com/schmunk42/database-command

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

database command migration yii dump create

11/04 2014

0.8.12

0.8.12.0 https://github.com/schmunk42/database-command

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

database command migration yii dump create

28/09 2013

0.8.11

0.8.11.0 https://github.com/schmunk42/database-command

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

database command migration yii dump create

24/04 2013

0.8.10

0.8.10.0 https://github.com/schmunk42/database-command

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

database command migration yii dump create

10/04 2013

0.8.9

0.8.9.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

28/03 2013

0.8.8

0.8.8.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

13/03 2013

0.8.7

0.8.7.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

17/01 2013

0.8.6

0.8.6.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

06/12 2012

0.8.5

0.8.5.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

07/11 2012

0.8.4

0.8.4.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

30/10 2012

0.8.3

0.8.3.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

13/10 2012

0.8.2

0.8.2.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

01/10 2012

0.8.1

0.8.1.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires

 

25/09 2012

0.8.0

0.8.0.0

Yii command to create database migrations from existing schema

  Sources   Download

BSD-3-Clause

The Requires