summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrenda Wallace <shiny@cpan.org>2010-03-10 22:02:56 +1300
committerBrenda Wallace <shiny@cpan.org>2010-03-10 22:02:56 +1300
commit75e2be3b71cc5b6114a10e1b5f1e0c9e3074af19 (patch)
treebc934484ae39938ac26f17f333250d2b1029b1d3 /lib
parent7398353c441699acc8b6ed38e221e40e30196208 (diff)
map the mysql-ish column types to ones postgres likes
Diffstat (limited to 'lib')
-rw-r--r--lib/pgsqlschema.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/pgsqlschema.php b/lib/pgsqlschema.php
index 825241902..86ffbeb2a 100644
--- a/lib/pgsqlschema.php
+++ b/lib/pgsqlschema.php
@@ -217,6 +217,22 @@ class PgsqlSchema extends Schema
}
/**
+ * Translate the (mostly) mysql-ish column types into somethings more standard
+ * @param string column type
+ *
+ * @return string postgres happy column type
+ */
+ private function _columnTypeTranslation($type) {
+ $map = array(
+ 'datetime' => 'timestamp'
+ );
+ if(!empty($map[$type])) {
+ return $map[$type];
+ }
+ return $type;
+ }
+
+ /**
* Adds an index to a table.
*
* If no name is provided, a name will be made up based
@@ -485,11 +501,12 @@ class PgsqlSchema extends Schema
private function _columnSql($cd)
{
$sql = "{$cd->name} ";
-
+ $type = $this->_columnTypeTranslation($cd->type);
+var_dump($type);
if (!empty($cd->size)) {
- $sql .= "{$cd->type}({$cd->size}) ";
+ $sql .= "{$type}({$cd->size}) ";
} else {
- $sql .= "{$cd->type} ";
+ $sql .= "{$type} ";
}
if (!empty($cd->default)) {