summaryrefslogtreecommitdiffstats
path: root/system/database/DB_forge.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-03-15 09:56:55 +0100
committerAndrey Andreev <narf@bofh.bg>2013-03-15 09:56:55 +0100
commit13f6eabafa655828a8c09b4ae0a58a2e3776c269 (patch)
tree4a469aab6c3004fc3e982c0c2ea8825c495de65b /system/database/DB_forge.php
parent73b69a0a9a454e2eafc56cffcfb99c7dcefe8de1 (diff)
Fix MSSQL ALTER TABLE ADD statement
An improved version of PR #2329
Diffstat (limited to 'system/database/DB_forge.php')
-rw-r--r--system/database/DB_forge.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 53cdd53b6..d52029ecd 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -680,8 +680,12 @@ abstract class CI_DB_forge {
return $sql.'DROP COLUMN '.$this->db->escape_identifiers($field);
}
+ $sql .= ($alter_type === 'ADD')
+ ? 'ADD '
+ : $alter_type.' COLUMN ';
+
$sqls = array();
- for ($i = 0, $c = count($field), $sql .= $alter_type.' COLUMN '; $i < $c; $i++)
+ for ($i = 0, $c = count($field); $i < $c; $i++)
{
$sqls[] = $sql
.($field[$i]['_literal'] !== FALSE ? $field[$i]['_literal'] : $this->_process_column($field[$i]));