2025-08-31 09:40:56 +02:00
|
|
|
create extension if not exists ltree;
|
|
|
|
|
|
2025-08-28 11:45:01 +02:00
|
|
|
create table adherent (
|
|
|
|
|
id int primary key,
|
|
|
|
|
nom text,
|
|
|
|
|
prenom text,
|
2025-08-29 07:30:55 +02:00
|
|
|
genre smallint,
|
2025-08-28 11:45:01 +02:00
|
|
|
naissance date,
|
2025-08-28 15:01:31 +02:00
|
|
|
codepostal text
|
2025-08-28 11:45:01 +02:00
|
|
|
);
|
|
|
|
|
|
2025-08-28 07:13:19 +02:00
|
|
|
create table famille (
|
2025-08-28 13:54:30 +02:00
|
|
|
code text primary key,
|
|
|
|
|
famille text,
|
2025-08-31 09:40:56 +02:00
|
|
|
code_parent text, -- references famille(code)
|
|
|
|
|
arborescence ltree
|
2025-08-28 07:13:19 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
create table article (
|
|
|
|
|
code text primary key,
|
|
|
|
|
article text,
|
2025-08-29 11:18:26 +02:00
|
|
|
famille_code text, -- references famille(code)
|
2025-08-31 09:40:56 +02:00
|
|
|
factpoids boolean,
|
2025-08-28 07:13:19 +02:00
|
|
|
unitevente int,
|
|
|
|
|
prix decimal,
|
2025-08-29 22:12:55 +02:00
|
|
|
suivistock int
|
2025-08-28 07:13:19 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
create table ticket (
|
|
|
|
|
id int primary key,
|
2025-08-28 11:45:01 +02:00
|
|
|
date_ticket timestamp,
|
2025-08-29 11:18:26 +02:00
|
|
|
adherent_id int, -- references adherent(id)
|
2025-08-28 11:29:31 +02:00
|
|
|
mode_rglt int
|
2025-08-28 07:13:19 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
create table ligne (
|
|
|
|
|
id int primary key,
|
|
|
|
|
ticket_id int, --references ticket (id),
|
2025-08-29 07:44:17 +02:00
|
|
|
article_code text, -- references article (code)
|
2025-08-28 07:13:19 +02:00
|
|
|
prix_unitaire decimal,
|
2025-08-28 09:38:07 +02:00
|
|
|
quantite decimal
|
2025-08-28 07:13:19 +02:00
|
|
|
);
|