Answer the question
In order to leave comments, you need to log in
Why do I get an error after a rollback?
When I specify php yii migrate/down
that I receive the answer
Migration failed. The rest of the migrations are cancelled.
How can I fix it? I already installed php7.1-mysql but nothing helped
<?php
use yii\db\Migration;
/**
* Class m190423_135654_add_archive_column_user_table
*/
class m190423_135654_add_archive_column_user_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->execute("ALTER TABLE `user`
ADD `archive` int(11) NULL;");
$this->execute("ALTER TABLE `user`
ADD `archive_сomment` text NULL;");
$this->execute("ALTER TABLE `user`
ADD `reason_archive` int(11) NULL;");
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m190423_135654_add_archive_column_user_table cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m190423_135654_add_archive_column_user_table cannot be reverted.\n";
return false;
}
*/
}
Answer the question
In order to leave comments, you need to log in
return false;
public function safeDown()
. What do you expect if you have not described any logic? Describe the rollback logic and return true.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question