summaryrefslogtreecommitdiffstats
path: root/user_guide
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-05-29 19:52:11 +0200
committerDerek Jones <derek.jones@ellislab.com>2008-05-29 19:52:11 +0200
commitbd4400988922b2560975a80498404d7ecd000c0b (patch)
tree2c8630cd43f1a16700c53363578191de342fb3d4 /user_guide
parent9e11220c2b780ca3320deae7e91a272b84c88533 (diff)
made MySQL/MySQLi forge use explicitly named KEYs, added ability to specify multi-column non-primary keys in table creation
Diffstat (limited to 'user_guide')
-rw-r--r--user_guide/changelog.html2
-rw-r--r--user_guide/database/forge.html12
-rw-r--r--user_guide/libraries/trackback.html4
3 files changed, 14 insertions, 4 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 9e39cb4b0..b59b9ef9b 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -63,6 +63,8 @@ SVN Revision: not currently released</p>
<ul>
<li>Database
<ul>
+ <li>Modified MySQL/MySQLi Forge class to give explicit names to keys</li>
+ <li>Added ability to set multiple column non-primary keys to the <a href="database/forge.html">Forge class</a></li>
<li>Added ability to set additional database config values in <a href="database/connecting.html">DSN connections</a> via the query string.</li>
</ul>
</li>
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html
index f9363f4e3..f679a4f29 100644
--- a/user_guide/database/forge.html
+++ b/user_guide/database/forge.html
@@ -164,11 +164,19 @@ already be running, since the forge class relies on it.</p>
// gives id INT(9) NOT NULL AUTO_INCREMENT</code></p>
<h2><a name="add_key" id="add_key"></a>Adding Keys</h2>
<p>Generally speaking, you'll want your table to have Keys. This is accomplished with <dfn>$this-&gt;dbforge-&gt;add_key('field')</dfn>. An optional second parameter set to TRUE will make it a primary key. Note that <dfn>add_key()</dfn> must be followed by a call to <dfn>create_table()</dfn>.</p>
+<p>Multiple column non-primary keys must be sent as an array. Sample output below is for MySQL.</p>
<p><code>$this-&gt;dbforge-&gt;add_key('blog_id', TRUE);<br />
- // gives PRIMARY KEY (blog_id)<br />
+ // gives PRIMARY KEY `blog_id` (`blog_id`)<br />
<br />
+ $this-&gt;dbforge-&gt;add_key('blog_id', TRUE);<br />
+ $this-&gt;dbforge-&gt;add_key('site_id', TRUE);<br />
+ // gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)<br />
+ <br />
$this-&gt;dbforge-&gt;add_key('blog_name');<br />
- // gives KEY (blog_name)</code></p>
+ // gives KEY `blog_name` (`blog_name`)<br />
+ <br />
+ $this-&gt;dbforge-&gt;add_key(array('blog_name', 'blog_label'));<br />
+ // gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)</code></p>
<h2><a name="create_table" id="create_table"></a>Creating a table</h2>
<p>After fields and keys have been declared, you can create a new table with</p>
<p><code>$this-&gt;dbforge-&gt;create_table('table_name');<br />
diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html
index f86ccca02..4f60f5ab5 100644
--- a/user_guide/libraries/trackback.html
+++ b/user_guide/libraries/trackback.html
@@ -152,8 +152,8 @@ CREATE TABLE trackbacks (
blog_name varchar(100) NOT NULL,
tb_date int(10) NOT NULL,
ip_address varchar(16) NOT NULL,
- PRIMARY KEY (tb_id),
- KEY (entry_id)
+ PRIMARY KEY `tb_id` (`tb_id`),
+ KEY `entry_id` (`entry_id`)
);</textarea>