Compare commits
5 Commits
master
...
Documentat
Author | SHA1 | Date |
---|---|---|
Hug0lvt | 4dc209a8fe | 2 years ago |
Lucas EVARD | a9204cf152 | 2 years ago |
Hugo LIVET | d7e3839507 | 2 years ago |
Lucas EVARD | 91d835adbb | 2 years ago |
Nicolas MAYE | 9e0ea8fd52 | 2 years ago |
After Width: | Height: | Size: 446 KiB |
After Width: | Height: | Size: 132 KiB |
File diff suppressed because it is too large
Load Diff
@ -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,105 @@
|
||||
DROP TABLE Planification;
|
||||
DROP TABLE Opération;
|
||||
DROP TABLE Echeancier;
|
||||
DROP TABLE Compte;
|
||||
DROP TABLE InscrBanque;
|
||||
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 InscrBanque
|
||||
(
|
||||
id char(5) PRIMARY KEY,
|
||||
nomBanque varchar(40),
|
||||
idInscrit char(5) UNIQUE,
|
||||
UNIQUE(nomBanque,idInscrit),
|
||||
FOREIGN KEY (nomBanque) REFERENCES Banque(nom),
|
||||
FOREIGN KEY (idInscrit) REFERENCES Inscrit(id)
|
||||
);
|
||||
|
||||
CREATE TABLE Compte
|
||||
(
|
||||
id char (5) PRIMARY KEY,
|
||||
nom varchar(40),
|
||||
idInscritBanque char(5),
|
||||
FOREIGN KEY (idInscritBanque) REFERENCES InscrBanque(id),
|
||||
UNIQUE(idInscritBanque,nom)
|
||||
);
|
||||
|
||||
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