Files
sql/docker-entrypoint-initdb.d/initdb.sql

43 lines
913 B
SQL

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,
article text,
famille text, -- references famille(famille)
factpoids int,
unitevente int,
prix decimal,
unitepoids int,
publie int,
suivistock int,
sommeil int
);
\COPY article FROM '/tmp/article.csv' (FORMAT CSV, header, ENCODING 'UTF8');
create table ticket (
id int primary key,
horodatage timestamp,
client text,
mode_rglt int
);
\COPY ticket FROM '/tmp/ticket.csv' (FORMAT CSV, header, ENCODING 'UTF8');
create table ligne (
id int primary key,
ticket_id int, --references ticket (id),
article text, -- references article (code)
prix_unitaire decimal,
quantite decimal
);
\COPY ligne FROM '/tmp/ligne.csv' (FORMAT CSV, header, ENCODING 'UTF8');