= Database Schema = The schema for {{{schema.xml}}} contains a small number of elements with required and optional attributes. The Propel generator contains a DTD (source:trunk/generator/dtd/database.dtd) that can be used to validate your {{{schema.xml}}} document. Also, when you build your SQL and OM, the Propel generator will automatically validate your {{{schema.xml}}} file using a new, highly-detailed XSD (source:trunk/generator/resources/xsd/database.xsd). == At-a-Glance == The hierarchical tree relationship for the elements is: {{{ #!xml
}}} == Detailed Reference == This page provides an alternate rendering of the Appendix B - Schema Reference from the user's guide. It spells out in specific detail, just where each attribute or element belongs. First, some conventions: * Text surrounded by a '''/''' is text that you would provide and is not defined in the language. (i.e. a table name is a good example of this.) * Optional items are surrounded by '''[''' and ''']''' characters. * Items where you have an alternative choice have a '''|''' character between them (i.e. true|false) * Alternative choices may be delimited by '''{''' and '''}''' to indicate that this is the default option, if not overridden elsewhere. * '''...''' means repeat the previous item. === element === Starting with the {{{}}} element. The ''attributes'' and ''elements'' available are: {{{ ... }}} The {{{package}}}, {{{baseClass}}}, {{{basePeer}}}, {{{defaultPhpNamingMethod}}}, and {{{heavyIndexing}}} attributes are generally optional. A Database element may include an {{{}}} element, or multiple {{{
}}} elements. === element === The {{{}}} element is pretty simple. It just includes a schema file from somewhere on the file systems. The format is: {{{ }}} ===
element === The {{{
}}} element is the most complicated of the usable elements. Its definition looks like this: {{{
... ... ... ... ...
}}} According to the schema, {{{name}}} is the only required attribute. Also, the {{{idMethod}}}, {{{phpNamingMethod}}}, {{{baseClass}}}, {{{basePeer}}}, and {{{heavyIndexing}}} attributes all default to what is specified by the {{{}}} element. === element === {{{ [] }}} === element === To link a column to another table use the following syntax: {{{ }}} === element === To create an index on one or more columns, use the following syntax: {{{ ... }}} In some cases your RDBMS may require you to specify an index size. === element === To create a unique index on one or more columns, use the following syntax: {{{ ... }}} In some cases your RDBMS may require you to specify an index size for unique indexes. === element === If you are using a database that uses sequences for auto-increment columns (e.g. PostgreSQL or Oracle), you can customize the name of the sequence using the tag: {{{ }}}