summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-01-27 12:56:45 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-01-27 12:56:45 +0100
commit3bb336cf1c55584bb92ed32563a9543ec7f01574 (patch)
tree76c2d963be0b7c70705369ca4a9f82946df8bba8 /system/database/drivers
parent7d3a1894be6b1722c668d73ce53533bb72cc237c (diff)
parent705a3eec44635f3fada8daa2886d409e6447ca12 (diff)
Automated merge with https://bitbucket.org/ellislab/codeigniter
Diffstat (limited to 'system/database/drivers')
-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 c02b8cb3a..529ec980d 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)