Skip to content
Permalink
Browse files

Fix issue #11916

  • Loading branch information...
Ivan Vorsin
Ivan Vorsin committed Apr 10, 2018
1 parent ba859e2 commit ab6c4b968d2c6c5b21793e12e9afba9955b55f89
Showing with 12 additions and 0 deletions.
  1. +4 −0 src/Database/Schema/PostgresSchema.php
  2. +8 −0 tests/TestCase/Database/Schema/PostgresSchemaTest.php
@@ -196,6 +196,10 @@ protected function _defaultValue($default)
return null;
}
if (strpos($default, 'NULL::') === 0) {
return null;
}
// Remove quotes and postgres casts
return preg_replace(
"/^'(.*)'(?:::.*)$/",
@@ -143,6 +143,10 @@ public static function convertColumnProvider()
['type' => 'NUMERIC'],
['type' => 'decimal', 'length' => null, 'precision' => null]
],
[
['type' => 'NUMERIC', 'default' => 'NULL::numeric'],
['type' => 'decimal', 'length' => null, 'precision' => null, 'default' => null]
],
[
['type' => 'DECIMAL(10,2)', 'column_precision' => 10, 'column_scale' => 2],
['type' => 'decimal', 'length' => 10, 'precision' => 2]
@@ -164,6 +168,10 @@ public static function convertColumnProvider()
['type' => 'CHARACTER VARYING(10)'],
['type' => 'string', 'length' => 10]
],
[
['type' => 'CHARACTER VARYING(255)', 'default' => 'NULL::character varying'],
['type' => 'string', 'length' => 255, 'default' => null]
],
[
['type' => 'CHAR(10)'],
['type' => 'string', 'fixed' => true, 'length' => 10]

0 comments on commit ab6c4b9

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.