Skip to content
Permalink
Browse files

Handle postgres time without timezone correctly.

Handle time columns that don't include timezones correctly.

Refs #7363
  • Loading branch information...
markstory committed Sep 10, 2015
1 parent 30aa3d1 commit 7f58bf1ffebe7a70d874cd473f916a37a309df30
Showing with 16 additions and 0 deletions.
  1. +3 −0 src/Database/Schema/PostgresSchema.php
  2. +13 −0 tests/TestCase/Database/Schema/PostgresSchemaTest.php
@@ -85,6 +85,9 @@ protected function _convertColumn($column)
if (strpos($col, 'timestamp') !== false) {
return ['type' => 'timestamp', 'length' => null];
}
if (strpos($col, 'time') !== false) {
return ['type' => 'time', 'length' => null];
}
if ($col === 'serial' || $col === 'integer') {
return ['type' => 'integer', 'length' => 10];
}
@@ -72,6 +72,7 @@ protected function _createTables($connection)
author_id INTEGER NOT NULL,
published BOOLEAN DEFAULT false,
views SMALLINT DEFAULT 0,
readingtime TIME,
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
@@ -108,6 +109,10 @@ public static function convertColumnProvider()
'TIME',
['type' => 'time', 'length' => null]
],
[
'TIME WITHOUT TIME ZONE',
['type' => 'time', 'length' => null]
],
// Integer
[
'SMALLINT',
@@ -330,6 +335,14 @@ public function testDescribeTable()
'comment' => null,
'autoIncrement' => null,
],
'readingtime' => [
'type' => 'time',
'null' => true,
'default' => null,
'length' => null,
'precision' => null,
'comment' => null,
],
'created' => [
'type' => 'timestamp',
'null' => true,

0 comments on commit 7f58bf1

Please sign in to comment.
You can’t perform that action at this time.