/******************************************************************************* Creation Date: 2022-10-13 Author: Maxence Laurent Author: Youn Mélois Description: Creates the database tables and relations. Usage: psql -U postgres -d interpromos -a -f data.sql https://stackoverflow.com/a/23992045/12619942 *******************************************************************************/ DELETE FROM sports; DELETE FROM users; -- Populate sports table ALTER SEQUENCE sports_id_seq RESTART; INSERT INTO sports ("id", "name") VALUES ('1', 'Basket'), ('2', 'Handball'), ('3', 'Badminton1'), ('4', 'Badminton2'), ('5', 'Volley'), ('6', 'Futsal'), ('7', 'Beer&Run'); -- Populate users table ALTER SEQUENCE users_id_seq RESTART; INSERT INTO users ("name", "email", "password_hash") VALUES ('Appen', 'appenisen@proton.me', '$2y$10$5xFOYw3o0c5Py.mNpOHSl.WiNdWRvxbNPLEhr.9/wZzo7.LL0OEl6'); -- Populate teams table ALTER SEQUENCE teams_id_seq RESTART; INSERT INTO teams ("id", "name") VALUES ('1', 'A1: Mater Tua'), ('2', 'A1: Mater Tua 1'), ('3', 'A1: Mater Tua 2'), ('4', 'A1: Mater Tua 3'), ('5', 'A1: Mater Tua 4'), ('6', 'A1: Mater Tua 5'), ('7', 'A2: FC fouche'), ('8', 'A2: FC fouche 1'), ('9', 'A2: FC fouche 2'), ('10', 'A2: FC fouche 3'), ('11', 'A2: As du volant'), ('12', 'A2: A2 Grammes'), ('13', 'A2: FC A2 Grammes'), ('14', 'A3: Fun'), ('15', 'A3: Fun 1'), ('16', 'A3: Fun 2'), ('17', 'A3: Fun 3'), ('18', 'A3: Fun 4'), ('19', 'A3: Fun 5'), ('20', 'A3: SANSFACON'), ('21', 'A4: BROS'), ('22', 'A4: Olympique Brechi'), ('23', 'A4: Olympique Brechi2'), ('24', 'A4: Team Vickings'), ('25', 'A4: JayJay Menuou''s Team'), ('26', 'A5: RUFTEAM'), ('27', 'Perm: Les fous furieux'), ('28', 'Perm: Les mentors'), ('29', 'Perm: Les mentors 1'), ('30', 'Perm: Les mentors encore'); -- Populate matches table ALTER SEQUENCE matches_id_seq RESTART; INSERT INTO matches ("id", "sport_id", "type", "date") VALUES ('1', '6', '0', '2022-10-17T19:10'), ('2', '6', '7', '2022-10-17T19:19'), ('3', '6', '0', '2022-10-17T19:28'), ('4', '6', '7', '2022-10-17T19:37'), ('5', '6', '0', '2022-10-17T19:46'), ('6', '6', '7', '2022-10-17T19:55'), ('7', '6', '0', '2022-10-17T20:04'), ('8', '6', '7', '2022-10-17T20:13'), ('9', '6', '0', '2022-10-17T20:22'), ('10', '6', '7', '2022-10-17T20:31'), ('11', '6', '0', '2022-10-17T20:40'), ('12', '6', '7', '2022-10-17T20:49'), ('13', '6', '0', '2022-10-17T20:58'), ('14', '6', '7', '2022-10-17T21:07'), ('15', '6', '0', '2022-10-17T21:16'), ('16', '6', '7', '2022-10-17T21:25'), ('17', '6', '0', '2022-10-17T21:34'), ('18', '6', '7', '2022-10-17T21:43'), ('19', '6', '0', '2022-10-17T21:52'), ('20', '6', '7', '2022-10-17T22:01'), ('21', '1', '7', '2022-10-17T22:15'), ('22', '1', '0', '2022-10-17T22:28'), ('23', '1', '7', '2022-10-17T22:40'), ('24', '1', '0', '2022-10-17T22:52'), ('25', '1', '7', '2022-10-18T18:25'), ('26', '1', '0', '2022-10-18T18:36'), ('27', '1', '0', '2022-10-18T18:47'), ('28', '1', '0', '2022-10-18T18:58'), ('29', '1', '0', '2022-10-18T19:09'), ('30', '2', '0', '2022-10-18T19:50'), ('31', '2', '7', '2022-10-18T20:02'), ('32', '2', '0', '2022-10-18T20:14'), ('33', '2', '7', '2022-10-18T20:26'), ('34', '2', '0', '2022-10-18T20:38'), ('35', '2', '7', '2022-10-18T20:50'), ('36', '2', '0', '2022-10-18T21:02'), ('37', '2', '0', '2022-10-18T21:14'), ('38', '2', '0', '2022-10-18T21:26'), ('39', '5', '0', '2022-10-18T22:14'), ('40', '5', '7', '2022-10-18T22:14'), ('41', '5', '0', '2022-10-18T22:26'), ('42', '5', '7', '2022-10-18T22:26'), ('43', '5', '0', '2022-10-18T22:38'), ('44', '5', '7', '2022-10-18T22:38'), ('45', '5', '0', '2022-10-18T22:50'), ('46', '5', '7', '2022-10-18T22:50'), ('47', '5', '0', '2022-10-18T23:02'), ('48', '5', '7', '2022-10-18T23:02'), ('49', '5', '0', '2022-10-18T23:14'), ('50', '5', '7', '2022-10-18T23:14'), ('51', '3', '6', '2022-10-17T18:25'), ('52', '3', '6', '2022-10-17T18:25'), ('53', '4', '6', '2022-10-17T18:25'), ('54', '4', '6', '2022-10-17T18:25'), ('55', '3', '5', '2022-10-17T18:25'), ('56', '3', '5', '2022-10-17T18:25'), ('57', '4', '5', '2022-10-17T18:35'), ('58', '4', '5', '2022-10-17T18:35'); -- Populate participations table ALTER SEQUENCE participations_id_seq RESTART; INSERT INTO participations ("match_id", "team_id") VALUES ('1', '3'), ('1', '12'), ('2', '24'), ('2', '28'), ('3', '22'), ('3', '25'), ('4', '14'), ('4', '1'), ('5', '16'), ('5', '12'), ('6', '24'), ('6', '7'), ('7', '22'), ('7', '16'), ('8', '14'), ('8', '7'), ('9', '12'), ('9', '25'), ('10', '1'), ('10', '24'), ('11', '22'), ('11', '3'), ('12', '28'), ('12', '14'), ('13', '22'), ('13', '12'), ('14', '14'), ('14', '24'), ('15', '25'), ('15', '16'), ('16', '1'), ('16', '7'), ('17', '25'), ('17', '3'), ('18', '1'), ('18', '28'), ('19', '16'), ('19', '3'), ('20', '7'), ('20', '28'), ('21', '22'), ('21', '7'), ('22', '14'), ('22', '1'), ('23', '7'), ('23', '16'), ('24', '12'), ('24', '25'), ('25', '22'), ('25', '16'), ('26', '12'), ('26', '1'), ('27', '12'), ('27', '14'), ('28', '25'), ('28', '1'), ('29', '14'), ('29', '25'), ('30', '7'), ('30', '14'), ('31', '12'), ('31', '1'), ('32', '22'), ('32', '3'), ('33', '25'), ('33', '12'), ('34', '7'), ('34', '3'), ('35', '1'), ('35', '25'), ('36', '7'), ('36', '22'), ('37', '14'), ('37', '3'), ('38', '14'), ('38', '22'), ('39', '22'), ('39', '12'), ('40', '1'), ('40', '24'), ('41', '3'), ('41', '16'), ('42', '14'), ('42', '7'), ('43', '16'), ('43', '22'), ('44', '1'), ('44', '7'), ('45', '12'), ('45', '3'), ('46', '14'), ('46', '24'), ('47', '22'), ('47', '3'), ('48', '1'), ('48', '14'), ('49', '12'), ('49', '16'), ('50', '7'), ('50', '24'), ('51', '18'), ('51', '2'), ('52', '4'), ('52', '10'), ('53', '6'), ('53', '16'), ('54', '10'), ('54', '23'), ('55', '11'), ('55', '22'), ('56', '20'), ('56', '3'), ('57', '26'), ('57', '27'), ('58', '8'), ('58', '15');