diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-01-05 17:33:12 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-01-05 17:33:12 +0100 |
commit | c2e9225eec976326df36b666d6baf6db29eee831 (patch) | |
tree | ace703f9c298b2b1d5f9d1f8a2289b03b8de0212 /system/database | |
parent | 5e16ec6b33ed6a80bf511b2bf6eb4fc5a1103c94 (diff) | |
parent | 27324cd6ae2b076d3346e3585f312f7a61a5a897 (diff) |
Automated merge with http://hg.ellislab.com/CodeIgniter-Reactor
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/drivers/mysql/mysql_forge.php | 23 |
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) |