From 6c5766d3d9b325b080eb89c59f508bac6de19049 Mon Sep 17 00:00:00 2001 From: Rhys Evans <EvansRM17@cardiff.ac.uk> Date: Fri, 8 Dec 2023 14:18:02 +0000 Subject: [PATCH] Further work on inserting data into foreign tables --- .../Team5/SmartTowns/Data/LocationsCoordinates.java | 13 +++++++++++++ src/main/resources/data.sql | 7 ++++++- src/main/resources/schema.sql | 6 +----- 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 src/main/java/Team5/SmartTowns/Data/LocationsCoordinates.java diff --git a/src/main/java/Team5/SmartTowns/Data/LocationsCoordinates.java b/src/main/java/Team5/SmartTowns/Data/LocationsCoordinates.java new file mode 100644 index 00000000..1ed28ae7 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Data/LocationsCoordinates.java @@ -0,0 +1,13 @@ +package Team5.SmartTowns.Data; + + + +import lombok.AllArgsConstructor; +import lombok.Data; +@Data +@AllArgsConstructor +public class LocationsCoordinates { + private int locationID; + private double locationCoordsLong; + private double locationCoordsLat; +} diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index 02493238..162c8d7e 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -54,4 +54,9 @@ insert into badgeprogress (userID, badgeID, progress) value ('2', '2', '70'); delete from stickerprogress; # insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true); # insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true); -# insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true); \ No newline at end of file +# insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true); + +delete from locationsCoordinates; +insert into locationsCoordinates(locationID, locationCoordsLong, locationCoordsLat) value (2,51.57623,-3.21910 ); +insert into locationsCoordinates(locationID, locationCoordsLong, locationCoordsLat) value (3,51.575372, -3.219186 ); +insert into locationsCoordinates(locationID, locationCoordsLong, locationCoordsLat) value (4,51.576363, -3.220712 ); diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql index dcae2376..826714ee 100644 --- a/src/main/resources/schema.sql +++ b/src/main/resources/schema.sql @@ -7,7 +7,6 @@ create table if not exists trails ) engine=InnoDB; drop table if exists locations; - create table if not exists locations ( locationID bigint auto_increment primary key, @@ -62,18 +61,15 @@ create table if not exists stickerProgress ) engine=InnoDB; -drop table if exists locations; - drop table if exists locationsCoordinates; create table if not exists locationsCoordinates (locationCoordID bigint auto_increment primary key, locationID bigint, - locationCoordName varchar(128), locationCoordsLong double, locationCoordsLat double, - Foreign Key (locationID) REFERENCES locations(locationID)git a + Foreign Key (locationID) REFERENCES locations(locationID) )engine=InnoDB; \ No newline at end of file -- GitLab