2025-08-28 07:13:19 +02:00
|
|
|
create table famille (
|
|
|
|
|
famille text primary key,
|
|
|
|
|
intitule text,
|
|
|
|
|
type int,
|
|
|
|
|
unite int
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
\COPY famille FROM '/tmp/famille.csv' (FORMAT CSV, header, ENCODING 'UTF8');
|
|
|
|
|
|
|
|
|
|
create table article (
|
|
|
|
|
code text primary key,
|
|
|
|
|
edi text,
|
|
|
|
|
stat1 text,
|
|
|
|
|
stat2 text,
|
|
|
|
|
article text,
|
|
|
|
|
famille text, -- references famille(famille)
|
|
|
|
|
factpoids int,
|
|
|
|
|
unitevente int,
|
|
|
|
|
prix decimal,
|
|
|
|
|
unitepoids int,
|
|
|
|
|
publie int,
|
|
|
|
|
suivistock int,
|
|
|
|
|
sommeil int
|
|
|
|
|
);
|
|
|
|
|
|
2025-08-28 09:38:07 +02:00
|
|
|
\COPY article FROM '/tmp/article.csv' (FORMAT CSV, header, ENCODING 'UTF8');
|
2025-08-28 07:13:19 +02:00
|
|
|
|
|
|
|
|
create table ticket (
|
|
|
|
|
id int primary key,
|
|
|
|
|
horodatage timestamp,
|
|
|
|
|
client text,
|
|
|
|
|
mode_rglt int,
|
|
|
|
|
etat int,
|
|
|
|
|
facture text
|
|
|
|
|
);
|
|
|
|
|
|
2025-08-28 09:38:07 +02:00
|
|
|
\COPY ticket FROM '/tmp/ticket.csv' (FORMAT CSV, header, ENCODING 'UTF8');
|
2025-08-28 07:13:19 +02:00
|
|
|
|
|
|
|
|
create table ligne (
|
|
|
|
|
id int primary key,
|
|
|
|
|
ticket_id int, --references ticket (id),
|
|
|
|
|
article text, -- references article (code)
|
|
|
|
|
prix_unitaire decimal,
|
2025-08-28 09:38:07 +02:00
|
|
|
quantite decimal
|
2025-08-28 07:13:19 +02:00
|
|
|
);
|
|
|
|
|
|
2025-08-28 09:38:07 +02:00
|
|
|
\COPY ligne FROM '/tmp/ligne.csv' (FORMAT CSV, header, ENCODING 'UTF8');
|