diff --git a/banque.tables.md b/banque.tables.md index e08d21d..718d95a 100644 --- a/banque.tables.md +++ b/banque.tables.md @@ -30,10 +30,10 @@ Création de la table `person`. ```sql create table person ( - "id" bigint primary key references holder(id), - "firstname" text, - "lastname" text, - "birthdate" date + "id" bigint primary key references holder(id) on delete cascade, + "firstname" text not null, + "lastname" text not null, + "birthdate" date not null check (birthdate <= current_date - interval '15 years') ); ``` @@ -41,9 +41,10 @@ create table person ( ```sql create table company ( - "id" bigint primary key references holder(id), - "name" text, - "creation_date" date + "id" bigint primary key references holder(id) on delete cascade, + "name" text not null, + "registration_number" text unique not null, + "creation_date" date not null ); ``` diff --git a/banque/banque.1.tables.sql b/banque/banque.1.tables.sql index 4e16341..2944ee0 100644 --- a/banque/banque.1.tables.sql +++ b/banque/banque.1.tables.sql @@ -3,12 +3,7 @@ create schema bank; set search_path TO bank; /************************************************************************ - * Holder : table commune à tous les titulaires - * bigint : entier sur 64 bits - * primary key : clé primaire, identification unique de l'enregistrement - * generated always as identity : numéro incrément automatique 1, 2, 3 ... - * Le type est forcé aux 3 valeurs de l'énumération holder_type - * current_timestamp date et heure courante. Version moderne de now() + ************************************************************************/ create type holder_type as enum ('BANK', 'PERSON', 'COMPANY'); @@ -52,7 +47,7 @@ create table company ( "id" bigint primary key references holder(id) on delete cascade, "name" text not null, "registration_number" text unique not null, - "created_at" date not null + "creation_date" date not null ); /************************************************************************