From 07e7579f4f7a15dddc609536339c08c8a64a536d Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Mon, 1 Nov 2010 01:34:29 +0000 Subject: [PATCH] MINOR: time and float data types now supported. Index information now returned correctly and won't trigger index rebuilds --- code/PostgreSQLDatabase.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/PostgreSQLDatabase.php b/code/PostgreSQLDatabase.php index eddf466..ad0a3ee 100644 --- a/code/PostgreSQLDatabase.php +++ b/code/PostgreSQLDatabase.php @@ -591,7 +591,6 @@ class PostgreSQLDatabase extends SS_Database { $output = array(); if($fields) foreach($fields as $field) { - switch($field['data_type']){ case 'character varying': //Check to see if there's a constraint attached to this column: @@ -654,6 +653,14 @@ class PostgreSQLDatabase extends SS_Database { $output[$field['column_name']]='smallint default ' . $field['column_default']; break; + case 'time without time zone': + $output[$field['column_name']]='time'; + break; + + case 'double precision': + $output[$field['column_name']]='float'; + break; + default: $output[$field['column_name']] = $field; } @@ -694,12 +701,12 @@ class PostgreSQLDatabase extends SS_Database { $indexSpec='unique (' . $indexSpec['value'] . ')'; break; case 'hash': - $indexSpec='using hash (' . $indexSpec['value'] . ')'; + $indexSpec='(' . $indexSpec['value'] . ')'; break; case 'index': //The default index is 'btree', which we'll use by default (below): default: - $indexSpec='using btree (' . $indexSpec['value'] . ')'; + $indexSpec='(' . $indexSpec['value'] . ')'; break; } }