Create a database

The first thing you need is an up and running Postgres daemon. Then you can create a database and fill it with tables.

The sample application

For an easy introduction, I'll use some parts of the WebDiary application as a sample. Here is the entity-association view of the database (sorry the labels are in French):

rdv is for appointment, gens is for people, lieux is for addresses and vacance is for holidays.

From this it's easy to write the SQL statements that will create the database:

create table gens (nom varchar, prenom varchar, date date, com1 varchar,
                   primsup bool, etml float4, einev float4, perdu bool);
create unique index oidindex on gens using btree (oid oid_ops);

create table lieux (gens oid, descr varchar, adresse varchar, phone varchar,
                    email varchar, homepage varchar);

create table rdv (resume varchar, debut datetime, fin datetime, alarme int,
                  detail varchar, prive bool, confirme bool);

create table contact (rdv oid, adresse oid);

create table vacance (resume varchar, debut date, fin date,
                      detail varchar);

grant all on gens,lieux,rdv,contact,vacance to nobody;

I added an index creation and I am granting all to nobody (my httpd UID).

You must now define the views.


Valsecchi Patrick
Last modified: Thu Oct 15 09:44:36 MEST 1998