esempla/yii2tech-dump-migration

Generate the schema from an existing database

0.1.7 2019-02-26 11:42 UTC

This package is auto-updated.

Last update: 2022-01-17 17:49:12 UTC


README

Generate data migration file from an existing database This module is rewritten by Esempla based on https://github.com/bizley/yii2-migration. This module is designed for internal use, can be used freely, the company does not provide any warranty for it.

For orginal package try:

github: https://github.com/Hzhihua/yii2-dump
oschina: http://git.oschina.net/hzhihua/yii2-dump

Demo

yii2-dump

Test Environment

  • PHP >=7.1.0
  • PGSQL(<9.*)

Installation

composer require --prefer-dist "esempla/yii2tech-dump-migration:0.1.0"

Configuration

Add the following in console/config/main.php:

Simple Configuration

return [
    'dump' => [
         'class' => 'esempla\\yii2tech_dump_migration\\DumpController',
         'db' => 'db1', // Connection
         'generateFilePath' =>'@app/migrations/test/data',
         'limit' => '0,1000', // select * from tableName limit 0,1000
     ],
];

Default Limit

0,1000

Default Filter Table

migration

Simple Usage

run dump command.

cd /path/to/your-project
./yii dump   -type=1 --db='db1' # default action: generate, it will gerate migration file

Commands

generate all over the table migration file but it only had some data between 0 and 10

./yii dump -limit=10   -type=1 --db='db1' 

only generate table1,table2 migration file

./yii dump -table=table1,table2  -type=1 --db='db1'