Answer the question
In order to leave comments, you need to log in
How to copy the values of one column to another in yii2 during migration?
there is a table with fields id, user email, birth_of_date
string birth_of_date in integer, I need to store dates in date I
create a new column during migration
$this->addColumn('table_name', 'new_birth_of_date', $this->date()->after('birth_of_date'));
$this->update('table_name', ['new_birth_of_date' => 'FROM_UNIXTIME(birth_of_date)']);
Answer the question
In order to leave comments, you need to log in
$this->update('table_name', ['new_birth_of_date' => new Expression('FROM_UNIXTIME()')]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question