summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-02-02 13:01:50 +0100
committerAndrey Andreev <narf@devilix.net>2016-02-02 13:01:50 +0100
commite54c461d77ffce9f10999ca51bb2e3932304639b (patch)
treeca3a7178d9278ae2ec9def06c33eed7d159511cf /user_guide_src
parentf5307e3b368355d426f0a546404efbef24bba5eb (diff)
parentea07f04725c56730d4b99d5f215d6e09edb54df6 (diff)
Merge pull request #4419 from EpicKris/hotfix/database-forge-unique-doc
[ci skip] Added docs for UNIQUE keys in DBForge
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..5af4f2248 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/true : 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