Question About MDB2_Schema and Indexes
| From: | Michael Caplan | Date: | Tue, 27 Jun 2006 12:08:41 +0000 |
| Subject: | Question About MDB2_Schema and Indexes | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24483@lists.php.net to get a copy of this message | ||
Hi There,
I'm trying to create a MDB2 schema for two tables. Each tables include a primary key, as well as one or more column indexes. I'm having an issue with the column indexes which I am writing out like this (see the complete schema below):
...
<index>
<name>primary</name>
<primary>true</primary>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>module_action_params</name>
<primary>false</primary>
<field>
<name>view</name>
<sorting>ascending</sorting>
</field>
<field>
<name>module</name>
<sorting>ascending</sorting>
</field>
<field>
<name>action</name>
<sorting>ascending</sorting>
</field>
<field>
<name>params</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>path</name>
<field>
<name>path</name>
<sorting>ascending</sorting>
</field>
</index>
...
Perhaps I am writing out the indexes wrong, as I can't get the schema to validate against the latest MDB2_Schema DTD (validator complains about multiple instances of index elements). What results when running MD2_Schema::updateDatabase() (against the MDB2 mysqli driver) is an SQL with the following generated SQL (KEY is missing):
ALTER TABLE core_request_map ADD module_action_params_idx (view, module, action, params)
Anyone ideas what's wrong with my schema?
Thanks,
Michael
--
Michael Caplan - Zend Certified PHP Engineer
Programming Manager
Apison Communications
Suite 110, 151 Provost Street
New Glasgow, NS, Canada B2H 2P6
Phone: (902) 695-3375
Toll Free: (800) 845-6998
Fax: (902) 695-7777
email: michael@apison.com
URL: http://www.apison.com
Specializing in web development, graphic design and Internet marketing
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database SYSTEM "http://cvs.php.net/viewvc.cgi/pear/MDB2_Schema/docs/MDB.dtd?revision=1.3">
<database>
<name>framework</name>
<create>true</create>
<overwrite>false</overwrite>
<table>
<name>core_request_map</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<unsigned>true</unsigned>
<length>4</length>
<notnull>true</notnull>
<default/>
</field>
<field>
<name>path</name>
<type>text</type>
<length>255</length>
<notnull>true</notnull>
<default>/</default>
</field>
<field>
<name>view</name>
<type>text</type>
<length>40</length>
<notnull>true</notnull>
<default>public</default>
</field>
<field>
<name>module</name>
<type>text</type>
<length>40</length>
<notnull>false</notnull>
<default/>
</field>
<field>
<name>action</name>
<type>text</type>
<length>40</length>
<notnull>false</notnull>
<default/>
</field>
<field>
<name>params</name>
<type>text</type>
<length>255</length>
<notnull>false</notnull>
<default/>
</field>
<index>
<name>primary</name>
<primary>true</primary>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>module_action_params</name>
<primary>false</primary>
<field>
<name>view</name>
<sorting>ascending</sorting>
</field>
<field>
<name>module</name>
<sorting>ascending</sorting>
</field>
<field>
<name>action</name>
<sorting>ascending</sorting>
</field>
<field>
<name>params</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>path</name>
<field>
<name>path</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
<table>
<name>core_request_map_attrib</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<unsigned>true</unsigned>
<length>4</length>
<notnull>true</notnull>
<default/>
</field>
<field>
<name>locale</name>
<type>text</type>
<length>5</length>
<notnull>true</notnull>
<default/>
</field>
<field>
<name>identifier</name>
<type>text</type>
<length>100</length>
<notnull>true</notnull>
<default/>
</field>
<field>
<name>title</name>
<type>text</type>
<length>100</length>
<notnull>true</notnull>
<default/>
</field>
<field>
<name>description</name>
<type>text</type>
<length>255</length>
<notnull>false</notnull>
<default/>
</field>
<index>
<name>primary</name>
<primary>true</primary>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
<field>
<name>locale</name>
<sorting>ascending</sorting>
</field>
</index>
<index>
<name>identifier</name>
<field>
<name>identifier</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
</database>