Titulaires
This commit is contained in:
@@ -30,10 +30,10 @@ Création de la table `person`.
|
|||||||
|
|
||||||
```sql
|
```sql
|
||||||
create table person (
|
create table person (
|
||||||
"id" bigint primary key references holder(id),
|
"id" bigint primary key references holder(id) on delete cascade,
|
||||||
"firstname" text,
|
"firstname" text not null,
|
||||||
"lastname" text,
|
"lastname" text not null,
|
||||||
"birthdate" date
|
"birthdate" date not null check (birthdate <= current_date - interval '15 years')
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -41,9 +41,10 @@ create table person (
|
|||||||
|
|
||||||
```sql
|
```sql
|
||||||
create table company (
|
create table company (
|
||||||
"id" bigint primary key references holder(id),
|
"id" bigint primary key references holder(id) on delete cascade,
|
||||||
"name" text,
|
"name" text not null,
|
||||||
"creation_date" date
|
"registration_number" text unique not null,
|
||||||
|
"creation_date" date not null
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ create schema bank;
|
|||||||
set search_path TO 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');
|
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,
|
"id" bigint primary key references holder(id) on delete cascade,
|
||||||
"name" text not null,
|
"name" text not null,
|
||||||
"registration_number" text unique not null,
|
"registration_number" text unique not null,
|
||||||
"created_at" date not null
|
"creation_date" date not null
|
||||||
);
|
);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user