Skip to content
Snippets Groups Projects
Commit 4c723a39 authored by Joost Hemmen's avatar Joost Hemmen :basketball:
Browse files

Merge branch '131-update-sms-foreign-and-mock-tables' into 'main'

Resolve "update sms foreign and mock tables"

Closes #131

See merge request !214
parents e08bb3c3 b6ecaee3
No related branches found
No related tags found
1 merge request!214Resolve "update sms foreign and mock tables"
Pipeline #459817 passed
......@@ -11,7 +11,10 @@ import json
script_dir = os.path.dirname(os.path.abspath(__file__))
file_names = [
"sms_cv_measured_quantity.json"
"sms_cv_measured_quantity.json",
"sms_cv_license.json",
"sms_cv_aggregation_type.json",
"sms_cv_unit.json",
]
file_path_list = [os.path.join(script_dir, "tables", file_name) for file_name in file_names]
......
{
"keys": {
"id": {
"type": "int4 primary key not null",
"path": ["id"]
},
"term": {
"type": "VARCHAR(255) not null",
"path": ["attributes", "term"]
},
"definition": {
"type": "text",
"path": ["attributes", "definition"]
}
},
"name": "sms_cv_aggregation_type",
"endpoint": "aggregationtypes"
}
\ No newline at end of file
{
"keys": {
"id": {
"type": "int4 primary key not null",
"path": ["id"]
},
"term": {
"type": "VARCHAR(255) not null",
"path": ["attributes", "term"]
},
"provenance_uri": {
"type": "VARCHAR(255)",
"path": ["attributes", "provenance_uri"]
},
"provenance": {
"type": "text",
"path": ["attributes", "provenance"]
},
"definition": {
"type": "text",
"path": ["attributes", "definition"]
}
},
"name": "sms_cv_license",
"endpoint": "licenses"
}
\ No newline at end of file
{
"keys": {
"id": {
"type": "int4 primary key not null",
"path": ["id"]
},
"term": {
"type": "VARCHAR(255) not null",
"path": ["attributes", "term"]
},
"provenance": {
"type": "text",
"path": ["attributes", "provenance"]
},
"definition": {
"type": "text",
"path": ["attributes", "definition"]
}
},
"name": "sms_cv_unit",
"endpoint": "units"
}
\ No newline at end of file
......@@ -9,4 +9,25 @@ CREATE TABLE public.measured_quantity (
definition text
);
CREATE TABLE public.license (
id int4 not null,
term varchar(255) not null,
provenance_uri varchar(255),
provenance text,
definition text
);
CREATE TABLE public.aggregation_type (
id int4 not null,
term varchar(255) not null,
definition text
);
CREATE TABLE public.unit (
id int4 not null,
term varchar(255) not null,
definition text,
provenance text
);
COMMIT;
\ No newline at end of file
......@@ -8,4 +8,28 @@ CREATE FOREIGN TABLE IF NOT EXISTS public.sms_cv_measured_quantity (
)
SERVER sms_cv_db OPTIONS (schema_name 'public', table_name 'measured_quantity');
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_cv_license (
id int4 not null,
term varchar(255) not null,
provenance_uri varchar(255),
provenance text,
definition text
)
SERVER sms_cv_db OPTIONS (schema_name 'public', table_name 'license');
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_cv_aggregation_type (
id int4 not null,
term varchar(255) not null,
definition text
)
SERVER sms_cv_db OPTIONS (schema_name 'public', table_name 'aggregation_type');
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_cv_unit (
id int4 not null,
term varchar(255) not null,
definition text,
provenance text
)
SERVER sms_cv_db OPTIONS (schema_name 'public', table_name 'unit');
COMMIT;
\ No newline at end of file
......@@ -56,10 +56,10 @@ create table public.configuration_dynamic_location_begin_action
created_at timestamp with time zone,
updated_at timestamp with time zone,
id serial primary key,
configuration_id integer not null,
configuration_id integer not null,
begin_date timestamp with time zone not null,
begin_description text,
begin_contact_id integer not null,
begin_contact_id integer not null,
x_property_id integer,
y_property_id integer,
z_property_id integer,
......@@ -80,10 +80,10 @@ create table public.configuration_static_location_begin_action
created_at timestamp with time zone,
updated_at timestamp with time zone,
id serial primary key,
configuration_id integer not null,
configuration_id integer not null,
begin_date timestamp with time zone not null,
begin_description text,
begin_contact_id integer not null,
begin_contact_id integer not null,
x double precision,
y double precision,
z double precision,
......@@ -137,12 +137,12 @@ create table public.device_mount_action
created_at timestamp with time zone,
updated_at timestamp with time zone,
id serial primary key,
configuration_id integer not null,
device_id integer not null,
configuration_id integer not null,
device_id integer not null,
parent_platform_id integer,
begin_date timestamp with time zone not null,
begin_description text,
begin_contact_id integer not null,
begin_contact_id integer not null,
offset_x double precision,
offset_y double precision,
offset_z double precision,
......@@ -150,7 +150,8 @@ create table public.device_mount_action
updated_by_id integer,
end_date timestamp with time zone,
end_description text,
end_contact_id integer
end_contact_id integer,
label varchar(256)
);
......@@ -170,7 +171,7 @@ create table public.device_property
property_name varchar(256) not null,
sampling_media_uri varchar(256),
sampling_media_name varchar(256),
device_id integer not null,
device_id integer not null,
resolution double precision,
resolution_unit_name varchar(256),
resolution_unit_uri varchar(256),
......@@ -179,7 +180,19 @@ create table public.device_property
created_by_id integer,
updated_by_id integer,
aggregation_type_uri varchar(256),
aggregation_type_name varchar(256)
aggregation_type_name varchar(256),
accuracy_unit_name varchar(256),
accuracy_unit_uri varchar(256)
);
create table public.device_contact_role (
id serial primary key,
role_uri varchar(256) not null,
role_name varchar(256) not null,
contact_id integer not null,
device_id integer not null
);
......@@ -188,8 +201,8 @@ create table public.datastream_link
created_at timestamp with time zone,
updated_at timestamp with time zone,
id serial primary key,
device_property_id integer not null,
device_mount_action_id integer not null,
device_property_id integer not null,
device_mount_action_id integer not null,
datasource_id varchar(256) not null,
thing_id varchar(256) not null,
datastream_id varchar(256) not null,
......
......@@ -16,18 +16,21 @@ CREATE FOREIGN TABLE IF NOT EXISTS public.sms_configuration (
id integer not null,
label varchar(256),
description text,
persistent_identifier varchar(256),
persistent_identifier varchar(256),
status varchar(256),
project varchar(256),
is_internal boolean,
is_public boolean
is_internal boolean,
is_public boolean
)
SERVER sms_db OPTIONS (schema_name 'public', table_name 'configuration');
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_configuration_contact_role (
id integer not null,
configuration_id integer not null,
contact_id integer not null
contact_id integer not null,
role_uri varchar(256) not null,
role_name varchar(256) not null
)
SERVER sms_db OPTIONS (schema_name 'public', table_name 'configuration_contact_role');
......@@ -63,16 +66,18 @@ CREATE FOREIGN TABLE IF NOT EXISTS public.sms_configuration_static_location_begi
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_device (
id integer not null,
short_name varchar(256),
description text,
device_type_name varchar(256),
manufacturer_name varchar(256),
model varchar(256),
serial_number varchar(256),
persistent_identifier varchar(256),
is_internal boolean,
is_public boolean
id integer not null,
short_name varchar(256),
description text,
device_type_name varchar(256),
device_type_uri varchar(256),
manufacturer_name varchar(256),
manufacturer_uri varchar(256),
model varchar(256),
serial_number varchar(256),
persistent_identifier varchar(256),
is_internal boolean,
is_public boolean
)
SERVER sms_db OPTIONS (schema_name 'public', table_name 'device');
......@@ -85,7 +90,9 @@ CREATE FOREIGN TABLE IF NOT EXISTS public.sms_device_mount_action (
offset_y double precision,
offset_z double precision,
begin_date timestamp with time zone not null,
end_date timestamp with time zone
end_date timestamp with time zone,
begin_description text,
label varchar(256)
)
SERVER sms_db OPTIONS (schema_name 'public', table_name 'device_mount_action');
......@@ -100,27 +107,43 @@ CREATE FOREIGN TABLE IF NOT EXISTS public.sms_device_property (
unit_uri varchar(256),
resolution double precision,
resolution_unit_name varchar(256),
resolution_unit_uri varchar(256),
accuracy double precision,
measuring_range_min double precision,
measuring_range_max double precision,
aggregation_type_name varchar(256)
aggregation_type_name varchar(256),
aggregation_type_uri varchar(256),
accuracy_unit_name varchar(256),
accuracy_unit_uri varchar(256)
)
SERVER sms_db OPTIONS(schema_name 'public', table_name 'device_property');
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_device_contact_role (
id integer not null,
role_uri varchar(256) not null,
role_name varchar(256) not null,
contact_id integer not null,
device_id integer not null
)
SERVER sms_db OPTIONS (schema_name 'public', table_name 'device_contact_role');
CREATE FOREIGN TABLE IF NOT EXISTS public.sms_datastream_link (
id integer not null,
thing_id uuid,
device_property_id integer not null,
id integer not null,
thing_id uuid,
device_property_id integer not null,
device_mount_action_id integer not null,
datasource_id varchar(256),
datastream_id integer not null,
begin_date timestamp with time zone,
end_date timestamp with time zone,
aggregation_period double precision,
license_uri varchar(256),
license_name varchar(256)
datasource_id varchar(256),
datastream_id integer not null,
begin_date timestamp with time zone,
end_date timestamp with time zone,
aggregation_period double precision,
license_uri varchar(256),
license_name varchar(256)
)
SERVER sms_db OPTIONS (schema_name 'public', table_name 'datastream_link');
COMMIT;
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