mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #15878: Fixed migration with a comment containing an apostrophe
This commit is contained in:

committed by
Carsten Brandt

parent
61186b5bd5
commit
f33959419a
@ -291,8 +291,9 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
*/
|
||||
public function addCommentOnColumn($table, $column, $comment)
|
||||
{
|
||||
$definition = $this->getColumnDefinition($table, $column);
|
||||
$definition = trim(preg_replace("/COMMENT '(.*?)'/i", '', $definition));
|
||||
// Strip existing comment which may include escaped quotes
|
||||
$definition = trim(preg_replace("/COMMENT '(?:''|[^'])*'/i", '',
|
||||
$this->getColumnDefinition($table, $column)));
|
||||
|
||||
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
|
||||
. ' CHANGE ' . $this->db->quoteColumnName($column)
|
||||
|
Reference in New Issue
Block a user