Skip to content

Commit

Permalink
Added integration test for parsing JSON column in postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 19, 2016
1 parent 792aea8 commit 89ea455
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Database/Schema/PostgresSchema.php
Expand Up @@ -345,6 +345,7 @@ public function columnSql(Table $table, $name)
'datetime' => ' TIMESTAMP',
'timestamp' => ' TIMESTAMP',
'uuid' => ' UUID',
'json' => ' JSON'
];

if (isset($typeMap[$data['type']])) {
Expand Down
9 changes: 9 additions & 0 deletions tests/TestCase/Database/Schema/PostgresSchemaTest.php
Expand Up @@ -73,6 +73,7 @@ protected function _createTables($connection)
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
Expand Down Expand Up @@ -347,6 +348,14 @@ public function testDescribeTable()
'precision' => null,
'comment' => null,
],
'data' => [
'type' => 'json',
'null' => true,
'default' => null,
'length' => null,
'precision' => null,
'comment' => null,
],
'created' => [
'type' => 'timestamp',
'null' => true,
Expand Down

0 comments on commit 89ea455

Please sign in to comment.