From bd4400988922b2560975a80498404d7ecd000c0b Mon Sep 17 00:00:00 2001
From: Derek Jones
Generally speaking, you'll want your table to have Keys. This is accomplished with $this->dbforge->add_key('field'). An optional second parameter set to TRUE will make it a primary key. Note that add_key() must be followed by a call to create_table().
+Multiple column non-primary keys must be sent as an array. Sample output below is for MySQL.
$this->dbforge->add_key('blog_id', TRUE);
- // gives PRIMARY KEY (blog_id)
+ // gives PRIMARY KEY `blog_id` (`blog_id`)
+ $this->dbforge->add_key('blog_id', TRUE);
+ $this->dbforge->add_key('site_id', TRUE);
+ // gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)
+
$this->dbforge->add_key('blog_name');
- // gives KEY (blog_name)
After fields and keys have been declared, you can create a new table with
$this->dbforge->create_table('table_name');
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`)
);
--
cgit v1.2.3-24-g4f1b