Messi2017-04-29 20:04:18
Messi, 2017-04-29 20:04:18

1366 Incorrect string value fix via migrations?

There was a problem, when saving the text ( Cyrillic ) to the database, an error 1366 Incorrect string value crashes .
The Yii2 database configs are set to 'charset' => 'utf8' .
The question is how to fix this with migrations?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Messi, 2017-04-29

You need to add to the migration:

$this->alterColumn('table.name', 'table.column', $this->string()->append('CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question