schema: carte

This commit is contained in:
2025-10-31 07:42:56 +01:00
parent df20777670
commit 38c1028860
6 changed files with 214 additions and 35 deletions

View File

@@ -1,4 +1,9 @@
show server_version;
-- ----------------------------------------------------------------------
-- extensions
-- ----------------------------------------------------------------------
select * from pg_available_extensions;
create schema postgis;
@@ -8,12 +13,14 @@ create extension if not exists pgrouting schema postgis;
create schema ext;
create extension if not exists ltree schema ext;
create extension if not exists pgcrypto schema ext;
create extension if not exists vector schema ext;
create extension if not exists isn;
create schema pgtap;
create extension if not exists pgtap schema pgtap;
-- ----------------------------------------------------------------------
-- pays
-- Pays
-- ----------------------------------------------------------------------
create table pays (
code2 text not null,
@@ -186,6 +193,64 @@ alter table only pays_devises
select '=============== FIN DES CLES ETRANGERES Geo' as msg;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- Fournisseurs
-- ----------------------------------------------------------------------
create table fournisseur (
id int primary key,
fournisseur text not null
);
-- ----------------------------------------------------------------------
-- Produits
-- ----------------------------------------------------------------------
create table produit (
id bigint primary key,
ean13 EAN13 null,
nom text not null,
marque text null,
categorie text null,
energie int not null,
proteines float4 null,
glucides float4 null,
sucres float4 null,
graisses float4 null,
graisses_saturees float4 null,
sel float4 null,
fibres float4 null,
nutriscore int null,
additifs int null,
additifs_list text[] null,
potassium float null,
calcium float null,
magnesium float null,
sodium float null,
chlorure float null,
sulfate float null,
nitrate float null,
hydrogenocarbonate float null,
silice float null,
fluor float null,
residu float null,
ph float null,
vitamin_a float null,
vitamin_c float null
);
-- Ajouter les commentaires
comment on column produit.potassium IS 'K⁺ en mg/L';
comment on column produit.calcium IS 'Ca²⁺ en mg/L';
comment on column produit.magnesium IS 'Mg²⁺ en mg/L';
comment on column produit.sodium IS 'Na⁺ en mg/L';
comment on column produit.chlorure IS 'Cl⁻ en mg/L';
comment on column produit.sulfate IS 'SO₄²⁻ en mg/L';
comment on column produit.nitrate IS 'NO₃⁻ en mg/L';
comment on column produit.hydrogenocarbonate IS 'HCO₃⁻ en mg/L';
comment on column produit.silice IS 'SiO₂ en mg/L';
comment on column produit.fluor IS 'F en mg/L';
create table adherent (
id int primary key,
nom text,
@@ -232,12 +297,13 @@ alter table ligne
create table marque (
id int primary key,
marque text not null
marque text not null,
fournisseur_id int
);
create table fournisseur (
create table categorie (
id int primary key,
fournisseur text not null
categorie text not null
);
create table region (
@@ -246,4 +312,25 @@ create table region (
);
insert into region values
(1, 'Est'), (2, 'Ouest');
(1, 'Est'), (2, 'Ouest'), (3, 'Nord'), (4, 'Sud'), (5, 'Centre');
CREATE TABLE genres (
genre_id int primary key,
genre text
);
INSERT INTO genres (genre_id, genre) VALUES
(1,'Science-Fiction'),
(2,'Fantasy'),
(3,'Young adult'),
(4,'Bit-lit'),
(5,'Policier'),
(6,'Romance'),
(7,'Espionnage'),
(8,'Aventure'),
(9,'Fantastique'),
(10,'Historique'),
(11,'Noir'),
(12,'Biographie'),
(13,'Cyberpunk'),
(14,'Steampunk');