PHP code example of skobka / yii2-migration-generator

1. Go to this page and download the library: Download skobka/yii2-migration-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skobka / yii2-migration-generator example snippets


use skobka\yii2\migrationGenerator\Controllers\MigrationGeneratorController;

return [
   //...
    'controllerMap' => [
        'migration' => [
            'class' => MigrationGeneratorController::class,
        ],
    ],
   //...
]

/**
 * @Superclass()
 * @Column(name="id", type="primaryKey")
 * @Column(name="uid", type="integer", notNull=false)
 * 
 * @property int id
 * @property int uid
 */
class BaseModel
{

}


use skobka\yii2\migrationGenerator\annotation\Column;
use skobka\yii2\migrationGenerator\annotation\Superclass;
use skobka\yii2\migrationGenerator\annotation\Table;

/**
 * @Table(name="{{%simple_class}}")
 *
 * @Column(name="some", type="string", typeArgs={255}, extra=" DEFAULT '0'")
 * @Superclass()
 * use superclass annotation to allow extending class annotation
 *
 * @property string some
 */
class SimpleClass extends BaseModel
{

}


use skobka\yii2\migrationGenerator\annotation\Column;
use skobka\yii2\migrationGenerator\annotation\Table;

/**
 * @Table(name="sub_simple_class")
 * @Column(name="created", type="integer", notNull=true)
 *
 * @property int created
 */
class SubSimpleClass extends SimpleClass
{

}
bash
php composer.phar 
bash
php yii migration/generate common/models/mymodel