summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
authorKristian Matthews <kristian.matthews@me.com>2016-01-31 16:54:30 +0100
committerKristian Matthews <kristian.matthews@me.com>2016-01-31 16:54:30 +0100
commitf51ef09e34f049911af99332f937ebaf723c129e (patch)
treefcaa7c00e5bf184b04049e54e9e3fa917a8545ae /user_guide_src
parent3c6ace766c449e0a260587896e25d9971de6d812 (diff)
Added Unique Field Attribute Doc
Signed-off-by: Kristian Matthews <kristian.matthews@me.com>
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/database/forge.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst
index 646e3a56e..cb5c35662 100644
--- a/user_guide_src/source/database/forge.rst
+++ b/user_guide_src/source/database/forge.rst
@@ -97,6 +97,7 @@ Additionally, the following key/values can be used:
- auto_increment/true : generates an auto_increment flag on the
field. Note that the field type must be a type that supports this,
such as integer.
+- unique/false : to generate a unique key for the field definition.
::
@@ -110,6 +111,7 @@ Additionally, the following key/values can be used:
'blog_title' => array(
'type' => 'VARCHAR',
'constraint' => '100',
+ 'unique' => TRUE,
),
'blog_author' => array(
'type' =>'VARCHAR',
@@ -175,14 +177,14 @@ below is for MySQL.
$this->dbforge->add_key('blog_id', TRUE);
// 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` (`blog_name`)
-
+
$this->dbforge->add_key(array('blog_name', 'blog_label'));
// gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)
@@ -261,7 +263,7 @@ number of additional fields.
$fields = array(
'preferences' => array('type' => 'TEXT')
);
- $this->dbforge->add_column('table_name', $fields);
+ $this->dbforge->add_column('table_name', $fields);
// Executes: ALTER TABLE table_name ADD preferences TEXT
If you are using MySQL or CUBIRD, then you can take advantage of their