summaryrefslogtreecommitdiffstats
path: root/system/database/DB_forge.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-20 14:03:43 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-20 14:03:43 +0100
commitea801ab4ab80042638ffddc6056483a1ec43fa80 (patch)
treef75f30c0df6a8f861ca7df22af09fa3240b0bbd6 /system/database/DB_forge.php
parent1c08d557a21ecb0f79cd1a1de4e06817a26e0537 (diff)
parent4d0571666d03511ac5b4a1f2a6882ccb1509a209 (diff)
Merge branch 'develop' into feature/user-guide-cleanup
Diffstat (limited to 'system/database/DB_forge.php')
-rw-r--r--system/database/DB_forge.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index d52029ecd..1cebb189c 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -740,6 +740,18 @@ abstract class CI_DB_forge {
'_literal' => FALSE
);
+ if ($create_table === FALSE)
+ {
+ if (isset($attributes['AFTER']))
+ {
+ $field['after'] = $attributes['AFTER'];
+ }
+ elseif (isset($attributes['FIRST']))
+ {
+ $field['first'] = (bool) $attributes['FIRST'];
+ }
+ }
+
$this->_attr_default($attributes, $field);
if (isset($attributes['NULL']))
@@ -748,11 +760,15 @@ abstract class CI_DB_forge {
{
$field['null'] = empty($this->_null) ? '' : ' '.$this->_null;
}
- elseif ($create_table === TRUE)
+ else
{
$field['null'] = ' NOT NULL';
}
}
+ elseif ($create_table === TRUE)
+ {
+ $field['null'] = ' NOT NULL';
+ }
$this->_attr_auto_increment($attributes, $field);
$this->_attr_unique($attributes, $field);
@@ -968,7 +984,6 @@ abstract class CI_DB_forge {
*/
protected function _process_indexes($table)
{
- $table = $this->db->escape_identifiers($table);
$sqls = array();
for ($i = 0, $c = count($this->keys); $i < $c; $i++)
@@ -992,7 +1007,7 @@ abstract class CI_DB_forge {
is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]);
- $sqls[] = 'CREATE INDEX '.$this->db->escape_identifiers(implode('_', $this->keys[$i]))
+ $sqls[] = 'CREATE INDEX '.$this->db->escape_identifiers($table.'_'.implode('_', $this->keys[$i]))
.' ON '.$this->db->escape_identifiers($table)
.' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).');';
}