<?xml version="1.0" encoding="UTF-8" ?> <!-- ** * MDB2_Schema : MDB2_Schema self description as an example * Inline linked to the schema2html.xsl transform for html presentation * * @category DB * @package MDB2_Schema * @author Bertrand Gugger <bertrand@toggg.com> * @copyright 2006 bertrand Gugger * @license http://www.opensource.org/licenses/bsd-license.php BSD license * @version CVS: $Id: description.schema.xml,v 1.3 2006/04/22 18:18:38 toggg Exp $ * @link http://pear.php.net/package/MDB2_Schema * --> <!-- Link to the Transform case it's called in a browser --> <?xml-stylesheet href="schema2html.xsl" type="text/xsl" ?> <database> <name>MDB2_Schema</name> <description>MDB2_Schema self description</description> <comments>This is non authoritative but self described</comments> <create>1</create> <overwrite>0</overwrite> <!-- The root <database> itself --> <table> <name>database</name> <description>General database/schema configuration</description> <comments>It is the root element of a MDB2 Schema, must contain at least 1 <table> and eventually some <sequence></comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <description>Database name</description> <notnull>1</notnull> </field> <field> <name>create</name> <type>boolean</type> <description>Create new</description> <comments>0=Use a previously installed database , 1=Create the specified database</comments> <default>0</default> </field> <field> <name>overwrite</name> <type>boolean</type> <description>Overwrite previous</description> <comments>Overwrite previously created structures ?</comments> <default>0</default> </field> <field> <name>description</name> <type>text</type> <description>Database description</description> <comments>Ignored by the parser</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser</comments> </field> </declaration> </table> <!-- Table --> <table> <name>table</name> <description>Describes each table of the database</description> <comments>A child of <database>, must contain a <declaration> with at least 1 <field> and eventually some <index>.<br /> <table> may also have a <initialization> with some <insert></comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <notnull>1</notnull> <description>Table name</description> <comments>Should be better taken as some NMTOKEN , use ASCII no space better.</comments> </field> <field> <name>was</name> <type>text</type> <description>Table previous name</description> </field> <field> <name>description</name> <type>text</type> <description>Table description</description> <comments>Ignored by the parser</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser</comments> </field> <index> <name>name_index</name> <unique>1</unique> <field> <name>name</name> </field> <comments>Indicates that 2 tables should not have the same name within a database</comments> </index> </declaration> </table> <!-- Field --> <table> <name>field</name> <description>Describes each field in a table</description> <comments> <field> as a child of <declaration> so grand-child of <table> </comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <notnull>1</notnull> <description>Field name</description> <comments></comments> </field> <field> <name>was</name> <type>text</type> <description>Field previous name</description> </field> <field> <name>type</name> <type>text</type> <notnull>1</notnull> <description>Field type</description> <comments>Valid types: integer, text, boolean, date, timestamp, time, float, decimal, clob and blob. </comments> </field> <field> <name>default</name> <type>text</type> <description>Optional default value</description> </field> <field> <name>notnull</name> <type>boolean</type> <description>Field required</description> <comments>Must be set for fields belonging to an index (sql NOT NULL)</comments> <default>0</default> </field> <field> <name>autoincrement</name> <type>boolean</type> <description>Field auto increments</description> <comments>It's a not null integer field with a primary key. Not supported by all DBMS but may be emulated</comments> <default>0</default> </field> <field> <name>unsigned</name> <type>boolean</type> <description>Unsigned</description> <comments>Only for integer. Not supported by all DBMS</comments> <default>0</default> </field> <field> <name>length</name> <type>integer</type> <description>Length</description> <comments>Some types as "text" optionally offer it.</comments> </field> <field> <name>description</name> <type>text</type> <description>Field description</description> <comments>Ignored by the parser</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser</comments> </field> <index> <name>name_index</name> <unique>1</unique> <field> <name>name</name> </field> <comments>Indicates that 2 fields should not have the same name within a table</comments> </index> </declaration> </table> <!-- Index --> <table> <name>index</name> <description>Describes each index in a table</description> <comments>child of <declaration> so grand-child of <table></comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <notnull>1</notnull> <description>Index name</description> <comments></comments> </field> <field> <name>was</name> <type>text</type> <description>Index previous name</description> </field> <field> <name>unique</name> <type>boolean</type> <description>Index is unique</description> <comments>The combined value of the contained fields is unique</comments> <default>0</default> </field> <field> <name>primary</name> <type>boolean</type> <description>Table primary index</description> <comments></comments> <default>0</default> </field> <field> <name>description</name> <type>text</type> <description>Index description</description> <comments>Ignored by the parser, and not in 0.5.0 dtd</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser, and not in 0.5.0 dtd</comments> </field> <index> <name>name_index</name> <unique>1</unique> <field> <name>name</name> </field> <comments>Indicates that 2 indexes should not have the same name within a table</comments> </index> </declaration> </table> <!-- Index Field --> <table> <name>index_field</name> <description>Describes what fields make an index in a table</description> <comments><field> as a child of <index></comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <notnull>1</notnull> <description>Referenced field name</description> <comments>This should reference the name of some uncle <field></comments> </field> <field> <name>sorting</name> <type>text</type> <description>Field's order in the sort</description> <comments>Valid: ascending or descending</comments> </field> <field> <name>description</name> <type>text</type> <description>index field description</description> <comments>Ignored by the parser</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser</comments> </field> </declaration> </table> <!-- Insert field --> <table> <name>insert_field</name> <description>Describes each field in an insert for table initialization</description> <comments>child of <insert> from <initialization> so great-grand-child of <table></comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <notnull>1</notnull> <description>field name</description> <comments>This should reference the name of some grand-uncle <field></comments> </field> <field> <name>value</name> <type>text</type> <description>field value</description> </field> <field> <name>description</name> <type>text</type> <description>insert field description</description> <comments>Ignored by the parser</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser</comments> </field> </declaration> </table> <!-- Sequence --> <table> <name>sequence</name> <description>Describes each sequence of the database</description> <comments>A child of <database> , may contain one <on></comments> <declaration> <field> <name>name</name> <type>text</type><length></length> <notnull>1</notnull> <description>Sequence name</description> <comments></comments> </field> <field> <name>was</name> <type>text</type> <description>Sequence previous name</description> </field> <field> <name>start</name> <type>integer</type> <description>Sequence start value</description> </field> <field> <name>description</name> <type>text</type> <description>Sequence description</description> <comments>Ignored by the parser</comments> </field> <field> <name>comments</name> <type>text</type> <description>Free comments</description> <comments>Ignored by the parser</comments> </field> <index> <name>name_index</name> <unique>1</unique> <field> <name>name</name> </field> <comments>Indicates that 2 sequences should not have the same name within a database</comments> </index> </declaration> </table> </database>