PHP Classes

File: gii/default_bymodel/migration.php

Recommend this page to a friend!
  Classes of Insolita   YII2 Migrik   gii/default_bymodel/migration.php   Download  
File: gii/default_bymodel/migration.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: YII2 Migrik
Create migration files for applications using YII2
Author: By
Last change:
Date: 1 year ago
Size: 911 bytes


Class file image Download
 * This view is used by console/controllers/MigrateController.php
 * The following variables are available in this view:
/** @var $migrationName string the new migration class name
 * @var $table string table_name
 * @var array $columns
 * @var string $db
 * @var string $tableOptions

echo "<?php\n";

use yii\db\Schema;
use yii\db\Migration;

class <?= $migrationName ?> extends Migration

    public function init()
        $this->db = '<?=$db?>';

    public function safeUp()
        $tableOptions = '<?=$tableOptions?>';

            '<?= $table?>',
<?php foreach ($columns as $name => $data) :?>
'<?=$name?>'=> <?=$data;?>,
<?php endforeach;?>

    public function safeDown()
        $this->dropTable('<?= $table?>');