logo-radria.gif
   
Blog Download Documentation Forum Tasks Home
Blog Download Documentation Forum Tasks Home
barside-right.gif
barside-left.gif
logo-sql.gif





Database structure convention

Each table must have a unique index (Primary Key) named with the following convention: id<tablename>.

To create this index with MySQL you create an integer field with name id<tablename> and with option auto_increment and set it as a PRIMARY KEY.

 CREATE TABLE person (
 idperson INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY
 );

Here is an example of how to create the index with PostgreSQL :

CREATE TABLE person (
  idperson   SERIAL,
  name TEXT
);

It is automatically translated into this:

CREATE SEQUENCE person_idperson_seq;
CREATE TABLE person (
  idperson INT4 NOT NULL DEFAULT NEXTVAL('person_idperson_seq'),
  name TEXT
);
CREATE UNIQUE INDEX person_id_key ON person ( id );

For each field you've created, you will need to map it to a field type in the registry by creating or editing the registry file for that table.

 
core/registry/table_structure.txt · Last modified: 2007/08/28 17:42 by 71.160.191.33
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki