Dépot du script des tables de la base de donnée et script gestion des conversions
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
9e0ea8fd52
commit
91d835adbb
@ -0,0 +1,24 @@
|
||||
while [ 0 -eq 0 ]; do
|
||||
insert(){
|
||||
dev1="'$1'"
|
||||
dev2="'$2'"
|
||||
date=`date +"%d/%m/%Y:%H:%M:%S"`
|
||||
date2="'$date'"
|
||||
rep=`curl -s https://www.freeforexapi.com/api/live?pairs=$1$2 | grep rate | cut -d : -f 4 | cut -d , -f 1`
|
||||
echo 'DELETE from conversion WHERE device1='$dev1' AND device2='$dev2';INSERT INTO conversion VALUES ('$dev1', '$rep', '$dev2','$date2');' | PGPASSWORD=lulu psql -d piege -U lulu &> /dev/null
|
||||
rep=`curl -s https://www.freeforexapi.com/api/live?pairs=$2$1 | grep rate | cut -d : -f 4 | cut -d , -f 1`
|
||||
echo 'DELETE from conversion WHERE device1='$dev2' AND device2='$dev1';INSERT INTO conversion VALUES ('$dev2', '$rep', '$dev1','$date2');' | PGPASSWORD=amodif psql -d amodif -U amodif &> /dev/null
|
||||
}
|
||||
|
||||
insert EUR USD
|
||||
insert EUR GBP
|
||||
insert GBP USD
|
||||
insert USD JPY
|
||||
insert AUD USD
|
||||
insert USD CHF
|
||||
insert NZD USD
|
||||
insert EUR CAD
|
||||
insert ZAR USD
|
||||
sleep 10
|
||||
done
|
||||
|
@ -0,0 +1,96 @@
|
||||
DROP TABLE Planification;
|
||||
DROP TABLE Opération;
|
||||
DROP TABLE Echeancier;
|
||||
DROP TABLE Compte;
|
||||
DROP TABLE Banque;
|
||||
DROP TABLE DeviseInscrit;
|
||||
DROP TABLE Inscrit;
|
||||
DROP TABLE Devise;
|
||||
|
||||
|
||||
CREATE TABLE Devise
|
||||
(
|
||||
id char(3) PRIMARY KEY,
|
||||
nom varchar(20)
|
||||
);
|
||||
|
||||
CREATE TABLE Inscrit
|
||||
(
|
||||
id char(5) PRIMARY KEY,
|
||||
nom varchar(40),
|
||||
prenom varchar(40),
|
||||
mail varchar(40),
|
||||
mdp varchar(40)
|
||||
);
|
||||
|
||||
CREATE TABLE DeviseInscrit
|
||||
(
|
||||
devise char(3),
|
||||
idInscrit char(5) UNIQUE,
|
||||
PRIMARY KEY(devise,idInscrit),
|
||||
FOREIGN KEY (devise) REFERENCES Devise(id),
|
||||
FOREIGN KEY (idInscrit) REFERENCES Inscrit(id)
|
||||
);
|
||||
|
||||
CREATE TABLE Banque
|
||||
(
|
||||
nom varchar(40) PRIMARY KEY,
|
||||
urlsite varchar(60),
|
||||
urllogo varchar(60)
|
||||
);
|
||||
|
||||
CREATE TABLE Compte
|
||||
(
|
||||
id char (5) PRIMARY KEY,
|
||||
nomBanque varchar(40),
|
||||
nom varchar(40),
|
||||
idInscrit char(5),
|
||||
FOREIGN KEY (nomBanque) REFERENCES Banque(nom),
|
||||
FOREIGN KEY (idInscrit) REFERENCES Inscrit(id),
|
||||
UNIQUE(nomBanque,nom,idInscrit)
|
||||
);
|
||||
|
||||
CREATE TABLE Echeancier
|
||||
(
|
||||
id char(5) PRIMARY KEY,
|
||||
nom varchar(40),
|
||||
credit numeric,
|
||||
compte char(5),
|
||||
debit numeric,
|
||||
dateE date,
|
||||
datecrea date,
|
||||
methodePayement varchar(20),
|
||||
CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')),
|
||||
FOREIGN KEY(compte) REFERENCES Compte(id),
|
||||
UNIQUE (datecrea,compte)
|
||||
);
|
||||
|
||||
CREATE TABLE Opération
|
||||
(
|
||||
id char(5) PRIMARY KEY,
|
||||
nom varchar(40),
|
||||
credit numeric,
|
||||
compte char(5),
|
||||
debit numeric,
|
||||
dateO date,
|
||||
datecrea date,
|
||||
methodePayement varchar(20),
|
||||
CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')),
|
||||
FOREIGN KEY(compte) REFERENCES Compte(id),
|
||||
UNIQUE (datecrea,compte)
|
||||
);
|
||||
|
||||
CREATE TABLE Planification
|
||||
(
|
||||
id char(5) PRIMARY KEY,
|
||||
nom varchar(40),
|
||||
credit numeric,
|
||||
compte char(5),
|
||||
debit numeric,
|
||||
dateP date,
|
||||
datecrea date,
|
||||
methodePayement varchar(20),
|
||||
CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')),
|
||||
FOREIGN KEY(compte) REFERENCES Compte(id),
|
||||
UNIQUE (datecrea,compte)
|
||||
);
|
Loading…
Reference in new issue