- Running an XAMPP machine on Windows, I tried running the command:
$ ./yii migrate/down
Yii Migration Tool (based on Yii v2.0.15.1)
Total 1 migration to be reverted:
m180614_020037_create_table_place_lang
Revert the above migration? (yes|no) [no]:yes
*** reverting m180614_020037_create_table_place_lang
> drop foreign key fk_place_lang_id_place from table place_lang ... done (time: 0.067s)
> drop index idx_place_lang_id_place on place_lang ... done (time: 0.189s)
> drop table place_lang ... done (time: 0.135s)
*** failed to revert m180614_020037_create_table_place_lang (time: 0.396s)
0 from 1 migrations were reverted.
Migration failed. The rest of the migrations are canceled.
I ran the migration below
use yii\db\Migration; // Class m180614_020037_create_table_place_lang class m180614_020037_create_table_place_lang extends Migration { /** * {@inheritdoc} */ public function up() { $this->createTable('place_lang', [ 'id' => $this->primaryKey()->unsigned(), 'place_id' => $this->integer(11)->unsigned()->notNull(), 'locality' => $this->string(45)->notNull(), 'country' => $this->string(45)->notNull(), 'lang' => $this->string(2)->notNull() ]);
}$this->createIndex( 'idx_place_lang_id_place', 'place_lang', 'place_id' ); $this->addForeignKey( 'fk_place_lang_id_place', 'place_lang', 'place_id', 'place', 'id' ); } /** * {@inheritdoc} */ public function down() { $this->dropForeignKey('fk_place_lang_id_place', 'place_lang'); $this->dropIndex('idx_place_lang_id_place', 'place_lang'); $this->dropTable('place_lang'); return false; }The database table was dropped, but the migration failed and I could not progress down the migration stack.
There was another migration seen here below it in the stack:
<?php
use yii\db\Migration;
/**
* Class m180614_015652_create_table_place
*/
class m180614_015652_create_table_place extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$this->createTable('place', [
'id' => $this->primaryKey()->unsigned()->notNull(),
'place_id' => $this->string(45)->notNull(),
'lat' => $this->string(45)->notNull(),
'lng' => $this->string(45)->notNull(),
'country_code' => $this->string(2)->notNull(),
'is_country' => $this->tinyInteger(4)->notNull()
]);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('place');
return false;
}
}
Is this a limitation of yii 2 on Windows and XAMPP or just a newbie error using the framework?
return false. - Insane Skull