summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-12 11:51:14 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-12 11:51:14 +0100
commitb67277b8063b0e6aab051ce269194255ef83e808 (patch)
treef0ce631b9ee3134de2cf009e4d5f02401f31aaac /system/database/drivers/mysql
parentb0a97c100f5e7edc5e21ec7d07f768cd3b5618da (diff)
Bring back the AFTER clause for DB Forge add_column()
(it was temporarily removed due to multiple inconsistencies with other drivers) This commit also fixes issue #1988. Also added support for the FIRST clause (again, MySQL and CUBRID only).
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r--system/database/drivers/mysql/mysql_forge.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index d4a8b4ff7..6c5dfc665 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -148,6 +148,14 @@ class CI_DB_mysql_forge extends CI_DB_forge {
*/
protected function _process_column($field)
{
+ $extra_clause = isset($field['after'])
+ ? ' AFTER '.$this->db->escape_identifiers($field['after']) : '';
+
+ if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE)
+ {
+ $extra_clause = ' FIRST';
+ }
+
return $this->db->escape_identifiers($field['name'])
.(empty($field['new_name']) ? '' : $this->db->escape_identifiers($field['new_name']))
.' '.$field['type'].$field['length']
@@ -155,7 +163,8 @@ class CI_DB_mysql_forge extends CI_DB_forge {
.$field['null']
.$field['default']
.$field['auto_increment']
- .$field['unique'];
+ .$field['unique']
+ .$extra_clause;
}
// --------------------------------------------------------------------