summaryrefslogtreecommitdiffstats
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:02:44 +0100
commite8bcc9eeb4ccbbea78442275c646de21aaaa6594 (patch)
tree9684111d4aab95e2b2228aaf14d2215ce4b01373
parent391d339b921623ce921bdb5520fb93f9cf62fac5 (diff)
Merge pull request #4419 from EpicKris/hotfix/database-forge-unique-doc
[ci skip] Added docs for UNIQUE keys in DBForge
-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