1. Go to this page and download the library: Download fornit1917/yii2-emigrate 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/ */
fornit1917 / yii2-emigrate example snippets
use yii\db\Schema;
use yii\db\Migration;
class m150105_202502_create_table_table_name extends Migration
{
public function up()
{
$this->createTable('table_name', [], 'ENGINE=InnoDB CHARSET=utf8');
}
public function down()
{
$this->dropTable('table_name');
}
}
use yii\db\Schema;
use yii\db\Migration;
class m150106_102312_add_column_column_name_in_table_name extends Migration
{
public function up()
{
$this->addColumn('table_name', 'column_name', '');
}
public function down()
{
$this->dropColumn('table_name', 'column_name');
}
}
use yii\db\Schema;
use yii\db\Migration;
class m150106_102312_add_column_column_name_in_table_name extends Migration
{
public function up()
{
$this->addColumn('table_name', 'column_name', 'int(11) not null default 0');
}
public function down()
{
$this->dropColumn('table_name', 'column_name');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.