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

86 lines
1.9 KiB
MySQL
Raw Normal View History

2025-09-01 07:56:13 +02:00
create extension if not exists ltree;
create extension if not exists pgtap;
create extension if not exists postgis;
create extension if not exists pgrouting;
2025-09-04 09:48:38 +02:00
create extension if not exists pgcrypto;
2025-09-01 07:56:13 +02:00
create table adherent (
id int primary key,
nom text,
prenom text,
genre smallint,
naissance date,
codepostal text
);
create table famille (
code text primary key,
famille text,
code_parent text, -- references famille(code)
arborescence ltree
);
create table article (
code text primary key,
article text,
famille_code text, -- references famille(code)
factpoids boolean,
unitevente int,
prix decimal,
suivistock int
);
create table ticket (
id int primary key,
date_ticket timestamp,
adherent_id int, -- references adherent(id)
mode_rglt int
);
create table ligne (
id int primary key,
ticket_id int, --references ticket (id),
article_code text, -- references article (code)
prix_unitaire decimal,
quantite decimal
);
2025-09-12 12:54:16 +02:00
2025-09-14 22:12:09 +02:00
create table marque (
id int primary key,
marque text not null
);
2025-09-12 12:54:16 +02:00
create table fournisseur (
id int primary key,
fournisseur text not null
);
2025-09-12 22:14:49 +02:00
create table region (
2025-09-12 12:54:16 +02:00
id int primary key,
region text not null
);
2025-09-12 22:14:49 +02:00
insert into region values
(1, 'Est'), (2, 'Ouest');
2025-09-15 11:35:13 +02:00
2025-09-16 11:53:04 +02:00
-- Apache Superset
create database superset;
create user superset with password 'supermotdepasse';
grant all privileges on database superset to superset;
2025-09-16 12:00:04 +02:00
grant connect on database sql to superset;
grant usage on schema public to superset;
grant select on table famille, article to superset;
-- Pour toutes les tables dun schéma existant
grant select on all tables in schema public to superset;
-- Privilège par défaut pour que chaque nouvelle table créée dans public donnera automatiquement le droit SELECT à superset.
alter default privileges in schema public
grant select on tables to superset;
2025-09-16 11:53:04 +02:00
\c superset
alter schema public owner to superset;
grant all privileges on schema public to superset;