2021-04-17 06:52:52 +00:00
|
|
|
#!/bin/bash
|
2020-02-10 13:06:48 +00:00
|
|
|
|
2021-04-17 06:52:52 +00:00
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
|
|
|
# argument 1 = millesime redadeg
|
|
|
|
millesime=$1
|
2021-03-10 08:43:43 +00:00
|
|
|
|
|
|
|
PSQL=/usr/bin/psql
|
|
|
|
DB_HOST=localhost
|
|
|
|
DB_NAME=redadeg_$millesime
|
2021-04-17 06:52:52 +00:00
|
|
|
DB_USER=redadeg
|
|
|
|
DB_PASSWD=redadeg
|
|
|
|
|
2021-03-10 08:43:43 +00:00
|
|
|
|
2021-04-17 06:52:52 +00:00
|
|
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
echo " Création des tables dans la base de données $DB_NAME"
|
|
|
|
echo ""
|
|
|
|
echo ""
|
2020-02-10 13:06:48 +00:00
|
|
|
|
|
|
|
# suppression d'abord
|
2021-03-10 08:43:43 +00:00
|
|
|
psql -h $DB_HOST -U redadeg -d $DB_NAME < drop_tables.sql
|
2020-02-10 13:06:48 +00:00
|
|
|
|
|
|
|
# création
|
2021-03-10 08:43:43 +00:00
|
|
|
psql -h $DB_HOST -U redadeg -d $DB_NAME < create_tables.sql
|
2020-02-10 13:06:48 +00:00
|
|
|
|
2021-03-10 08:43:43 +00:00
|
|
|
# initialisation de la table de référence des secteurs pour le millésime
|
|
|
|
psql -h $DB_HOST -U redadeg -d $DB_NAME < ../data/$millesime/update_infos_secteurs.sql
|
2020-02-10 16:24:46 +00:00
|
|
|
|