Browse Source

Added integration test for parsing JSON column in postgres

Jose Lorenzo Rodriguez 10 years ago
parent
commit
89ea455f0e

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

@@ -345,6 +345,7 @@ class PostgresSchema extends BaseSchema
             'datetime' => ' TIMESTAMP',
             'timestamp' => ' TIMESTAMP',
             'uuid' => ' UUID',
+            'json' => ' JSON'
         ];
 
         if (isset($typeMap[$data['type']])) {

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

@@ -73,6 +73,7 @@ author_id INTEGER NOT NULL,
 published BOOLEAN DEFAULT false,
 views SMALLINT DEFAULT 0,
 readingtime TIME,
+data JSON,
 created TIMESTAMP,
 CONSTRAINT "content_idx" UNIQUE ("title", "body"),
 CONSTRAINT "author_idx" FOREIGN KEY ("author_id") REFERENCES "schema_authors" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
@@ -347,6 +348,14 @@ SQL;
                 'precision' => null,
                 'comment' => null,
             ],
+            'data' => [
+                'type' => 'json',
+                'null' => true,
+                'default' => null,
+                'length' => null,
+                'precision' => null,
+                'comment' => null,
+            ],
             'created' => [
                 'type' => 'timestamp',
                 'null' => true,