From: Alex B. <en...@tu...> - 2001-08-15 20:07:39
|
hi all, this is a large xml file, sorry... but this is a near-final entity definition format for r2. have a read, let's discuss this and get it final :) best, _alex -------------------------------- <entity> <!-- the name of the entity --> <name>furbees</name> <!-- db-related stuff for compatibility with metabase. this allows for auto-generation of metabase schema files from entity definitions --> <database> <!-- the db name to use when creating tables or databases --> <name>binarycloud_db</name> <!-- create the database? --> <create>0</create> <!-- the table this entity references --> <table> <!-- table name --> <name>furbee</name> <!-- an index declaration for the primary key --> <index> <name>furbee_id</name> <unique>1</unique> <field> <name>furbee_id</name> </field> </index> </table> <!-- a database sequence for the primary key --> <sequence> <name>furbee_id</name> <start>1</start> <on> <table>furbee</table> <field>furbee_id</field> </on> </sequence> </database> <!-- field definitions are the 'heart' of an entity these definitions carry all of the information necessary to create schemas, do validation, and label fields in html. --> <fields> <field> <!-- the field name --> <name>furbee_id</name> <!-- the field label, or "full name" --> <label>Furbee ID</label> <!-- the description of the field --> <desc>Unique ID for ever Furbee</desc> <!-- the path in the entity --> <path>furbee_id</path> <!-- must this field be valid to do a post of this entity? --> <required>true</required> <type> <!-- is this the default field in the db table? --> <default>0</default> <!-- can the field be null? --> <notnull>1</notnull> <!-- what is the simple, 'database' type of this field? --> <dbtype>text</dbtype> <!-- what is the complex 'application' type of this field? --> <type>text</type> <!-- if you don't understand the difference between dbtype and type, an email address is put in a text field in a db, but must be validates as an email address. --> <!-- the maximum number of chars allowed in input fields and posts --> <maxlength>20</maxlength> <!-- a regex pattern which will be run against input --> <format>/[\s\w_\-\.]{1,20}/</format> <!-- note that type declarations will carry some regex from the system by default, for example we will have an "email" type which automatically does validation for you. --> </type> </field> <field> <name>furbee_type_id</name> <label>Furbee type ID</label> <desc>The id of the type of furbee</desc> <path>furbee_type_id</path> <required>true</required> <type> <dbtype>int</dbtype> <!-- note the "pointer" type this field is a pointer to another entity, and a foreign key in the database --> <type>pointer</type> <!-- form above, the entity name to use for requesting data from this pointer --> <entity>furbee_type</entity> <maxlength>20</maxlength> <format>/[\w\s_\-\.]{0,20}/</format> </type> </field> </fields> <!-- this should only be required to map old schemas to entities - under normal circumstances the fields should match names the entsource field is the path to the entity field, the dbtarget is the path to the database field. --> <schema> <map> <entsource>furbee_type_id</entsource> <dbtarget>furbee.furbeetypeid</dbtarget> </map> </schema> </entity> |