Skip to content
Snippets Groups Projects
Commit 334a7e11 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: db, add BodyOfWater entity

parent 0edb98f6
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ class Measurement {
Sensor sensor;
List<Data> dataList;
List<Corner> cornerList;
String bodyOfWater;
Measurement({
required this.measurementID,
......@@ -11,6 +12,7 @@ class Measurement {
required this.sensor,
required this.dataList,
required this.cornerList,
required this.bodyOfWater,
});
factory Measurement.Measurement(Map<String, dynamic> json) {
......@@ -24,6 +26,7 @@ class Measurement {
cornerList: (json['Corner'] as List<dynamic>)
.map((data) => Corner.fromJson(data))
.toList(),
bodyOfWater: json['WaterBodyName'],
);
}
}
......
No preview for this file type
......@@ -2,7 +2,9 @@ CREATE TABLE Measurement (
MeasurementID INT PRIMARY KEY,
SensorID INT,
TimeMeasured DATETIME,
FOREIGN KEY (SensorID) REFERENCES Sensor(SensorID)
WaterBodyName TEXT,
FOREIGN KEY (SensorID) REFERENCES Sensor(SensorID),
FOREIGN KEY (WaterBodyName) REFERENCES BodyOfWater(Name)
);
CREATE TABLE Sensor (
......@@ -32,6 +34,10 @@ CREATE TABLE Corner (
FOREIGN KEY (MeasurementID) REFERENCES Measurement(MeasurementID)
);
CREATE TABLE BodyOfWater (
Name TEXT PRIMARY KEY
);
INSERT INTO Sensor (SensorID, SensorType, Active) VALUES
(1, 'LiDar', 1),
(2, 'Magnetic', 1),
......@@ -84,3 +90,6 @@ INSERT INTO Corner (CornerID, MeasurementID, CornerLatitude, CornerLongitude) VA
(2, 3, 60.7361, 10.8471),
(3, 3, 60.7362, 10.8472),
(4, 3, 60.7363, 10.8473);
INSERT INTO BodyOfWater(Name) VALUES
('Mjosa');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment