From fa7ac8b134d632e25f28cde148715a0747dea065 Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Fri, 6 Sep 2019 13:13:14 +1200 Subject: [PATCH] BUG Enum value change wasn't being detected by alterTableAlterColumn because backslashes were not accounting --- code/PostgreSQLSchemaManager.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/PostgreSQLSchemaManager.php b/code/PostgreSQLSchemaManager.php index 37f3563..789ce48 100644 --- a/code/PostgreSQLSchemaManager.php +++ b/code/PostgreSQLSchemaManager.php @@ -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 '';