summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_forge.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-01-05 17:33:12 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-01-05 17:33:12 +0100
commitc2e9225eec976326df36b666d6baf6db29eee831 (patch)
treeace703f9c298b2b1d5f9d1f8a2289b03b8de0212 /system/database/drivers/mysql/mysql_forge.php
parent5e16ec6b33ed6a80bf511b2bf6eb4fc5a1103c94 (diff)
parent27324cd6ae2b076d3346e3585f312f7a61a5a897 (diff)
Automated merge with http://hg.ellislab.com/CodeIgniter-Reactor
Diffstat (limited to 'system/database/drivers/mysql/mysql_forge.php')
-rw-r--r--system/database/drivers/mysql/mysql_forge.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 8faf69550..35845d6af 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -87,11 +87,26 @@ class CI_DB_mysql_forge extends CI_DB_forge {
if (array_key_exists('TYPE', $attributes))
{
$sql .= ' '.$attributes['TYPE'];
- }
- if (array_key_exists('CONSTRAINT', $attributes))
- {
- $sql .= '('.$attributes['CONSTRAINT'].')';
+ if (array_key_exists('CONSTRAINT', $attributes))
+ {
+ switch ($attributes['TYPE'])
+ {
+ case 'decimal':
+ case 'float':
+ case 'numeric':
+ $sql .= '('.implode(',', $attributes['CONSTRAINT']).')';
+ break;
+
+ case 'enum':
+ case 'set':
+ $sql .= '("'.implode('","', $attributes['CONSTRAINT']).'")';
+ break;
+
+ default:
+ $sql .= '('.$attributes['CONSTRAINT'].')';
+ }
+ }
}
if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)