I want to remove table using migration class method.
This is my migration class :
use yii\db\Schema;
use yii\db\Migration;
class m130524_201442_init extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%user}}', [
'id' => Schema::TYPE_PK,
'username' => Schema::TYPE_STRING . ' NOT NULL',
'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL',
'password_hash' => Schema::TYPE_STRING . ' NOT NULL',
'password_reset_token' => Schema::TYPE_STRING,
'email' => Schema::TYPE_STRING . ' NOT NULL',
'firstname' => Schema::TYPE_STRING,
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
'created_at' => Schema::TYPE_INTEGER . ' NOT NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL',
], $tableOptions);
}
public function down()
{
$this->dropTable('{{%user}}');
}
}
I migrated this class using yii migrate/to 130524_201442. After that I had done many other migrations and now I want to drop user table so I tried below commands,
yii migrate safeDown console\migrations\m130524_201442_init.php
yii migrate down console\migrations\m130524_201442_init.php
OUTPUT :
D:\Projects\wamp\www\yiiadvanced>yii migrate down console\migrations\m130524_201442_init.php
Yii Migration Tool (based on Yii v2.0.5)
No new migration found. Your system is up-to-date.
Also tried this one :
yii migrate/down 130524_201442
OUTPUT
D:\Projects\wamp\www\yiiadvanced>yii migrate/down 130524_201442
Yii Migration Tool (based on Yii v2.0.5)
Total 2 migrations to be reverted:
m151222_063506_roles
m130524_201442_init
Revert the above migrations? (yes|no) [no]:
If I enter "yes" then it will revert both one but i want to remove only m130524_201442_init.
So, which command should I use ?