summaryrefslogtreecommitdiffstats
path: root/datacollector/docker/init.sql
diff options
context:
space:
mode:
authory.busko <y.busko@partner.samsung.com>2021-04-14 16:13:09 +0200
committerk.kedron <k.kedron@partner.samsung.com>2021-04-16 17:43:35 +0200
commit8f21c92d8104ea9bcaa49998cfb0787514a6ddc9 (patch)
treed6c30e8ee411ac1cdcbab8d303400eb895ace35d /datacollector/docker/init.sql
parent16c9954de0a4fdcb5324859b21ac928169792037 (diff)
Initial code for DataCollector RAPP
Updated pom files Added swagger templates at /doc/templates Change-Id: I2fb7b26993fa13f07c3cf013aec9df06bd2dca8b Issue-ID: INT-1887 Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com> Signed-off-by: yauheni busko <y.busko3@partner.samsung.com>
Diffstat (limited to 'datacollector/docker/init.sql')
-rw-r--r--datacollector/docker/init.sql61
1 files changed, 61 insertions, 0 deletions
diff --git a/datacollector/docker/init.sql b/datacollector/docker/init.sql
new file mode 100644
index 0000000..0022f8a
--- /dev/null
+++ b/datacollector/docker/init.sql
@@ -0,0 +1,61 @@
+create database if not exists ves;
+use ves;
+
+create table if not exists ves_measurement (
+ -- our id
+ id INTEGER NOT NULL AUTO_INCREMENT,
+ -- common header
+ event_type TEXT,
+ version TEXT,
+ source_id TEXT,
+ reporting_entity_name TEXT,
+ start_epoch_microsec BIGINT,
+ event_id TEXT,
+ last_epoch_microsec BIGINT,
+ priority TEXT,
+ sequence INT,
+ source_name TEXT,
+ domain TEXT,
+ event_name TEXT,
+ reporting_entity_id TEXT,
+ nfc_naming_code TEXT,
+ nf_naming_code TEXT,
+ time_zone_offset TEXT,
+ rawdata TEXT NOT NULL,
+ CONSTRAINT ves_measurement_pk PRIMARY KEY(id)
+
+);
+
+create table if not exists ves_measurement_fields (
+ event_id INTEGER NOT NULL,
+ measurement_interval LONG,
+ measurement_fields_version VARCHAR(32),
+ CONSTRAINT ves_measurement_fields_pk PRIMARY KEY (event_id),
+ CONSTRAINT ves_measurement_fields_fk1 FOREIGN KEY (event_id) REFERENCES ves_measurement(id) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+
+create table if not exists additional_measurement (
+ event_id INTEGER NOT NULL,
+ am_name VARCHAR(128) NOT NULL,
+ ves_measurement_fields_key INTEGER,
+ CONSTRAINT additional_measurement_pk PRIMARY KEY(event_id, am_name),
+ CONSTRAINT additional_measurement_fk1 FOREIGN KEY(event_id) REFERENCES ves_measurement(id) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+create table if not exists additional_measurement_value (
+ event INTEGER NOT NULL,
+ am_name VARCHAR(128) NOT NULL,
+ additional_measurement_key INTEGER,
+ ves_measurement_fields_key INTEGER,
+ am_key TEXT NOT NULL,
+ am_value TEXT,
+ CONSTRAINT additional_measurement_value_fk1 FOREIGN KEY(event, am_name) REFERENCES additional_measurement(event_id, am_name) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+-- to store raw payload i.e. without any parsing
+create table if not exists payload (
+ event_id INTEGER NOT NULL,
+ payload TEXT NOT NULL
+);
+