summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2010-12-15 11:32:10 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2010-12-15 11:32:10 +0100
commita58ecae8e149fe8e1fa9ee3cc9c9ad23a67ab8b6 (patch)
tree5b9d3fd4a9ec6245eb77236d58e02ee129391872
parent2fae66e54bac9104acb2236aeffec80d1c794c4d (diff)
Name can be omiitted from ->dbforge->modify_column()'s 2nd param if you aren't changing the name.
-rw-r--r--system/database/DB_forge.php6
-rw-r--r--user_guide/database/forge.html2
2 files changed, 7 insertions, 1 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index f40eac82d..ce505f4ee 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -333,6 +333,12 @@ class CI_DB_forge {
foreach ($field as $k => $v)
{
+ // If no name provided, use the current name
+ if ( ! isset($field[$k]['name']))
+ {
+ $field[$k]['name'] = $k;
+ }
+
$this->add_field(array($k => $field[$k]));
if (count($this->fields) == 0)
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html
index 28b32d96a..b9e04428c 100644
--- a/user_guide/database/forge.html
+++ b/user_guide/database/forge.html
@@ -205,7 +205,7 @@ $this-&gt;dbforge-&gt;add_column('table_name', $fields);<br />
<p>Used to remove a column from a table. </p>
<p><code>$this-&gt;dbforge-&gt;drop_column('table_name', 'column_to_drop');</code></p>
<h2>$this-&gt;dbforge-&gt;modify_column()</h2>
-<p>The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to use it you must add a &quot;name&quot; key into the field defining array.</p>
+<p>The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to change the name you can add a &quot;name&quot; key into the field defining array.</p>
<p><code>$fields = array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'old_name' =&gt; array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' =&gt; 'new_name',<br />