BUG Enum value change wasn't being detected by alterTableAlterColumn because backslashes were not accounting

This commit is contained in:
Maxime Rainville 2019-09-06 13:13:14 +12:00
parent d607a2bfa9
commit fa7ac8b134
1 changed files with 8 additions and 2 deletions

View File

@ -494,9 +494,15 @@ class PostgreSQLSchemaManager extends DBSchemaManager
// First, we split the column specifications into parts
// TODO: this returns an empty array for the following string: int(11) not null auto_increment
// on second thoughts, why is an auto_increment field being passed through?
$pattern = '/^([\w(\,)]+)\s?((?:not\s)?null)?\s?(default\s[\w\.\']+)?\s?(check\s[\w()\'",\s]+)?$/i';
$pattern = '/^([\w(\,)]+)\s?((?:not\s)?null)?\s?(default\s[\w\.\'\\\\]+)?\s?(check\s[\w()\'",\s\\\\]+)?$/i';
preg_match($pattern, $colSpec, $matches);
// example value this regex is expected to parse:
// varchar(255) not null default 'SS\Test\Player' check ("ClassName" in ('SS\Test\Player', 'Player', null))
// split into:
// * varchar(255)
// * not null
// * default 'SS\Test\Player'
// * check ("ClassName" in ('SS\Test\Player', 'Player', null))
if (sizeof($matches) == 0) {
return '';