Browse Source

Adding support to parsing json columns in potgres

Jose Lorenzo Rodriguez 10 years ago
parent
commit
518ac1bcf4

+ 5 - 0
src/Database/Schema/PostgresSchema.php

@@ -129,6 +129,11 @@ class PostgresSchema extends BaseSchema
         ) {
             return ['type' => 'decimal', 'length' => null];
         }
+
+        if (strpos($col, 'json') !== false) {
+            return ['type' => 'json', 'length' => null];
+        }
+
         return ['type' => 'text', 'length' => null];
     }
 

+ 4 - 0
tests/TestCase/Database/Schema/PostgresSchemaTest.php

@@ -200,6 +200,10 @@ SQL;
                 'DOUBLE PRECISION',
                 ['type' => 'float', 'length' => null]
             ],
+            [
+                'JSON',
+                ['type' => 'json', 'length' => null]
+            ],
         ];
     }