diff options
Diffstat (limited to 'system/database/drivers/sqlite/sqlite_forge.php')
-rw-r--r-- | system/database/drivers/sqlite/sqlite_forge.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 0a1c156be..f6dd49043 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -103,18 +103,28 @@ class CI_DB_sqlite_forge extends CI_DB_forge { { $attributes = array_change_key_case($attributes, CASE_UPPER); - $sql .= "\n\t".$this->db->protect_identifiers($field) - .' '.$attributes['TYPE'] + $sql .= "\n\t".$this->db->protect_identifiers($field).' '.$attributes['TYPE']; - .( ! empty($attributes['CONSTRAINT']) ? '('.$attributes['CONSTRAINT'].')' : '') + empty($attributes['CONSTRAINT']) OR $sql .= '('.$attributes['CONSTRAINT'].')'; - .(( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) ? ' UNSIGNED' : '') + if ( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) + { + $sql .= ' UNSIGNED'; + } - .(isset($attributes['DEFAULT']) ? ' DEFAULT \''.$attributes['DEFAULT'].'\'' : '') + if (isset($attributes['DEFAULT'])) + { + $sql .= " DEFAULT'".$attributes['DEFAULT']."'"; + } - .(( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL') - .(( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) ? ' AUTO_INCREMENT' : ''); + $sql .= ( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE) + ? ' NULL' : ' NOT NULL'; + + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) + { + $sql .= ' AUTO_INCREMENT'; + } } // don't add a comma on the end of the last field |