From 07cbafe799fb9af2130fc5412d95143eda33f68e Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 25 Jan 2007 12:34:03 +0000 Subject: [PATCH] More docs for the usage of indexes --- ...ing started - Indexes - Adding indexes.php | 70 +++++++++++++++++++ ...ting started - Indexes - Index options.php | 20 ++++++ ...ng started - Indexes - Special indexes.php | 22 ++++++ 3 files changed, 112 insertions(+) create mode 100644 manual/docs/Getting started - Indexes - Adding indexes.php create mode 100644 manual/docs/Getting started - Indexes - Index options.php create mode 100644 manual/docs/Getting started - Indexes - Special indexes.php diff --git a/manual/docs/Getting started - Indexes - Adding indexes.php b/manual/docs/Getting started - Indexes - Adding indexes.php new file mode 100644 index 000000000..14af7ea2a --- /dev/null +++ b/manual/docs/Getting started - Indexes - Adding indexes.php @@ -0,0 +1,70 @@ + +You can add indexes by simple calling Doctrine_Record::option('index', $definition) where $definition is the +definition array. The structure of the definition array is as follows: +
+
+[   indexName1 => [col1 => [col1-options], ... , colN => [colN-options]
+    indexName2 => ...
+    indexNameN => ]
+
+
+

+An example of adding a simple index to field called 'name': +

+hasColumn('name', 'string'); + } + public function setUp() + { + \$this->option('index', array('myindex' => 'name')); + } +} +?>"); +?> +

+An example of adding a multi-column index to field called 'name': +

+hasColumn('name', 'string'); + \$this->hasColumn('code', 'string'); + } + public function setUp() + { + \$this->option('index', array('myindex' => array('name', 'code'))); + } +} +?>"); +?> +

+An example of adding a multiple indexes on same table: +

+hasColumn('name', 'string'); + \$this->hasColumn('code', 'string'); + \$this->hasColumn('age', 'integer'); + } + public function setUp() + { + \$this->option('index', + array('myindex' => array('name', 'code') + 'ageindex' => 'age') + ); + } +} +?>"); +?> diff --git a/manual/docs/Getting started - Indexes - Index options.php b/manual/docs/Getting started - Indexes - Index options.php new file mode 100644 index 000000000..adb4d767b --- /dev/null +++ b/manual/docs/Getting started - Indexes - Index options.php @@ -0,0 +1,20 @@ + +Doctrine offers many index options, some of them being db-specific. Here is a full list of availible options: +
+
+unique      => boolean(true / false)        
+        whether or not the index is unique index
+
+sorting     => string('ASC' / 'DESC')      
+        what kind of sorting does the index use (ascending / descending)
+
+primary     => boolean(true / false)        
+        whether or not the index is primary index
+
+fulltext    => boolean(true / false)        
+        whether or not the specified index is a FULLTEXT index (only availible on Mysql)
+        
+gist        => boolean(true / false)        
+        whether or not the specified index is a GiST index (only availible on Pgsql)
+
+
diff --git a/manual/docs/Getting started - Indexes - Special indexes.php b/manual/docs/Getting started - Indexes - Special indexes.php new file mode 100644 index 000000000..423125891 --- /dev/null +++ b/manual/docs/Getting started - Indexes - Special indexes.php @@ -0,0 +1,22 @@ + +Doctrine supports many special indexes. These include Mysql FULLTEXT and Pgsql GiST indexes. +In the following example we define a Mysql FULLTEXT index for the field 'content'. +

+hasColumn('name', 'string'); + \$this->hasColumn('content', 'string'); + } + public function setUp() + { + \$this->option('index', + array('content' => + array('content' => + array('fulltext' => true)); + } +} +?>");