diff --git a/scripts/init-fluidprices.sh b/scripts/init-fluidprices.sh new file mode 100755 index 0000000000000000000000000000000000000000..1bc1fe590c79a0bb67eec819c591270894115f81 --- /dev/null +++ b/scripts/init-fluidprices.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +source ../.env + +# REMOVE PRICES TABLE +docker compose exec database-agent mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD} -e "use $DATABASE_NAME; DROP TABLE prices;" +echo "Prices database dropped" +# CREATE PRICES TABLE +docker compose exec database-agent mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD} -e "use $DATABASE_NAME; CREATE TABLE prices ( + id int(11) NOT NULL, + fluid_type bigint(20) DEFAULT NULL, + price float DEFAULT NULL, + start_date longtext, + end_date longtext, + created_at datetime(3) DEFAULT NULL, + updated_at datetime(3) DEFAULT NULL, + deleted_at datetime(3) DEFAULT NULL +);" +echo "Prices database created" +# POPULATE PRICES TABLE +docker compose exec database-agent mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD} -e "use $DATABASE_NAME; INSERT INTO prices (id, fluid_type, price, start_date, end_date) VALUES + (1,0,0.1256,'2012-07-23 00:00:00','2013-07-31 23:59:59'), + (2,0,0.1329,'2013-08-01 00:00:00','2014-10-31 23:59:59'), + (3,0,0.1401,'2014-01-11 00:00:00','2015-07-31 23:59:59'), + (4,0,0.1437,'2015-08-01 00:00:00','2016-07-31 23:59:59'), + (5,0,0.1503,'2016-08-01 00:00:00','2017-07-31 23:59:59'), + (6,0,0.1546,'2017-08-01 00:00:00','2018-01-31 23:59:59'), + (7,0,0.1555,'2018-02-01 00:00:00','2018-07-31 23:59:59'), + (8,0,0.145,'2018-08-01 00:00:00','2019-05-31 23:59:59'), + (9,0,0.1531,'2019-02-01 00:00:00','2019-07-31 23:59:59'), + (10,0,0.1524,'2019-08-01 00:00:00','2020-01-31 23:59:59'), + (11,0,0.1546,'2020-02-01 00:00:00','2020-07-31 23:59:59'), + (12,0,0.1557,'2020-08-01 00:00:00','2021-01-31 23:59:59'), + (13,0,0.1582,'2021-02-01 00:00:00','2021-07-31 23:59:59'), + (14,0,0.1558,'2021-08-01 00:00:00','2022-01-31 23:59:59'), + (15,0,0.174,'2022-02-01 00:00:00',NULL), + (16,1,0.0030735,'2012-01-01 00:00:00','2012-12-31 23:59:59'), + (17,1,0.0031483,'2013-01-01 00:00:00','2013-12-31 23:59:59'), + (18,1,0.0031381,'2014-01-01 00:00:00','2014-12-31 23:59:59'), + (19,1,0.00307,'2015-01-01 00:00:00','2015-12-31 23:59:59'), + (20,1,0.0031,'2016-01-01 00:00:00','2016-12-31 23:59:59'), + (21,1,0.00311,'2017-01-01 00:00:00','2017-12-31 23:59:59'), + (22,1,0.00313,'2018-01-01 00:00:00','2018-12-31 23:59:59'), + (23,1,0.00313,'2019-01-01 00:00:00','2019-12-31 23:59:59'), + (24,1,0.00315,'2020-01-01 00:00:00','2020-12-31 23:59:59'), + (25,1,0.00319,'2021-01-01 00:00:00',NULL), + (26,2,0.0919,'2017-01-01 00:00:00','2017-01-31 23:59:59'), + (27,2,0.0915,'2017-02-01 00:00:00','2017-02-28 23:59:59'), + (28,2,0.0932,'2017-03-01 00:00:00','2017-03-31 23:59:59'), + (29,2,0.0927,'2017-04-01 00:00:00','2017-04-30 23:59:59'), + (30,2,0.0906,'2017-05-01 00:00:00','2017-05-31 23:59:59'), + (31,2,0.0906,'2017-06-01 00:00:00','2017-06-30 23:59:59'), + (32,2,0.0788,'2017-07-01 00:00:00','2017-07-31 23:59:59'), + (33,2,0.0783,'2017-08-01 00:00:00','2017-08-31 23:59:59'), + (34,2,0.0783,'2017-09-01 00:00:00','2017-09-30 23:59:59'), + (35,2,0.0791,'2017-10-01 00:00:00','2017-10-31 23:59:59'), + (36,2,0.0806,'2017-11-01 00:00:00','2017-11-30 23:59:59'), + (37,2,0.0812,'2017-12-01 00:00:00','2017-12-31 23:59:59'), + (38,2,0.0857,'2018-01-01 00:00:00','2018-01-31 23:59:59'), + (39,2,0.0866,'2018-02-01 00:00:00','2018-02-28 23:59:59'), + (40,2,0.0847,'2018-03-01 00:00:00','2018-03-31 23:59:59'), + (41,2,0.0839,'2018-04-01 00:00:00','2018-04-30 23:59:59'), + (42,2,0.0842,'2018-05-01 00:00:00','2018-05-31 23:59:59'), + (43,2,0.0855,'2018-06-01 00:00:00','2018-06-30 23:59:59'), + (44,2,0.0959,'2018-07-01 00:00:00','2018-07-31 23:59:59'), + (45,2,0.0961,'2018-08-01 00:00:00','2018-08-31 23:59:59'), + (46,2,0.0967,'2018-09-01 00:00:00','2018-09-30 23:59:59'), + (47,2,0.0989,'2018-10-01 00:00:00','2018-10-31 23:59:59'), + (48,2,0.1031,'2018-11-01 00:00:00','2018-11-30 23:59:59'), + (49,2,0.1013,'2018-12-01 00:00:00','2018-12-31 23:59:59'), + (50,2,0.0999,'2019-01-01 00:00:00','2019-01-31 23:59:59'), + (51,2,0.0993,'2019-02-01 00:00:00','2019-02-28 23:59:59'), + (52,2,0.0993,'2019-03-01 00:00:00','2019-03-31 23:59:59'), + (53,2,0.0977,'2019-04-01 00:00:00','2019-04-30 23:59:59'), + (54,2,0.0973,'2019-05-01 00:00:00','2019-05-31 23:59:59'), + (55,2,0.0969,'2019-06-01 00:00:00','2019-06-30 23:59:59'), + (56,2,0.0795,'2019-07-01 00:00:00','2019-07-31 23:59:59'), + (57,2,0.0791,'2019-08-01 00:00:00','2019-08-31 23:59:59'), + (58,2,0.0785,'2019-09-01 00:00:00','2019-09-30 23:59:59'), + (59,2,0.077,'2019-10-01 00:00:00','2019-10-31 23:59:59'), + (60,2,0.0789,'2019-11-01 00:00:00','2019-11-30 23:59:59'), + (61,2,0.0793,'2019-12-01 00:00:00','2019-12-31 23:59:59'), + (62,2,0.0787,'2020-01-01 00:00:00','2020-01-31 23:59:59'), + (63,2,0.0765,'2020-02-01 00:00:00','2020-02-29 23:59:59'), + (64,2,0.0736,'2020-03-01 00:00:00','2020-03-31 23:59:59'), + (65,2,0.071,'2020-04-01 00:00:00','2020-04-30 23:59:59'), + (66,2,0.0703,'2020-05-01 00:00:00','2020-05-31 23:59:59'), + (67,2,0.0687,'2020-06-01 00:00:00','2020-06-30 23:59:59'), + (68,2,0.0698,'2020-07-01 00:00:00','2020-07-31 23:59:59'), + (69,2,0.0705,'2020-08-01 00:00:00','2020-08-31 23:59:59'), + (70,2,0.0709,'2020-09-01 00:00:00','2020-09-30 23:59:59'), + (71,2,0.0735,'2020-10-01 00:00:00','2020-10-31 23:59:59'), + (72,2,0.0745,'2020-11-01 00:00:00','2020-11-30 23:59:59'), + (73,2,0.0759,'2020-12-01 00:00:00','2020-12-31 23:59:59'), + (74,2,0.076,'2021-01-01 00:00:00','2021-01-31 23:59:59'), + (75,2,0.0782,'2021-02-01 00:00:00','2021-02-28 23:59:59'), + (76,2,0.0818,'2021-03-01 00:00:00','2021-03-31 23:59:59'), + (77,2,0.079,'2021-04-01 00:00:00','2021-04-30 23:59:59'), + (78,2,0.0797,'2021-05-01 00:00:00','2021-05-31 23:59:59'), + (79,2,0.0826,'2021-06-01 00:00:00','2021-06-30 23:59:59'), + (80,2,0.0895,'2021-07-01 00:00:00','2021-07-31 23:59:59'), + (81,2,0.0934,'2021-08-01 00:00:00','2021-08-31 23:59:59'), + (82,2,0.1002,'2021-09-01 00:00:00','2021-09-30 23:59:59'), + (83,2,0.1121,'2021-10-01 00:00:00',NULL) +;" +echo "Prices database populated" \ No newline at end of file