Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,20 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: update column ex_NN.rec_equipment_state.vulnerability_kind_id = pdm_vulnerability_kind.ta_vulnerability_kind
-- PROJECT: Ahtc
-- DATE: 2021-03-10
-- VERSION: 1.01
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
UPDATE rec_equipment_state
SET vulnerability_kind_id = (SELECT ta_vulnerability_kind FROM pdm.pdm_vulnerability_kind WHERE rec_equipment_state.vulnerability_kind_id = pdm.pdm_vulnerability_kind.id);
COMMIT;
@@ -0,0 +1,25 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: drop PK and column id from pdm_vulnerability_kind and add PK on ta_vulnerability_kind
-- PROJECT: Ahtc
-- DATE: 2021-03-10
-- VERSION: 1.02
-------------------------------------------------------------------------
-- GLOBAL: PDM;
BEGIN;
-- drop old primary key on column id
ALTER TABLE IF EXISTS pdm_vulnerability_kind DROP CONSTRAINT IF EXISTS PK_pdm_vulnerability_kind_id CASCADE;
-- drop column id
ALTER TABLE IF EXISTS pdm_vulnerability_kind DROP COLUMN IF EXISTS id CASCADE;
-- create new primary key on ta_vulnerability_kind
ALTER TABLE IF EXISTS pdm_vulnerability_kind DROP CONSTRAINT IF EXISTS PK_pdm_vulnerability_kind_ta_vulnerability_kind CASCADE;
ALTER TABLE IF EXISTS pdm_vulnerability_kind ADD CONSTRAINT PK_pdm_vulnerability_kind_ta_vulnerability_kind PRIMARY KEY (ta_vulnerability_kind);
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+90
View File
@@ -0,0 +1,90 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: AES updates (enum, explosion single central table, recorded table and view)
-- PROJECT: Ahtc
-- DATE: 2021-03-12
-- VERSION: 1.03
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
-- enum
ALTER TABLE IF EXISTS aes_fuse_type DROP CONSTRAINT IF EXISTS PK_aes_fuse_type_id CASCADE;
DROP TABLE IF EXISTS aes_fuse_type CASCADE;
CREATE TABLE IF NOT EXISTS aes_fuse_type (
id integer,
name text
);
COMMENT ON TABLE aes_fuse_type IS 'static data (<b>not</b> project specific) generate from enum';
ALTER TABLE IF EXISTS aes_fuse_type ADD CONSTRAINT PK_aes_fuse_type_id PRIMARY KEY (id);
INSERT INTO aes_fuse_type (id, name) VALUES (0, 'FtProximity');
INSERT INTO aes_fuse_type (id, name) VALUES (1, 'FtImpact');
INSERT INTO aes_fuse_type (id, name) VALUES (2, 'FtDelay');
-- table aes_explosion_single_central
ALTER TABLE IF EXISTS aes_explosion_single_central DROP CONSTRAINT IF EXISTS PK_aes_explosion_single_central_id CASCADE;
ALTER TABLE IF EXISTS aes_explosion_single_central DROP CONSTRAINT IF EXISTS FK_aes_explosion_single_central_explosion_single_id_aes_explosi CASCADE;
ALTER TABLE IF EXISTS aes_explosion_single_central DROP CONSTRAINT IF EXISTS FK_aes_explosion_single_central_fuse_type_id_aes_fuse_type_id CASCADE;
DROP TABLE IF EXISTS aes_explosion_single_central CASCADE;
CREATE SEQUENCE IF NOT EXISTS aes_explosion_single_central_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS aes_explosion_single_central (
id integer DEFAULT nextval(( 'aes_explosion_single_central_id_seq'::text)::regclass),
explosion_single_id integer,
angle double precision,
fuse_type_id integer
);
ALTER TABLE IF EXISTS aes_explosion_single_central ADD CONSTRAINT PK_aes_explosion_single_central_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS aes_explosion_single_central ADD CONSTRAINT FK_aes_explosion_single_central_explosion_single_id_aes_explosi FOREIGN KEY (explosion_single_id) REFERENCES aes_explosion_single (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE IF EXISTS aes_explosion_single_central ADD CONSTRAINT FK_aes_explosion_single_central_fuse_type_id_aes_fuse_type_id FOREIGN KEY (fuse_type_id) REFERENCES aes_fuse_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- recorded table rec_explosion_single_central
ALTER TABLE IF EXISTS rec_explosion_single_central DROP CONSTRAINT IF EXISTS PK_rec_explosion_single_central_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_explosion_single_central DROP CONSTRAINT IF EXISTS IDX_rec_explosion_single_central_sample_time CASCADE;
DROP TABLE IF EXISTS rec_explosion_single_central CASCADE;
CREATE SEQUENCE IF NOT EXISTS rec_explosion_single_central_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS rec_explosion_single_central (
id integer,
name text,
is_deleted boolean,
is_used boolean,
sample_time bigint,
charge_type_id integer,
effect_duration integer,
effect_start bigint,
effect_state_id integer,
party_id integer,
participant_id integer,
effect_marking_in_ta boolean,
external_id bigint,
impact_position_lon double precision,
impact_position_lat double precision,
fire_request_time bigint,
altitude integer,
purpose text,
angle double precision,
fuse_type integer,
rec_id bigint DEFAULT nextval(( 'rec_explosion_single_central_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_explosion_single_central IS 'recorded data for topic ExplosionSingleCentral';
ALTER TABLE IF EXISTS rec_explosion_single_central ADD CONSTRAINT PK_rec_explosion_single_central_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_explosion_single_central_sample_time ON rec_explosion_single_central (sample_time);
-- view aes_explosion_single_central_view
DROP VIEW IF EXISTS aes_explosion_single_central_view;
CREATE OR REPLACE VIEW aes_explosion_single_central_view AS SELECT aes_entity.id AS id, aes_entity.charge_type_id AS charge_type_id, aes_entity.effect_state_id AS effect_state_id, aes_entity.party_id AS party_id, aes_entity.participant_id AS participant_id, aes_entity.effect_duration AS effect_duration, aes_entity.effect_start AS effect_start, aes_entity.name AS name, aes_entity.effect_marking_in_ta AS effect_marking_in_ta, aes_entity.external_id AS external_id, aes_explosion.entity_id AS entity_id, aes_explosion.impact_position_x AS impact_position_x, aes_explosion.impact_position_y AS impact_position_y, aes_explosion.rotation_angle AS rotation_angle, aes_explosion.fire_purpose AS fire_purpose, aes_explosion.fire_request_time AS fire_request_time, aes_explosion.altitude AS altitude, aes_explosion_single.explosion_id AS explosion_id, aes_explosion_single_central.explosion_single_id AS explosion_single_id, aes_explosion_single_central.angle AS angle, aes_explosion_single_central.fuse_type_id AS fuse_type_id, aes_explosion_single_central.id AS aes_explosion_single_central_id
FROM aes_explosion_single_central, aes_entity, aes_explosion, aes_explosion_single
WHERE aes_entity.id = aes_explosion.entity_id AND
aes_explosion.id = aes_explosion_single.explosion_id AND
aes_explosion_single.id = aes_explosion_single_central.explosion_single_id;
COMMIT;
@@ -0,0 +1,42 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Added missing operator rights descriptions
-- PROJECT: Ahtc
-- DATE: 2021-02-22
-- VERSION: 1.04
-------------------------------------------------------------------------
-- GLOBAL: OPM;
BEGIN;
-- old right without description
UPDATE opm.opm_group SET description = 'Edit Charge Visibility' WHERE name = 'ChargeVisibilityEdit';
--UPDATE opm.opm_group SET description = 'SanNineLiner operator rights' WHERE name = 'SanNineLiner';
--UPDATE opm.opm_group SET description = 'Edit SanNineLiner' WHERE name = 'SanNineLinerEdit';
--UPDATE opm.opm_group SET description = 'Show SanNineLiner' WHERE name = 'SanNineLinerShow';
UPDATE opm.opm_group SET description = 'View Operational Plannings' WHERE name = 'OperationalPlanningView';
UPDATE opm.opm_group SET description = 'Administrator rights' WHERE name = 'Administrator';
UPDATE opm.opm_group SET description = 'Shut down workstations' WHERE name = 'ShutdownWorkstations';
UPDATE opm.opm_group SET description = 'Database Administration' WHERE name = 'DatabaseAdministration';
UPDATE opm.opm_group SET description = 'Change exercise state' WHERE name = 'ExerciseStateEdit';
UPDATE opm.opm_group SET description = 'Edit Codification Data' WHERE name = 'CodificationDataEdit';
UPDATE opm.opm_group SET description = 'Show Codification Data BLUFOR' WHERE name = 'CodificationDataShowBLUFOR';
UPDATE opm.opm_group SET description = 'Show Codification Data OPFOR' WHERE name = 'CodificationDataShowOPFOR';
UPDATE opm.opm_group SET description = 'Allow access to the voice communication channels' WHERE name = 'AvVoiceCommunicationAccess';
UPDATE opm.opm_group SET description = 'Edit Combat Net Radio Frequency Planning' WHERE name = 'FrequencyPlanningEdit';
--UPDATE opm.opm_group SET description = 'Show Guez Nasat Configuration' WHERE name = 'GuezNasatConfigurationShow';
--UPDATE opm.opm_group SET description = 'Edit Guez Nasat Configuration' WHERE name = 'GuezNasatConfigurationEdit';
-- new operator right for PvSan Reports
--INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (520159235, 'ReportsEditSan', 'Create and Edit PvSan Reports');
--INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (520093698, 'ReportsEditSan', 'Create and Edit PvSan Reports', 1, true);
--INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (520093698, 520159235); -- group_id is: 520093698 = 0x1f000002
--INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (520159232, 520093698); -- Reports
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,56 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Add ISM views, grant select on views to all users, export csv commented
-- PROJECT: Ahtc
-- DATE: 2021-03-22
-- VERSION: 1.05
-------------------------------------------------------------------------
-- GLOBAL: ISM;
BEGIN;
DROP VIEW IF EXISTS ism.ism_mpa_barcodes;
CREATE OR REPLACE VIEW ism.ism_mpa_barcodes AS
SELECT asset_id, a.barcode AS asset_barcode, structure_element_id, se.barcode AS se_barcode, se.main_structure_element_id, mse.name
FROM ism.ism_mounting_point_asset mpa, ism.ism_asset a, ism.ism_structure_element se, ism.ism_main_structure_element mse
WHERE mpa.asset_id = a.id AND mpa.structure_element_id = se.id AND se.main_structure_element_id = mse.id AND mse.id > 300
AND length(a.barcode) > 0 AND length(se.barcode) > 0
ORDER BY mse.id, se.id;
-- COPY (SELECT * from ism.ism_mpa_barcodes) TO '/opt/postgres/backup/ism_mpa_barcodes.csv' DELIMITER ',' CSV HEADER;
DROP VIEW IF EXISTS ism.ism_se_barcodes;
CREATE OR REPLACE VIEW ism.ism_se_barcodes AS
SELECT se.id,se.name,se.main_structure_element_id,mse.name as main_name,se.barcode
FROM ism.ism_structure_element se, ism.ism_main_structure_element mse
WHERE se.main_structure_element_id = mse.id AND length(se.barcode) > 0 AND mse.id > 300
ORDER BY mse.id, se.id;
-- COPY (SELECT * from ism.ism_se_barcodes WHERE main_structure_element_id > 300) TO '/opt/postgres/backup/ism_se_barcodes.csv' DELIMITER ',' CSV HEADER;
DROP VIEW IF EXISTS ism.ism_view_plans;
CREATE OR REPLACE VIEW ism.ism_view_plans AS
SELECT mpp.id, mpp.mounting_point_schedule_id, mpp.structure_element_id, se.main_structure_element_id, se.name, mse.name as main_name
FROM ism.ism_mounting_point_plan mpp, ism.ism_structure_element se, ism.ism_main_structure_element mse
WHERE se.id = mpp.structure_element_id AND se.main_structure_element_id = mse.id AND mse.id > 300
ORDER BY mse.id, se.id;
-- COPY (SELECT * from ism.ism_view_plans) TO '/opt/postgres/backup/ism_view_plans.csv' DELIMITER ',' CSV HEADER;
DROP VIEW IF EXISTS ism.ism_view_buildings;
CREATE OR REPLACE VIEW ism.ism_view_buildings AS
SELECT se.id AS se_id, se.main_structure_element_id AS bldg_id, mse.model_id, se.display_name, se.barcode AS se_barcode, se.rel_position_x, se.rel_position_y, se.rel_position_z, mpt.name AS mp_type, mpa.asset_id, at.barcode AS asset_barcode
FROM ism.ism_mounting_point_type mpt, ism.ism_main_structure_element mse, ism.ism_structure_element se LEFT OUTER JOIN ism.ism_mounting_point_asset mpa ON se.id = mpa.structure_element_id
LEFT OUTER JOIN ism.ism_asset at ON mpa.asset_id = at.id
WHERE se.mounting_point_type_id = mpt.id AND se.main_structure_element_id = mse.id
ORDER BY se.main_structure_element_id, se.id;
-- COPY (SELECT * from ism.ism_view_buildings) TO '/opt/postgres/backup/ism_view_buildings.csv' DELIMITER ',' CSV HEADER;
-- grant select on views to all users
GRANT SELECT ON ALL TABLES IN SCHEMA ism TO ets_ro;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,27 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! add column sanitation_unique_id, drop column procedures_needed, change type for procedures_taken as bigint.
-- PROJECT: Ahtc
-- DATE: 2021-03-22
-- VERSION: 1.06
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
ALTER TABLE IF EXISTS rec_dynamic_participant_data ADD COLUMN IF NOT EXISTS sanitation_unique_id bigint;
ALTER TABLE IF EXISTS rep_sanitation_material_data ADD COLUMN IF NOT EXISTS sanitation_unique_id bigint;
ALTER TABLE IF EXISTS rep_sanitation_material_result ADD COLUMN IF NOT EXISTS sanitation_unique_id bigint;
ALTER TABLE IF EXISTS rec_participant_sanitation ADD COLUMN IF NOT EXISTS sanitation_result integer;
ALTER TABLE IF EXISTS rec_participant_sanitation DROP COLUMN IF EXISTS procedures_needed;
ALTER TABLE IF EXISTS rec_participant_sanitation ADD COLUMN IF NOT EXISTS procedures_taken bigint;
ALTER TABLE IF EXISTS rec_participant_sanitation ALTER COLUMN procedures_taken TYPE bigint;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! update values in PDM building charge effect
-- PROJECT: Ahtc
-- DATE: 2021-03-23
-- VERSION: 1.07
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! New Sanitation Procedures in PDM, changes in EX rec_sanitation, new sanitation materials
-- PROJECT: Ahtc
-- DATE: 2021-05-18
-- VERSION: 1.08
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,20 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: new columns originator_building_id and originator_room_id in recorded table rec_hit_line_info (SVN 53507)
-- PROJECT: Ahtc
-- DATE: 2021-05-27
-- VERSION: 1.09
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS rec_hit_line_info ADD COLUMN IF NOT EXISTS originator_building_id INTEGER;
ALTER TABLE IF EXISTS rec_hit_line_info ADD COLUMN IF NOT EXISTS originator_room_id INTEGER;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Fixes NLDEVCTRL-925 (RPL Nr 728: MunCode falsch)
-- PROJECT: Ahtc
-- DATE: 2021-06-21
-- VERSION: 1.10
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+23
View File
@@ -0,0 +1,23 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add role ctc_sv (backwords compatibility, used for MBA)
-- PROJECT: Ahtc
-- DATE: 2021-06-22
-- VERSION: 1.11
-------------------------------------------------------------------------
-- GLOBAL: PUBLIC;
BEGIN;
-- For Convenience (Backwards Usability)
--CREATE USER ctc PASSWORD 'ctc11de' CREATEROLE;
CREATE USER ctc_sv PASSWORD 'ctc11de' CREATEROLE;
--CREATE USER ctc_ws PASSWORD 'ctc11de' CREATEROLE;
GRANT ets_ro TO ctc, ctc_sv;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+19
View File
@@ -0,0 +1,19 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Added column Name to ISM MPA (SVN 53407)
-- PROJECT: Ahtc
-- DATE: 2021-06-22
-- VERSION: 1.12
-------------------------------------------------------------------------
-- GLOBAL: ISM;
BEGIN;
ALTER TABLE ism_mounting_point_asset ADD COLUMN name text;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,40 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add table egcu_relay_info in ASM (SVN 53346)
-- PROJECT: Ahtc
-- DATE: 2021-06-22
-- VERSION: 1.13
-------------------------------------------------------------------------
-- GLOBAL: ASM;
BEGIN;
ALTER TABLE IF EXISTS asm_egcu_relay_info DROP CONSTRAINT IF EXISTS PK_asm_egcu_relay_info_id CASCADE;
ALTER TABLE IF EXISTS asm_egcu_relay_info DROP CONSTRAINT IF EXISTS UQ_asm_egcu_relay_info_id CASCADE;
ALTER TABLE IF EXISTS asm_egcu_relay_info DROP CONSTRAINT IF EXISTS UQ_asm_egcu_relay_info_name CASCADE;
ALTER TABLE IF EXISTS asm_egcu_relay_info DROP CONSTRAINT IF EXISTS UQ_asm_egcu_relay_info_relay_id CASCADE;
DROP TABLE IF EXISTS asm_egcu_relay_info CASCADE;
CREATE TABLE IF NOT EXISTS asm_egcu_relay_info (
id integer DEFAULT nextval(( 'asm.asm_egcu_relay_info_id_seq'::text)::regclass),
relay_id integer, -- Index of Relay
name text, -- Name of relay
description text, -- description of relay
properties text -- properties of relay
);
COMMENT ON TABLE asm_egcu_relay_info IS 'EGCU-Relay-Names';
COMMENT ON COLUMN asm_egcu_relay_info.relay_id IS 'Index of Relay';
COMMENT ON COLUMN asm_egcu_relay_info.name IS 'Name of relay';
COMMENT ON COLUMN asm_egcu_relay_info.description IS 'description of relay';
COMMENT ON COLUMN asm_egcu_relay_info.properties IS 'properties of relay';
CREATE SEQUENCE IF NOT EXISTS asm_egcu_relay_info_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS asm_egcu_relay_info ADD CONSTRAINT PK_asm_egcu_relay_info_id PRIMARY KEY (id);
ALTER TABLE asm_egcu_relay_info ADD CONSTRAINT UQ_asm_egcu_relay_info_id UNIQUE (id);
ALTER TABLE asm_egcu_relay_info ADD CONSTRAINT UQ_asm_egcu_relay_info_name UNIQUE (name);
ALTER TABLE asm_egcu_relay_info ADD CONSTRAINT UQ_asm_egcu_relay_info_relay_id UNIQUE (relay_id);
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,53 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add table bcu_egcu_relay_infos in Exercise BLD (SVN 53304, 53573)
-- PROJECT: Ahtc
-- DATE: 2021-06-23
-- VERSION: 1.14
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
-- Drop tables/views/sequences/constraints
ALTER TABLE IF EXISTS bcu_egcu_relay_infos DROP CONSTRAINT IF EXISTS PK_bcu_egcu_relay_infos_id CASCADE;
ALTER TABLE IF EXISTS bcu_egcu_relay_infos DROP CONSTRAINT IF EXISTS UQ_bcu_egcu_relay_infos_id CASCADE;
ALTER TABLE IF EXISTS bcu_egcu_relay_infos DROP CONSTRAINT IF EXISTS UQ_bcu_egcu_relay_infos_index CASCADE;
ALTER TABLE IF EXISTS bcu_egcu_relay_infos DROP CONSTRAINT IF EXISTS UQ_bcu_egcu_relay_infos_name CASCADE;
DROP TABLE IF EXISTS bcu_egcu_relay_infos CASCADE;
-- Create tables
CREATE TABLE IF NOT EXISTS bcu_egcu_relay_infos (
id integer DEFAULT nextval(( 'bcu_egcu_relay_infos_id_seq'::text)::regclass),
asset_id bigint, -- 0 = default for all EGCUs &gt, 0 = assetId for special entries
index integer DEFAULT nextval(( 'bcu_egcu_relay_infos_index_seq'::text)::regclass), -- Index of Relay
name text, -- Name of relay
description text, -- description of relay
properties text -- properties of relay
);
COMMENT ON TABLE bcu_egcu_relay_infos IS 'EGCU-Relay-Names';
COMMENT ON COLUMN bcu_egcu_relay_infos.asset_id IS '0 = default for all EGCUs &gt, 0 = assetId for special entries';
COMMENT ON COLUMN bcu_egcu_relay_infos.index IS 'Index of Relay';
COMMENT ON COLUMN bcu_egcu_relay_infos.name IS 'Name of relay';
COMMENT ON COLUMN bcu_egcu_relay_infos.description IS 'description of relay';
COMMENT ON COLUMN bcu_egcu_relay_infos.properties IS 'properties of relay';
-- Create sequence(s)
CREATE SEQUENCE IF NOT EXISTS bcu_egcu_relay_infos_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS bcu_egcu_relay_infos_index_seq INCREMENT 1 START 0 MINVALUE 0;
-- Create primary keys
ALTER TABLE IF EXISTS bcu_egcu_relay_infos ADD CONSTRAINT PK_bcu_egcu_relay_infos_id PRIMARY KEY (id);
-- Indexes
ALTER TABLE bcu_egcu_relay_infos ADD CONSTRAINT UQ_bcu_egcu_relay_infos_id UNIQUE (id);
ALTER TABLE bcu_egcu_relay_infos ADD CONSTRAINT UQ_bcu_egcu_relay_infos_index UNIQUE (index);
ALTER TABLE bcu_egcu_relay_infos ADD CONSTRAINT UQ_bcu_egcu_relay_infos_name UNIQUE (name);
COMMIT;
@@ -0,0 +1,23 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add values in table asm.egcu_relay_info (SVN 53405)
-- PROJECT: Ahtc
-- DATE: 2021-06-23
-- VERSION: 1.15
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
-- EGCU Relay Infos Note: Description and Properties available but unused, Don't insert unused relays!
--INSERT INTO asm.asm_egcu_relay_info(id, relay_id, name) VALUES (1, 0, 'Lampe');
--INSERT INTO asm.asm_egcu_relay_info(id, relay_id, name) VALUES (2, 1, 'Heizung');
--INSERT INTO asm.asm_egcu_relay_info(id, relay_id, name, properties) VALUES (3, 2, 'Nebel', '{"allowPermanentOn":false}');
--ALTER SEQUENCE asm.asm_egcu_relay_info_id_seq RESTART WITH 4;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+18
View File
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! update values in PDM (SVN 53828) - gear_type_charge_type, building_charge_effect, charge_type Nebel
-- PROJECT: Ahtc
-- DATE: 2021-03-25
-- VERSION: 1.16
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,28 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! New operator rights EgcuMonitorShow and EgcuRoomsEdit
-- PROJECT: Ahtc
-- DATE: 2021-06-29
-- VERSION: 1.17
-------------------------------------------------------------------------
-- GLOBAL: OPM;
BEGIN;
--- Base: 738263040, EgcuMonitorShow - 738263047 = 0x2c010007
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (738263047, 'EgcuMonitorShow', 'Show EgcuMonitor');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (738197509, 'EgcuMonitorShow', 'Show EgcuMonitor', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (738197509, 738263047); -- group_id is: 738197509 = 0x2c000005
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (738263040, 738197509); -- Service Monitors - Participants
--- Base: 738263040, EgcuRoomsEdit - 738263048 = 0x2c010008
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (738263048, 'EgcuRoomsEdit', 'Edit the rooms belonging to one segment.');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (738197510, 'EgcuRoomsEdit', 'Edit the rooms belonging to one segment.', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (738197510, 738263048); -- group_id is: 738197510 = 0x2c000006
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (738263040, 738197510); -- Service Monitors - Participants
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! update dis_entity in PDM and generate codes 2xxx, 4xxx etc.
-- PROJECT: Ahtc
-- DATE: 2021-07-26
-- VERSION: 1.18
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! update PDM Gear Type fr Puma
-- PROJECT: Ahtc
-- DATE: 2021-08-09
-- VERSION: 1.19
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,20 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: new indexes on eem_event table (on sample_time and event_type) to optimize search (SVN 54364)
-- PROJECT: Ahtc
-- DATE: 2021-08-12
-- VERSION: 1.20
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
CREATE INDEX IDX_eem_event_sample_time ON eem_event (sample_time);
CREATE INDEX IDX_eem_event_event_type_id ON eem_event (event_type_id);
COMMIT;
@@ -0,0 +1,38 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Add ISM and EX BLD Bridge modifications
-- PROJECT: Ahtc
-- DATE: 2021-08-17
-- VERSION: 1.21
-------------------------------------------------------------------------
-- GLOBAL: ISM;
BEGIN;
INSERT INTO ism_structure_element_type (id, name) VALUES (11, 'Bridge');
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS rec_bridge_status DROP CONSTRAINT IF EXISTS PK_rec_bridge_status_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_bridge_status DROP CONSTRAINT IF EXISTS IDX_rec_bridge_status_sample_time CASCADE;
DROP TABLE IF EXISTS rec_bridge_status CASCADE;
CREATE TABLE IF NOT EXISTS rec_bridge_status (
id integer,
name text,
is_deleted boolean,
is_used boolean,
sample_time bigint,
building_id integer,
status integer,
rec_id bigint DEFAULT nextval(( 'rec_bridge_status_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_bridge_status IS 'recorded data for topic BridgeStatus';
CREATE SEQUENCE IF NOT EXISTS rec_bridge_status_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_bridge_status ADD CONSTRAINT PK_rec_bridge_status_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_bridge_status_sample_time ON rec_bridge_status (sample_time);
COMMIT;
@@ -0,0 +1,106 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Add ISM changes from Resource Management branch
-- PROJECT: Ahtc
-- DATE: 2021-08-17
-- VERSION: 1.22
-------------------------------------------------------------------------
-- GLOBAL: ISM;
BEGIN;
ALTER TABLE IF EXISTS ism_mounting_point_plan DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_plan_mounting_point_state_ism_mounting_po CASCADE;
ALTER TABLE IF EXISTS ism_mounting_point_schedule DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_schedule_status_id_ism_schedule_status_id CASCADE;
ALTER TABLE IF EXISTS ism_schedule_status DROP CONSTRAINT IF EXISTS PK_ism_schedule_status_id CASCADE;
ALTER TABLE IF EXISTS ism_schedule_status_change DROP CONSTRAINT IF EXISTS PK_ism_schedule_status_change_id CASCADE;
ALTER TABLE IF EXISTS ism_schedule_status_change DROP CONSTRAINT IF EXISTS FK_ism_schedule_status_change_schedule_id_ism_mounting_point_sc CASCADE;
ALTER TABLE IF EXISTS ism_schedule_status_change DROP CONSTRAINT IF EXISTS FK_ism_schedule_status_change_schedule_status_id_ism_schedule_s CASCADE;
DROP TABLE IF EXISTS ism_schedule_status CASCADE;
DROP TABLE IF EXISTS ism_schedule_status_change CASCADE;
CREATE TABLE IF NOT EXISTS ism_schedule_status (
id integer DEFAULT nextval(( 'ism.ism_schedule_status_id_seq'::text)::regclass),
name text
);
CREATE TABLE IF NOT EXISTS ism_schedule_status_change (
id integer DEFAULT nextval(( 'ism.ism_schedule_status_change_id_seq'::text)::regclass),
schedule_id integer,
schedule_status_id integer,
changed_at bigint,
operator_id integer,
workstation_id integer
);
COMMENT ON TABLE ism_schedule_status_change IS 'instrumentation plan status changes';
ALTER TABLE ism_mounting_point_plan ADD COLUMN IF NOT EXISTS mounting_point_state integer DEFAULT 0;
COMMENT ON COLUMN ism_mounting_point_plan.mounting_point_state IS '(-1, 0, 1) - (Empty, Idle, Equipped)';
DELETE FROM ism_mounting_point_state WHERE id = -1;
INSERT INTO ism_mounting_point_state (id, name) VALUES (-1, 'Empty');
INSERT INTO ism_schedule_status (id, name) VALUES (0, 'Unknown');
INSERT INTO ism_schedule_status (id, name) VALUES (1, 'Created');
INSERT INTO ism_schedule_status (id, name) VALUES (2, 'Prepared');
INSERT INTO ism_schedule_status (id, name) VALUES (3, 'Activated');
INSERT INTO ism_schedule_status (id, name) VALUES (4, 'Expired');
INSERT INTO ism_schedule_status (id, name) VALUES (5, 'Removed');
CREATE SEQUENCE IF NOT EXISTS ism_schedule_status_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS ism_schedule_status_change_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS ism_schedule_status ADD CONSTRAINT PK_ism_schedule_status_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS ism_schedule_status_change ADD CONSTRAINT PK_ism_schedule_status_change_id PRIMARY KEY (id);
ALTER TABLE ism_mounting_point_schedule ADD COLUMN IF NOT EXISTS status_id INTEGER;
ALTER TABLE ism_mounting_point_schedule ADD COLUMN IF NOT EXISTS time_created bigint DEFAULT (extract(epoch from now()) * 1000);
ALTER TABLE ism_mounting_point_schedule ADD COLUMN IF NOT EXISTS time_prepared bigint;
COMMENT ON COLUMN ism_mounting_point_schedule.time_start IS 'time activated';
COMMENT ON COLUMN ism_mounting_point_schedule.time_end IS 'time expired';
ALTER TABLE ism_mounting_point_schedule ADD CONSTRAINT FK_ism_mounting_point_schedule_status_id_ism_schedule_status_id FOREIGN KEY (status_id) REFERENCES ism_schedule_status (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_schedule_status_change ADD CONSTRAINT FK_ism_schedule_status_change_schedule_id_ism_mounting_point_sc FOREIGN KEY (schedule_id) REFERENCES ism_mounting_point_schedule (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_schedule_status_change ADD CONSTRAINT FK_ism_schedule_status_change_schedule_status_id_ism_schedule_s FOREIGN KEY (schedule_status_id) REFERENCES ism_schedule_status (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_mounting_point_plan ADD CONSTRAINT FK_ism_mounting_point_plan_mounting_point_state_ism_mounting_po FOREIGN KEY (mounting_point_state) REFERENCES ism_mounting_point_state (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- DROP INDEX IF EXISTS IDX_ism_mounting_point_plan_mounting_point_schedule_id CASCADE;
CREATE INDEX IF NOT EXISTS IDX_ism_mounting_point_plan_mounting_point_schedule_id ON ism_mounting_point_plan (mounting_point_schedule_id);
UPDATE ism_mounting_point_schedule SET status_id = 1 WHERE status_id IS null;
-- Notify functions for callbacks (signals in db interface) - needed for copySchedule
CREATE OR REPLACE FUNCTION public.ism_notifyInsertMainSchedule()
RETURNS TRIGGER AS $$
DECLARE
toNotify RECORD;
toReturn RECORD;
BEGIN
IF (TG_OP = 'INSERT') THEN
toNotify = NEW;
toReturn = NEW;
ELSIF (TG_OP = 'UPDATE') THEN
toNotify = OLD;
toReturn = NEW;
ELSIF (TG_OP = 'DELETE') THEN
toNotify = OLD;
toReturn = OLD;
END IF;
PERFORM pg_notify('notifyInsertMainSchedule', CAST(toNotify.id AS text));
RETURN toReturn;
END;
$$ LANGUAGE plpgsql;
-- Notify function trigger for callbacks (signals in db interface) - needed for copySchedule
DROP TRIGGER IF EXISTS trg_ai_notifyInsertMainSchedule ON ism_mounting_point_schedule;
CREATE TRIGGER trg_ai_notifyInsertMainSchedule
AFTER INSERT ON ism_mounting_point_schedule FOR EACH ROW EXECUTE PROCEDURE public.ism_notifyInsertMainSchedule();
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+18
View File
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add 6 Guez bridges with footprints
-- PROJECT: Ahtc
-- DATE: 2021-09-03
-- VERSION: 1.23
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+18
View File
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Puma VBA changes
-- PROJECT: Ahtc
-- DATE: 2021-08-26
-- VERSION: 1.24
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Disentities for all charge types
-- PROJECT: Ahtc
-- DATE: 2021-08-27
-- VERSION: 1.25
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+19
View File
@@ -0,0 +1,19 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add MP type BuildingNetworkSwitch and delete double entries from assets
-- PROJECT: Ahtc
-- DATE: 2021-09-16
-- VERSION: 1.26
-------------------------------------------------------------------------
-- GLOBAL: ISM;
BEGIN;
INSERT INTO ism.ism_mounting_point_type (id, name) VALUES (14, 'BuildingNetworkSwitch');
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add values with icons in table asm.egcu_relay_info (NLDEVCTRL-1333)
-- PROJECT: Ahtc
-- DATE: 2021-09-16
-- VERSION: 1.27
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! update values in pdm_gear_type_charge_type (NLDEVCTRL-926)
-- PROJECT: Ahtc
-- DATE: 2021-09-17
-- VERSION: 1.28
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Update display names for buildings and mounting points (for streams) by removing "bldg_"
-- PROJECT: Ahtc
-- DATE: 2021-09-26
-- VERSION: 1.29
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+18
View File
@@ -0,0 +1,18 @@
--# $Id$
--# $HeadURL$
--# $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Move OutdoorIPS (6) to IndoorIPS (5)
-- PROJECT: Ahtc
-- DATE: 2021-09-21
-- VERSION: 1.30
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+14
View File
@@ -0,0 +1,14 @@
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Clean up FLM
-- PROJECT: Ahtc
-- DATE: 2021-09-23
-- VERSION: 1.31
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,14 @@
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Insert missing folder structure for ex 130 (phase 141)
-- PROJECT: Ahtc
-- DATE: 2021-09-24
-- VERSION: 1.32
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Add back Nebel Mrt (385) in pdm_gear_type_charge_type and also in exercise charge administration table
-- PROJECT: Ahtc
-- DATE: 2021-09-24
-- VERSION: 1.33
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
+18
View File
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! clean events: remove AVS event with no streamName, remove duplicates. Clean pdm_event_type.
-- PROJECT: Ahtc
-- DATE: 2021-09-29
-- VERSION: 1.34
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,26 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: add column qualification in old exercises
-- PROJECT: Ahtc
-- DATE: 2021-11-10
-- VERSION: 1.35
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
-- PPM
ALTER TABLE IF EXISTS rec_dynamic_participant_data ADD COLUMN IF NOT EXISTS qualification integer;
UPDATE rec_dynamic_participant_data SET qualification = 1 WHERE qualification IS NULL;
-- REP
ALTER TABLE IF EXISTS rep_sanitation_material_data ADD COLUMN IF NOT EXISTS qualification integer;
ALTER TABLE IF EXISTS rep_sanitation_material_result ADD COLUMN IF NOT EXISTS qualification integer;
UPDATE rep_sanitation_material_data SET qualification = 1 WHERE qualification IS NULL;
UPDATE rep_sanitation_material_result SET qualification = 1 WHERE qualification IS NULL;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! update values in PDM building charge effect (SVN 55598)
-- PROJECT: Ahtc
-- DATE: 2021-11-15
-- VERSION: 1.36
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,18 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! New equipment type and 2 types for Patient Simulation
-- PROJECT: Ahtc
-- DATE: 2021-11-25
-- VERSION: 1.37
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,47 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------------------
-- INFO: New columns in AES impact_position_z and source_position x,y,z (BRANCH 3DWS!)
-- PROJECT: Ahtc
-- DATE: 2021-12-07
-- VERSION: 1.38
------------------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS aes_explosion ADD COLUMN IF NOT EXISTS impact_position_z DOUBLE PRECISION;
ALTER TABLE IF EXISTS rec_explosion_single ADD COLUMN IF NOT EXISTS impact_position_z DOUBLE PRECISION;
ALTER TABLE IF EXISTS aes_explosion_single_central ADD COLUMN IF NOT EXISTS source_position_x DOUBLE PRECISION;
ALTER TABLE IF EXISTS aes_explosion_single_central ADD COLUMN IF NOT EXISTS source_position_y DOUBLE PRECISION;
ALTER TABLE IF EXISTS aes_explosion_single_central ADD COLUMN IF NOT EXISTS source_position_y DOUBLE PRECISION;
ALTER TABLE IF EXISTS rec_explosion_single_central ADD COLUMN IF NOT EXISTS impact_position_z DOUBLE PRECISION;
ALTER TABLE IF EXISTS rec_explosion_single_central ADD COLUMN IF NOT EXISTS source_position_x DOUBLE PRECISION;
ALTER TABLE IF EXISTS rec_explosion_single_central ADD COLUMN IF NOT EXISTS source_position_y DOUBLE PRECISION;
ALTER TABLE IF EXISTS rec_explosion_single_central ADD COLUMN IF NOT EXISTS source_position_y DOUBLE PRECISION;
CREATE OR REPLACE VIEW aes_explosion_area_view AS SELECT aes_entity.id AS id, aes_entity.charge_type_id AS charge_type_id, aes_entity.effect_state_id AS effect_state_id, aes_entity.party_id AS party_id, aes_entity.participant_id AS participant_id, aes_entity.effect_duration AS effect_duration, aes_entity.effect_start AS effect_start, aes_entity.name AS name, aes_entity.effect_marking_in_ta AS effect_marking_in_ta, aes_entity.external_id AS external_id, aes_explosion.entity_id AS entity_id, aes_explosion.impact_position_x AS impact_position_x, aes_explosion.impact_position_y AS impact_position_y, aes_explosion.rotation_angle AS rotation_angle, aes_explosion.fire_purpose AS fire_purpose, aes_explosion.fire_request_time AS fire_request_time, aes_explosion.altitude AS altitude, aes_explosion.impact_position_z AS impact_position_z, aes_explosion_area.explosion_id AS explosion_id, aes_explosion_area.impact_width AS impact_width, aes_explosion_area.impact_length AS impact_length, aes_explosion_area.cannon_count AS cannon_count, aes_explosion_area.cannon_rounds AS cannon_rounds, aes_explosion_area.original_effect_start AS original_effect_start, aes_explosion_area.original_effect_duration AS original_effect_duration, aes_explosion_area.remain_explosion_number AS remain_explosion_number, aes_explosion_area.id AS aes_explosion_area_id
FROM aes_explosion_area, aes_entity, aes_explosion
WHERE aes_entity.id = aes_explosion.entity_id AND
aes_explosion.id = aes_explosion_area.explosion_id;
CREATE OR REPLACE VIEW aes_explosion_single_view AS SELECT aes_entity.id AS id, aes_entity.charge_type_id AS charge_type_id, aes_entity.effect_state_id AS effect_state_id, aes_entity.party_id AS party_id, aes_entity.participant_id AS participant_id, aes_entity.effect_duration AS effect_duration, aes_entity.effect_start AS effect_start, aes_entity.name AS name, aes_entity.effect_marking_in_ta AS effect_marking_in_ta, aes_entity.external_id AS external_id, aes_explosion.entity_id AS entity_id, aes_explosion.impact_position_x AS impact_position_x, aes_explosion.impact_position_y AS impact_position_y, aes_explosion.rotation_angle AS rotation_angle, aes_explosion.fire_purpose AS fire_purpose, aes_explosion.fire_request_time AS fire_request_time, aes_explosion.altitude AS altitude, aes_explosion.impact_position_z AS impact_position_z, aes_explosion_single.explosion_id AS explosion_id, aes_explosion_single.id AS aes_explosion_single_id
FROM aes_explosion_single, aes_entity, aes_explosion
WHERE aes_entity.id = aes_explosion.entity_id AND
aes_explosion.id = aes_explosion_single.explosion_id;
CREATE OR REPLACE VIEW aes_explosion_single_central_view AS SELECT aes_entity.id AS id, aes_entity.charge_type_id AS charge_type_id, aes_entity.effect_state_id AS effect_state_id, aes_entity.party_id AS party_id, aes_entity.participant_id AS participant_id, aes_entity.effect_duration AS effect_duration, aes_entity.effect_start AS effect_start, aes_entity.name AS name, aes_entity.effect_marking_in_ta AS effect_marking_in_ta, aes_entity.external_id AS external_id, aes_explosion.entity_id AS entity_id, aes_explosion.impact_position_x AS impact_position_x, aes_explosion.impact_position_y AS impact_position_y, aes_explosion.rotation_angle AS rotation_angle, aes_explosion.fire_purpose AS fire_purpose, aes_explosion.fire_request_time AS fire_request_time, aes_explosion.altitude AS altitude, aes_explosion.impact_position_z AS impact_position_z, aes_explosion_single.explosion_id AS explosion_id, aes_explosion_single_central.explosion_single_id AS explosion_single_id, aes_explosion_single_central.angle AS angle, aes_explosion_single_central.fuse_type_id AS fuse_type_id, aes_explosion_single_central.source_position_x AS source_position_x, aes_explosion_single_central.source_position_y AS source_position_y, aes_explosion_single_central.source_position_z AS source_position_z, aes_explosion_single_central.id AS aes_explosion_single_central_id
FROM aes_explosion_single_central, aes_entity, aes_explosion, aes_explosion_single
WHERE aes_entity.id = aes_explosion.entity_id AND
aes_explosion.id = aes_explosion_single.explosion_id AND
aes_explosion_single.id = aes_explosion_single_central.explosion_single_id;
COMMIT;
@@ -0,0 +1,23 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Properties column for Type and Participant
-- PROJECT: Ahtc
-- DATE: 2021-12-14
-- VERSION: 1.39
-------------------------------------------------------------------------
-- GLOBAL: PPM;
BEGIN;
ALTER TABLE IF EXISTS ppm_type ADD COLUMN IF NOT EXISTS properties jsonb;
ALTER TABLE IF EXISTS ppm_participant ADD COLUMN IF NOT EXISTS properties jsonb;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS ppm_participant ADD COLUMN IF NOT EXISTS properties jsonb;
-- in recorded topic is text
ALTER TABLE IF EXISTS rec_participant ADD COLUMN IF NOT EXISTS properties text;
COMMIT;
+19
View File
@@ -0,0 +1,19 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Increase EXM.exercise sequence so it does not overlap existing exercises in Warehouse
-- PROJECT: Ahtc
-- DATE: 2022-01-13
-- VERSION: 1.40
-------------------------------------------------------------------------
-- GLOBAL: EXM;
BEGIN;
ALTER SEQUENCE exm.exercise_id_seq RESTART WITH 200;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,77 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Add missing CTC workstations
-- PROJECT: Ahtc
-- DATE: 2022-02-08
-- VERSION: 1.41
-------------------------------------------------------------------------
-- GLOBAL: ASM;
BEGIN;
-- CTC Auditorium
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(165, 'ECAA1WS01', 1, 6);
-- CTC AAR Workstations
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(166, 'ECAA2WS01', 1, 6),
(167, 'ECAA2WS02', 1, 6);
-- CTC O/C Tablets - LAN
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(201, 'ECCTANB01GB', 1, 6),
(202, 'ECCTANB02GB', 1, 6),
(203, 'ECCTANB03GB', 1, 6),
(204, 'ECCTANB04GB', 1, 6),
(205, 'ECCTANB05GB', 1, 6),
(206, 'ECCTANB06GB', 1, 6),
(207, 'ECCTANB07GB', 1, 6),
-- (208, 'ECCTANB08GB', 1, 6), -- already in DB with id 170
(209, 'ECCTANB09GB', 1, 6),
(210, 'ECCTANB10GB', 1, 6),
(211, 'ECCTANB11GB', 1, 6),
(212, 'ECCTANB12GB', 1, 6),
(213, 'ECCTANB13GB', 1, 6),
(214, 'ECCTANB14GB', 1, 6),
(215, 'ECCTANB15GB', 1, 6),
(216, 'ECCTANB16GB', 1, 6),
(217, 'ECCTANB17GB', 1, 6),
(218, 'ECCTANB18GB', 1, 6),
(219, 'ECCTANB19GB', 1, 6),
(220, 'ECCTANB20GB', 1, 6);
UPDATE asm.asm_asset SET id = 208 where id = 170;
-- CTC O/C Tablets - WIFI
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(221, 'ECCTANB01', 1, 6),
(222, 'ECCTANB02', 1, 6),
(223, 'ECCTANB03', 1, 6),
(224, 'ECCTANB04', 1, 6),
(225, 'ECCTANB05', 1, 6),
(226, 'ECCTANB06', 1, 6),
(227, 'ECCTANB07', 1, 6),
(228, 'ECCTANB08', 1, 6),
(229, 'ECCTANB09', 1, 6),
(230, 'ECCTANB10', 1, 6),
(231, 'ECCTANB11', 1, 6),
(232, 'ECCTANB12', 1, 6),
(233, 'ECCTANB13', 1, 6),
(234, 'ECCTANB14', 1, 6),
(235, 'ECCTANB15', 1, 6),
(236, 'ECCTANB16', 1, 6),
(237, 'ECCTANB17', 1, 6),
(238, 'ECCTANB18', 1, 6),
(239, 'ECCTANB19', 1, 6),
(240, 'ECCTANB20', 1, 6);
ALTER SEQUENCE asm.asm_asset_id_seq RESTART WITH 300;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,32 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Dis_Entities in Pdm_charge_type
-- PROJECT: Ahtc
-- DATE: 2022-02-09
-- VERSION: 1.42
-------------------------------------------------------------------------
-- GLOBAL: PDM;
BEGIN;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.9.225.2.3.1.0', properties = '{"impactRadius":4}' WHERE id = 44;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.9.225.2.21.1.0', properties = '{"impactRadius":20}' WHERE id = 42;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.9.225.2.21.3.0', properties = '{"impactRadius":20}' WHERE id = 43;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.9.225.2.21.0.0', properties = '{"impactRadius":20}' WHERE id = 45;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.2.225.1.3.5.1', properties = '{"impactRadius":10}' WHERE id = 46;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.2.225.1.3.5.2', properties = '{"impactRadius":10}' WHERE id = 47;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.1.222.1.30.0.0', properties = '{"impactRadius":10}' WHERE id = 25;
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id) VALUES ( 1097, 42);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id) VALUES ( 1097, 43);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id) VALUES ( 1097, 45);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id) VALUES ( 1098, 44);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id) VALUES ( 1099, 46);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id) VALUES ( 1099, 47);
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,39 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: add columns (vitality, time_vitality, area_id, area_name) in rep_treament_data and rep_treatment_result
-- PROJECT: Ahtc
-- DATE: 2022-02-16
-- VERSION: 1.43
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS rep_treatment_data ADD COLUMN IF NOT EXISTS vitality INTEGER;
ALTER TABLE IF EXISTS rep_treatment_result ADD COLUMN IF NOT EXISTS vitality INTEGER;
ALTER TABLE IF EXISTS rep_treatment_data ADD COLUMN IF NOT EXISTS time_vitality BIGINT;
ALTER TABLE IF EXISTS rep_treatment_result ADD COLUMN IF NOT EXISTS time_vitality BIGINT;
UPDATE rep_treatment_data SET vitality = 100 WHERE vitality IS NULL;
UPDATE rep_treatment_result SET vitality = 100 WHERE vitality IS NULL;
UPDATE rep_treatment_data SET time_vitality = time_vulnerability WHERE time_vitality IS NULL OR (time_vitality = 0 AND time_vulnerability > 0);
UPDATE rep_treatment_result SET time_vitality = time_vulnerability WHERE time_vitality IS NULL OR (time_vitality = 0 AND time_vulnerability > 0);
ALTER TABLE IF EXISTS rep_treatment_data ADD COLUMN IF NOT EXISTS area_id INTEGER;
ALTER TABLE IF EXISTS rep_treatment_result ADD COLUMN IF NOT EXISTS area_id INTEGER;
ALTER TABLE IF EXISTS rep_treatment_data ADD COLUMN IF NOT EXISTS area_name TEXT;
ALTER TABLE IF EXISTS rep_treatment_result ADD COLUMN IF NOT EXISTS area_name TEXT;
ALTER TABLE IF EXISTS rep_treatment_data ADD COLUMN IF NOT EXISTS area_name TEXT;
ALTER TABLE IF EXISTS rep_treatment_result ADD COLUMN IF NOT EXISTS area_name TEXT;
COMMIT;
@@ -0,0 +1,108 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: Add REP event type enum and new treatment timeline tables
-- PROJECT: Ahtc
-- DATE: 2022-02-21
-- VERSION: 2.01
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
DELETE FROM rep_report_type WHERE id = 18;
INSERT INTO rep_report_type (id, name) VALUES (18, 'TreatmentTimeline');
ALTER TABLE IF EXISTS rep_event_type DROP CONSTRAINT IF EXISTS PK_rep_event_type_id CASCADE;
DROP TABLE IF EXISTS rep_event_type CASCADE;
CREATE SEQUENCE IF NOT EXISTS rep_event_type_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS rep_event_type (
id integer DEFAULT nextval(( 'rep_event_type_id_seq'::text)::regclass),
name text
);
ALTER TABLE IF EXISTS rep_event_type ADD CONSTRAINT PK_rep_event_type_id PRIMARY KEY (id);
DELETE FROM rep_event_type;
INSERT INTO rep_event_type (id, name) VALUES (1, 'VBGChanged');
INSERT INTO rep_event_type (id, name) VALUES (2, 'VitalityChanged');
INSERT INTO rep_event_type (id, name) VALUES (3, 'NineLinerSet');
INSERT INTO rep_event_type (id, name) VALUES (4, 'DCUConnected');
INSERT INTO rep_event_type (id, name) VALUES (5, 'FirstTreatment');
INSERT INTO rep_event_type (id, name) VALUES (6, 'Treatment');
INSERT INTO rep_event_type (id, name) VALUES (7, 'TransportInitiated');
INSERT INTO rep_event_type (id, name) VALUES (8, 'EnterFunctionalArea');
INSERT INTO rep_event_type (id, name) VALUES (9, 'PositionChanged');
INSERT INTO rep_event_type (id, name) VALUES (10,'VitalityReset');
ALTER TABLE IF EXISTS rep_treatment_timeline_data DROP CONSTRAINT IF EXISTS PK_rep_treatment_timeline_data_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_data DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_data_event_type_id_rep_event_type_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_data DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_data_party_id_ppm_party_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_data DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_data_participant_id_ppm_participant_i CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_data DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_data_participant_type_id_ppm_type_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_data DROP CONSTRAINT IF EXISTS UQ_rep_treatment_timeline_data_party_id_participant_type_id_par CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS PK_rep_treatment_timeline_result_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_result_event_type_id_rep_event_type_i CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_result_report_id_rep_report_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_result_participant_id_ppm_participant CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS FK_rep_treatment_timeline_result_participant_type_id_ppm_type_i CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS IDX_rep_treatment_timeline_result_report_id CASCADE;
ALTER TABLE IF EXISTS rep_treatment_timeline_result DROP CONSTRAINT IF EXISTS UQ_rep_treatment_timeline_result_report_id_participant_id_event CASCADE;
DROP TABLE IF EXISTS rep_treatment_timeline_data CASCADE;
DROP TABLE IF EXISTS rep_treatment_timeline_result CASCADE;
CREATE TABLE IF NOT EXISTS rep_treatment_timeline_data (
id bigint DEFAULT nextval(( 'rep_treatment_timeline_data_id_seq'::text)::regclass),
party_id integer,
participant_type_id integer,
participant_id integer,
event_type_id integer,
event_time bigint,
vulnerability integer,
vitality integer,
properties jsonb
);
CREATE TABLE IF NOT EXISTS rep_treatment_timeline_result (
id bigint DEFAULT nextval(( 'rep_treatment_timeline_result_id_seq'::text)::regclass),
report_id bigint,
participant_type_id integer,
participant_id integer,
participant_name text,
participant_equipment_number integer,
event_type_id integer,
event_time bigint,
vulnerability integer,
vitality integer,
properties jsonb
);
CREATE SEQUENCE IF NOT EXISTS rep_treatment_timeline_data_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS rep_treatment_timeline_result_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rep_treatment_timeline_data ADD CONSTRAINT PK_rep_treatment_timeline_data_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS rep_treatment_timeline_result ADD CONSTRAINT PK_rep_treatment_timeline_result_id PRIMARY KEY (id);
ALTER TABLE rep_treatment_timeline_data ADD CONSTRAINT FK_rep_treatment_timeline_data_event_type_id_rep_event_type_id FOREIGN KEY (event_type_id) REFERENCES rep_event_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_data ADD CONSTRAINT FK_rep_treatment_timeline_data_party_id_ppm_party_id FOREIGN KEY (party_id) REFERENCES ppm_party (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_data ADD CONSTRAINT FK_rep_treatment_timeline_data_participant_id_ppm_participant_i FOREIGN KEY (participant_id) REFERENCES ppm_participant (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_data ADD CONSTRAINT FK_rep_treatment_timeline_data_participant_type_id_ppm_type_id FOREIGN KEY (participant_type_id) REFERENCES ppm.ppm_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_result ADD CONSTRAINT FK_rep_treatment_timeline_result_event_type_id_rep_event_type_i FOREIGN KEY (event_type_id) REFERENCES rep_event_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_result ADD CONSTRAINT FK_rep_treatment_timeline_result_report_id_rep_report_id FOREIGN KEY (report_id) REFERENCES rep_report (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_result ADD CONSTRAINT FK_rep_treatment_timeline_result_participant_id_ppm_participant FOREIGN KEY (participant_id) REFERENCES ppm_participant (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_result ADD CONSTRAINT FK_rep_treatment_timeline_result_participant_type_id_ppm_type_i FOREIGN KEY (participant_type_id) REFERENCES ppm.ppm_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_treatment_timeline_data ADD CONSTRAINT UQ_rep_treatment_timeline_data_party_id_participant_type_id_par UNIQUE (party_id, participant_type_id, participant_id, event_time, event_type_id);
CREATE INDEX IDX_rep_treatment_timeline_result_report_id ON rep_treatment_timeline_result (report_id);
ALTER TABLE rep_treatment_timeline_result ADD CONSTRAINT UQ_rep_treatment_timeline_result_report_id_participant_id_event UNIQUE (report_id, participant_id, event_time, event_type_id);
COMMIT;
@@ -0,0 +1,76 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! new tables for NLOS Service in TAB Proxy
-- PROJECT: Ahtc
-- DATE: 2022-02-22
-- VERSION: 2.02
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS rec_medical_information DROP CONSTRAINT IF EXISTS PK_rec_medical_information_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_medical_information DROP CONSTRAINT IF EXISTS IDX_rec_medical_information_sample_time CASCADE;
ALTER TABLE IF EXISTS rec_nlos_fire_result DROP CONSTRAINT IF EXISTS PK_rec_nlos_fire_result_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_nlos_fire_result DROP CONSTRAINT IF EXISTS IDX_rec_nlos_fire_result_sample_time CASCADE;
ALTER TABLE IF EXISTS rec_nlos_simulator_direction DROP CONSTRAINT IF EXISTS PK_rec_nlos_simulator_direction_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_nlos_simulator_direction DROP CONSTRAINT IF EXISTS IDX_rec_nlos_simulator_direction_sample_time CASCADE;
DROP TABLE IF EXISTS rec_medical_information CASCADE;
DROP TABLE IF EXISTS rec_nlos_fire_result CASCADE;
DROP TABLE IF EXISTS rec_nlos_simulator_direction CASCADE;
CREATE TABLE IF NOT EXISTS rec_medical_information (
equipment_number integer,
sample_time bigint,
vital_signs smallint,
body_temperature double precision,
blood_oxygen_peripheral_saturation double precision,
systolic_blood_pressure double precision,
diastolic_blood_pressure double precision,
heart_rate double precision,
respiratory_rate double precision,
rec_id bigint DEFAULT nextval(( 'rec_medical_information_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_medical_information IS 'recorded data for topic MedicalInformation';
CREATE TABLE IF NOT EXISTS rec_nlos_fire_result (
equipment_number integer,
sample_time bigint,
target_equipment_number integer,
shooting_result integer,
rec_id bigint DEFAULT nextval(( 'rec_nlos_fire_result_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_nlos_fire_result IS 'recorded data for topic NlosFireResult';
CREATE TABLE IF NOT EXISTS rec_nlos_simulator_direction (
equipment_number integer,
sample_time bigint,
direction double precision,
rec_id bigint DEFAULT nextval(( 'rec_nlos_simulator_direction_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_nlos_simulator_direction IS 'recorded data for topic NlosSimulatorDirection';
CREATE SEQUENCE IF NOT EXISTS rec_medical_information_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS rec_nlos_fire_result_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS rec_nlos_simulator_direction_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_medical_information ADD CONSTRAINT PK_rec_medical_information_rec_id PRIMARY KEY (rec_id);
ALTER TABLE IF EXISTS rec_nlos_fire_result ADD CONSTRAINT PK_rec_nlos_fire_result_rec_id PRIMARY KEY (rec_id);
ALTER TABLE IF EXISTS rec_nlos_simulator_direction ADD CONSTRAINT PK_rec_nlos_simulator_direction_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_medical_information_sample_time ON rec_medical_information (sample_time);
CREATE INDEX IDX_rec_nlos_fire_result_sample_time ON rec_nlos_fire_result (sample_time);
CREATE INDEX IDX_rec_nlos_simulator_direction_sample_time ON rec_nlos_simulator_direction (sample_time);
COMMIT;
@@ -0,0 +1,20 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: New properties columns in gear_type and pdm_gear_type_charge_type
-- PROJECT: Ahtc
-- DATE: 2022-03-24
-- VERSION: 2.03
-------------------------------------------------------------------------
-- GLOBAL: PDM;
BEGIN;
ALTER TABLE IF EXISTS pdm_gear_type ADD COLUMN IF NOT EXISTS properties jsonb;
ALTER TABLE IF EXISTS pdm_gear_type_charge_type ADD COLUMN IF NOT EXISTS properties jsonb;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,33 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! New enum MedicalIncident in PDM
-- PROJECT: Ahtc
-- DATE: 2022-03-21
-- VERSION: 2.04
-------------------------------------------------------------------------
-- GLOBAL: PDM;
BEGIN;
ALTER TABLE IF EXISTS pdm_medical_incident DROP CONSTRAINT IF EXISTS PK_pdm_medical_incident_id CASCADE;
DROP TABLE IF EXISTS pdm_medical_incident CASCADE;
CREATE TABLE IF NOT EXISTS pdm_medical_incident (
id integer DEFAULT nextval(( 'pdm.pdm_medical_incident_id_seq'::text)::regclass),
name text
);
CREATE SEQUENCE IF NOT EXISTS pdm_medical_incident_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS pdm_medical_incident ADD CONSTRAINT PK_pdm_medical_incident_id PRIMARY KEY (id);
INSERT INTO pdm_medical_incident (id, name) VALUES (-1, 'None');
INSERT INTO pdm_medical_incident (id, name) VALUES (0, 'Intubation');
INSERT INTO pdm_medical_incident (id, name) VALUES (1, 'Tourniquet');
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,20 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Drop FK on material_id to avoid losing report data
-- PROJECT: Ahtc
-- DATE: 2022-03-23
-- VERSION: 2.05
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
ALTER TABLE IF EXISTS rep_sanitation_material_data DROP CONSTRAINT IF EXISTS FK_rep_sanitation_material_data_pdm_sanitation_material CASCADE;
ALTER TABLE IF EXISTS rep_sanitation_material_result DROP CONSTRAINT IF EXISTS FK_rep_sanitation_material_result_pdm_sanitation_material CASCADE;
COMMIT;
@@ -0,0 +1,29 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! new column for marker_description added
-- PROJECT: Ahtc
-- DATE: 2022-03-24
-- VERSION: 2.06
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
-- mrk_marker_type
INSERT INTO mrk_marker_type (id, name) VALUES (8, 'MedicalIncident');
-- mrk_marker_description
ALTER TABLE IF EXISTS mrk_marker_description DROP CONSTRAINT IF EXISTS FK_mrk_marker_description_medical_incident_id_pdm_medical_incid CASCADE;
ALTER TABLE mrk_marker_description ADD medical_incident_id integer;
ALTER TABLE mrk_marker_description ADD CONSTRAINT FK_mrk_marker_description_medical_incident_id_pdm_medical_incid FOREIGN KEY (medical_incident_id) REFERENCES pdm.pdm_medical_incident (id) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
@@ -0,0 +1,20 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! MedicalData column in rec_dynamic_participant_data
-- PROJECT: Ahtc
-- DATE: 2022-03-25
-- VERSION: 2.07
-------------------------------------------------------------------------
-- GLOBAL: NONE;
BEGIN;
COMMIT;
-- EXERCISE: ALL;
BEGIN;
-- PPM
ALTER TABLE IF EXISTS rec_dynamic_participant_data ADD COLUMN IF NOT EXISTS medical_data jsonb;
COMMIT;
@@ -0,0 +1,82 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! Changes from PvSanDyn feature branch
-- PROJECT: Ahtc
-- DATE: 2022-03-25
-- VERSION: 2.08
-------------------------------------------------------------------------
-- GLOBAL: PDM;
BEGIN;
-- drop PKs
ALTER TABLE IF EXISTS pdm_sanitation_injury DROP CONSTRAINT IF EXISTS PK_pdm_sanitation_injury_id CASCADE;
ALTER TABLE IF EXISTS pdm_sanitation_injury_kind DROP CONSTRAINT IF EXISTS PK_pdm_sanitation_injury_kind_id CASCADE;
ALTER TABLE IF EXISTS pdm_sanitation_injury_place_1 DROP CONSTRAINT IF EXISTS PK_pdm_sanitation_injury_place_1_id CASCADE;
ALTER TABLE IF EXISTS pdm_sanitation_injury_place_2 DROP CONSTRAINT IF EXISTS PK_pdm_sanitation_injury_place_2_id CASCADE;
-- drop tables
DROP TABLE IF EXISTS pdm_sanitation_injury CASCADE;
DROP TABLE IF EXISTS pdm_sanitation_injury_kind CASCADE;
DROP TABLE IF EXISTS pdm_sanitation_injury_place_1 CASCADE;
DROP TABLE IF EXISTS pdm_sanitation_injury_place_2 CASCADE;
-- create tables
CREATE TABLE IF NOT EXISTS pdm_sanitation_injury (
id integer,
name text,
kind integer,
place_1 integer,
place_2 integer,
vbg integer
);
CREATE TABLE IF NOT EXISTS pdm_sanitation_injury_kind (
id integer,
name text,
version text
);
CREATE TABLE IF NOT EXISTS pdm_sanitation_injury_place_1 (
id integer,
name text,
version text
);
CREATE TABLE IF NOT EXISTS pdm_sanitation_injury_place_2 (
id integer,
name text,
version text
);
-- add PKs
ALTER TABLE IF EXISTS pdm_sanitation_injury ADD CONSTRAINT PK_pdm_sanitation_injury_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS pdm_sanitation_injury_kind ADD CONSTRAINT PK_pdm_sanitation_injury_kind_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS pdm_sanitation_injury_place_1 ADD CONSTRAINT PK_pdm_sanitation_injury_place_1_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS pdm_sanitation_injury_place_2 ADD CONSTRAINT PK_pdm_sanitation_injury_place_2_id PRIMARY KEY (id);
-- version in sanitation_material
ALTER TABLE IF EXISTS pdm_sanitation_material ADD COLUMN IF NOT EXISTS version text;
-- sanitation procedures
ALTER TABLE IF EXISTS pdm_sanitation_procedures DROP CONSTRAINT IF EXISTS PK_pdm_sanitation_procedures_id CASCADE;
DROP TABLE IF EXISTS pdm_sanitation_procedures CASCADE;
CREATE TABLE IF NOT EXISTS pdm_sanitation_procedures (
id integer,
name text,
type text,
type_id integer,
minimum_qualification integer,
long_name text,
data_code bigint,
version text
);
ALTER TABLE IF EXISTS pdm_sanitation_procedures ADD CONSTRAINT PK_pdm_sanitation_procedures_id PRIMARY KEY (id);
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;
@@ -0,0 +1,19 @@
-- $Id$
-- $HeadURL$
-- $Author$
-------------------------------------------------------------------------
-- INFO: NOT NECESSARY! New column can_ss_fir_san in whg.ausstg_typen
-- PROJECT: Ahtc
-- DATE: 2022-04-13
-- VERSION: 2.09
-------------------------------------------------------------------------
-- GLOBAL: WHG;
BEGIN;
ALTER TABLE IF EXISTS ausstg_typen ADD COLUMN IF NOT EXISTS can_ss_fir_san BOOLEAN DEFAULT false;
COMMIT;
-- EXERCISE: NONE;
BEGIN;
COMMIT;