Files
qt5-legatus-legacy/Lts/Tests/DatabaseInitialisation/guez_db_update.sql
T
2026-08-13 18:33:10 +02:00

2753 lines
202 KiB
PL/PgSQL
Executable File

-- # $Id$
-- # $HeadURL$
-- # $Author$
-- Database Guez update from 2019.01.17 until $Id:
-- PPM: added external_id (2019.03.21)
-- WHG: Added typen table
-- PPM: position reporting source in recording tables (2019.03.29)
-- FLM: folders double names deleted, remove deleted files, remove old xml files
-- OPM: settings deleted
-- ASM: typo workstation id 19
-- EXM: new column transferred
-- DB User ivg + stored procedure to create new users
-- AVM: TVC00
-- AVM Video receiver: host_name, is_locked, frequency
-- AES: Mine Area: is_center_line
-- WHG: ausstg_typ_id
-- PDM: remove 10046, 10047
-- PPM: add column hla_force_identifier in table ppm.ppm_party (18.06.2019)
-- AES in exercise: add column external_id in table ex_<n>.aes_entity (18.06.2019)
-- FLM: typo in rights (19.06.2019)
-- EXM: Set some exercises terminated (24.06.2019)
-- MSG: add column exercise_id (02.07.2019)
-- CES: rec_building_ownership (11.07.2019)
-- AVM: 5 mobile video teams (11.07.2019)
-- MRK: column file_content_id for snapshots (18.07.2019)
-- PRE: update sequence pre_presentation_content_id_seq (23.07.2019)
-- EXM: update start_time for exercises (24.07.2019)
-- MRK: column file_content_id for markers, Markers folder (24.07.2019)
-- AVM: menu_struct: drop foreigen_key-constraint to ism.main_structure_element (mounting_point_id) (26.07.2019)
-- AVM: avm_video_team: two new columns: program_id, time_offset (26.07.2019)
-- AVM/FLM: with REGG-4433 saved FrequencyPlannings in the library are not compatible anymore and must be removed
-- AES: air_support_impact, rec_air_support_impact tables + view (18.09.2019)
-- PDM: additional event types (25.09.19)
-- MRK: additional column movement_tracks in table snapshot (14.10.2019)
-- ASM: AssetType MobileAfterActionVehicle (26.11.2019)
-- PPM: equipment_exercise_mapping - add constraint
-- PPM: DynamicParticipantData - add column designator
-- GNA: add rec_nasat9_liner
-- TAB: add rec_laser_designation
-- MDM: fixup MDM operator rights mess after r49100
-- BLD: add hit_on_room_id to rec_building_hit_line_info/rec_building_state
-- AVM: set avm.avm_cnr_channel.channel to 0 (a channel != 0 means it's an addac channel), rename to addac_channel
-- EXM: add operator_id and wokrstation_id to exercise and exercise_state_change (20.02.20)
-- PDM: fix pdm_vulnerability_kind 21/4095
-- PDM: remove unused event types from pdm_event_type
-- AVM: fix HF frequencies to match the range needed by the radios
-- SMO: add new operator right for SPS/Nagios view
-- AVM: add new operator right AvVoiceCommunicationAccess
-- PPM: add injuryBuildingId and injuryRoomId to HitLineInfo
-- PDM: add '{"showHitline":false}' as property to charge type 62 (indirect transport)
-- PDM: add column predefined_name in table pdm_charge_type (17.03.20)
-- ASM: grants for new table asm.asm_technical_area (07.04.2020)
-- TGT: new tables in ex_NN (30.04.2020)
-- EVL: new tables san_nine_liner and san_category_line in ex_NN and rights (27.05.2020)
-- PPM, PDM, TAB: vitality (09.06.2020)
-- MSG: drop FK FK_msg_message_operator_data_msg_message_operator_data (SVN 31353 - needed for Base Download!)
-- PDM: pdm_sanitation_material (SVN 51383, 51362, 51358, 51357)
-- TGT: New columns in tgt_shootback_target for ex_NN (SVN 51371)
-- PPM: sanitation_material_stock column in dynamic data in ex_NN (SVN 51355)
-- SOM: New global schema and user for SoundManagement (SVN 51387)
-- ISM: new MountingPointType OutdoorControlUnit (SVN 51414)
-- REP: new tables for sanitation material in ex_NN (SVN 51332, 51380, 51419)
-- PDM: sanitation procedures and new originator types (SVN 51480, 51504)
-- REP: sanitation report (SVN 51607, 51677)
-- TGT: columns names, drop foreign keys (SVN 51604, 51622)
-- ASM: Add Mobile Besprechung Ausstattung (MobileAfterActionVehicle) 10.07.2020
-- PDM: new event type Sanitation (SVN 51633)
-- ASM: Workstation Bremen BR01-05 - 13.07.2020
-- PDM: Sanitation Procedures updated (SVN 51722)
-- REP: Treatment instead of Sanitation (SVN 51728)
-- PDM: Update destructive_factor not null (26.08.20)
-- PDM: missing charge_legacy_id (A-Wirkfeld, Nebel Klasse 8) (26.08.2020)
-- REP: Position added (28.08.20) (SVN 52033)
-- EXM: New table exercise image + saved images (16.09.2020)
-- EVL: Position in meter added (17.09.20)
-- REP: Added table rep_san_nine_liner (17.09.20)
-- PDM: Mine Corridor (SVN 52126 from MD)
-- ASM: certificate (SVN 52263, 28.10.2020)
-- OPM: Sanitation evaluation rights (29.10.2020)
-- PPM: PVSAN recording tables (2020.11.06)
-- REP: reports PVSAN (2020.11.11)
-- EXM: Unique key on exercise name (SVN 52447, 2020.11.11)
-- FOR MBA pg_dump/pg_restore (2020.11.12)
-- PDM: SanitationMaterial (2020.11.13)
-- REP: 2 new columns in rep_charge_administration (SVN 52483 - 2020.11.18)
-- HGR filter IED (only 48, 49, 68, 69, 70 are IEDs - 2020.11.20);
-- PDM charge types 35x -> 21x
-- PDM duplicate codes (106 = Minenkorridor, jetzt 315, 97 = 120 mm HE, jetzt 3)
-- PDM: missing records from pdm.pdm_gear_type_charge_type
-- PDM: Nebel charge type renames and recreate for Mrs (04.01.2021)
-- FLM: fix invalid folders in tree structure (which leads to improper deleting of exercise folders when deleting an exercise)
-- PDM: translations short_name -> shortName, fuze -> Fuze
-- REP: new unique key on rep_firings_data (if needed, not mandatory)
-- ISM: create view to save barcodes as csv (IO 2021.03.23)
-- PDM: update values in pdm_building_charge_effect (IO 2021.03.23) (Excel , CSV needed to be updated too!)
-- PDM: Newer Sanitation procedures 2021.05.18
-- PDM: update 1.02 for Guez (NLDEVCTRL-891)
-- PDM: New sanitation materials (IO, 2021.05.18)
-- PDM: update PDM Gear Type for Puma (2021.08.09) Update 1.19
-- PDM: Puma VBA changes (2021.08.26) Update 1.24
------------------------------------------------------------------------------------------------------------
-- Update DB procedure
DROP FUNCTION IF EXISTS create_user_if_not_exists(text);
DROP FUNCTION IF EXISTS create_user_if_not_exists(text, text);
CREATE OR REPLACE FUNCTION create_user_if_not_exists(rolename text, passw text default 'ets11de') RETURNS TEXT AS
$$
BEGIN
IF NOT EXISTS (SELECT * FROM pg_roles WHERE rolname = rolename) THEN
EXECUTE format('CREATE USER %s WITH PASSWORD ''%s''', rolename, passw);
EXECUTE format('GRANT ets_ro TO %s', rolename);
RETURN 'CREATE USER';
ELSE
RETURN format('USER ''%I'' ALREADY EXISTS', rolename);
END IF;
END;
$$
LANGUAGE plpgsql;
-- Create user ivg
SELECT * FROM create_user_if_not_exists('ivg','guez11de');
-- Create user for ex 14
SELECT * FROM create_user_if_not_exists('ets_ex_14');
-- ASM
INSERT INTO asm.asm_map_type (id, name) VALUES (4, 'Elevation');
INSERT INTO asm.asm_map_type (id, name) VALUES (5, 'SceneObjects');
CREATE TABLE IF NOT EXISTS asm.asm_map_description_type (
id integer DEFAULT nextval(( 'asm.asm_map_description_type_id_seq'::text)::regclass),
name text
);
ALTER TABLE asm.asm_map_description_type OWNER TO ets_asm;
GRANT SELECT,INSERT,UPDATE,DELETE ON asm.asm_map_description_type TO ets_asm;
CREATE SEQUENCE IF NOT EXISTS asm.asm_map_description_type_id_seq INCREMENT 1 START 1 MINVALUE 1;
GRANT SELECT, USAGE ON SEQUENCE asm.asm_map_description_type_id_seq TO ets_asm;
ALTER TABLE IF EXISTS asm.asm_map_description_type ADD CONSTRAINT PK_asm_map_description_type_id PRIMARY KEY (id);
INSERT INTO asm.asm_map_description_type (id, name) VALUES (1, 'Map2D');
INSERT INTO asm.asm_map_description_type (id, name) VALUES (2, 'Scene3D');
INSERT INTO asm.asm_map_description_type (id, name) VALUES (3, 'Elevation');
INSERT INTO asm.asm_map_description_type (id, name) VALUES (4, 'SceneObj');
DELETE FROM asm.asm_map_description;
ALTER TABLE asm.asm_map_description ADD COLUMN min_scale double precision DEFAULT -1;
ALTER TABLE asm.asm_map_description ADD COLUMN max_scale double precision DEFAULT -1;
ALTER TABLE asm.asm_map_description ADD COLUMN obj_order integer;
ALTER TABLE asm.asm_map_description ADD COLUMN map_description_type_id integer;
ALTER TABLE asm.asm_map_description ADD CONSTRAINT FK_asm_map_description_map_description_type_id_asm_map_descript FOREIGN KEY (map_description_type_id) REFERENCES asm.asm_map_description_type (id) ON DELETE CASCADE;
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (1, 'Guez Topographic', 'Guez Topographic', 2, 1, 1, 0, 'http://ecvmgeo02/arcgis/rest/services/Guez_Topo_32632/Guez_Topo_32632/MapServer', -1, 125);
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (2, 'Guez Arial', 'Guez Arial', 2, 1, 2, 1, 'http://ecvmgeo02/arcgis/rest/services/Guez_Aerial_32632/Guez_Aerial_32632/MapServer', -1, 125);
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (3, 'Guez Arial Salchau 2017', 'Guez Arial Salchau 2017', 2, 1, 1, 2, 'http://ecvmgeo02/arcgis/rest/services/Guez_HotSpots/Salchau_Aerial_0m20_2017_32632/MapServer', -1, 125);
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (4, 'Guez Arial Schnoeggersburg 2017', 'Guez Arial Schnoeggersburg 2017', 2, 1, 2, 3, 'http://ecvmgeo02/arcgis/rest/services/Guez_HotSpots/Schnoeggersburg_Aerial_0m20_2017_32632/MapServer', -1, 125);
-- 3D
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (5, 'Guez Topographic', 'Guez Topographic', 2, 2, 1, 0, 'http://ecvmgeo02/arcgis/rest/services/Guez_Topo_WebMerc/Guez_Topo_WebMerc/MapServer', -1, 125);
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (6, 'Guez Arial', 'Guez Arial', 2, 2, 2, 1, 'http://ecvmgeo02/arcgis/rest/services/Guez_Aerial_WebMerc/Guez_Aerial_WebMerc/MapServer', -1, 125);
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (7, 'Salchau Arial 2017', 'Salchau Arial 2017', 2, 2, 1, 2, 'http://ecvmgeo02/arcgis/rest/services/Guez_HotSpots/Salchau_Aerial_0m20_2017_WebMerc/MapServer', -1, 125);
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (8, 'Schnoeggersburg Arial 2017', 'Schnoeggersburg Arial 2017', 2, 2, 2, 3, 'http://ecvmgeo02/arcgis/rest/services/Guez_HotSpots/Schnoeggersburg_Aerial_0m20_2017_WebMerc/MapServer', -1, 125);
-- Elevation
INSERT INTO asm.asm_map_description (id, name, description, training_area_id, map_description_type_id, map_type_id, obj_order, url, min_scale, max_scale)
VALUES (9, 'Elevation', 'Elevation', 2, 3, 4, 0, 'file:Altmark_dt1.tif', -1, -1);
ALTER SEQUENCE asm.asm_map_description_id_seq RESTART WITH 10;
-- clean AVM
DELETE FROM avm.menu_struct;
-- FLM
ALTER TABLE flm.flm_folder ADD COLUMN parent_id bigint;
ALTER TABLE flm.flm_folder ADD COLUMN operator_id bigint DEFAULT 99;
ALTER TABLE flm.flm_folder ADD COLUMN last_modified bigint;
ALTER TABLE flm.flm_folder ADD CONSTRAINT FK_flm_folder_operator_id_opm_operator_id FOREIGN KEY (operator_id) REFERENCES opm.opm_operator (id) ON DELETE CASCADE;
-- clean FLM
DELETE FROM flm.flm_folder WHERE path='{9999}'; -- Kanzler
DELETE FROM flm.flm_folder WHERE id IN (117, 43, 132, 142); -- deleted exercises
DELETE FROM flm.flm_folder WHERE array_length(path, 1) > 1 AND path[2] IN (117, 43, 132, 142); -- subfolders for deleted exercises
DELETE FROM flm.flm_folder WHERE id IN (192, 210); -- double name and parent Oelker, Schroetter, no documents
-- update parent_id
UPDATE flm.flm_folder SET parent_id = 0 WHERE array_length(path, 1) = 1;
UPDATE flm.flm_folder SET parent_id = path[1] WHERE array_length(path, 1) = 2;
UPDATE flm.flm_folder SET parent_id = path[2] WHERE array_length(path, 1) = 3;
UPDATE flm.flm_folder SET parent_id = path[3] WHERE array_length(path, 1) = 4;
-- FLM: remove ALL deleted files
DELETE FROM flm.flm_file_content WHERE file_status_id = 1;
-- FLM: delete xml files without XmlType Property set (at least all TNE lists from SMO and Filters should be deleted!)
DELETE FROM flm.flm_file_content WHERE file_type_id = 2 AND properties = '{}';
-- OPM settings
DELETE FROM opm.opm_settings;
-- PPM
CREATE TABLE IF NOT EXISTS ppm.ppm_equipment_exercise_mapping (
id bigint DEFAULT nextval(( 'ppm.ppm_equipment_exercise_mapping_id_seq'::text)::regclass),
equipment_number integer,
participant_id integer,
exercise_id integer
);
ALTER TABLE ppm.ppm_equipment_exercise_mapping OWNER TO ets_ppm;
GRANT SELECT,INSERT,UPDATE,DELETE ON ppm.ppm_equipment_exercise_mapping TO ets_ppm;
CREATE SEQUENCE IF NOT EXISTS ppm.ppm_equipment_exercise_mapping_id_seq INCREMENT 1 START 1 MINVALUE 1;
GRANT SELECT, USAGE ON SEQUENCE ppm.ppm_equipment_exercise_mapping_id_seq TO ets_ppm;
ALTER TABLE IF EXISTS ppm.ppm_equipment_exercise_mapping ADD CONSTRAINT PK_ppm_equipment_exercise_mapping_id PRIMARY KEY (id);
-- external_id (2019.03.21)
ALTER TABLE ppm.ppm_participant ADD COLUMN external_id BIGINT;
ALTER TABLE ex_14.ppm_participant ADD COLUMN external_id BIGINT;
ALTER TABLE ex_14.rec_participant ADD COLUMN external_id BIGINT;
-- position reporting source in recording tables
ALTER TABLE ex_14.rec_participant_position ADD COLUMN position_reporting_source INTEGER DEFAULT 1;
ALTER TABLE ex_14.rec_equipment_position ADD COLUMN position_reporting_source INTEGER DEFAULT 1;
-- TAB (all tab.sql)
ALTER DEFAULT PRIVILEGES IN SCHEMA tab
GRANT SELECT,INSERT,UPDATE,DELETE ON TABLES TO ets_tab;
ALTER DEFAULT PRIVILEGES IN SCHEMA tab
GRANT SELECT, REFERENCES ON TABLES TO ets_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA tab
GRANT EXECUTE ON FUNCTIONS TO ets_tab;
ALTER DEFAULT PRIVILEGES IN SCHEMA tab
GRANT ALL ON SEQUENCES TO ets_tab;
SET SEARCH_PATH TO tab, PUBLIC;
-- Drop tables/views/sequences/constraints
ALTER TABLE IF EXISTS prtcnv_member DROP CONSTRAINT IF EXISTS PK_prtcnv_member_id CASCADE;
ALTER TABLE IF EXISTS prtcnv_status DROP CONSTRAINT IF EXISTS PK_prtcnv_status_id CASCADE;
ALTER TABLE IF EXISTS prtcnv_to_central DROP CONSTRAINT IF EXISTS PK_prtcnv_to_central_id CASCADE;
ALTER TABLE IF EXISTS prtcnv_to_radio DROP CONSTRAINT IF EXISTS PK_prtcnv_to_radio_id CASCADE;
DROP TABLE IF EXISTS prtcnv_member CASCADE;
DROP TABLE IF EXISTS prtcnv_status CASCADE;
DROP TABLE IF EXISTS prtcnv_to_central CASCADE;
DROP TABLE IF EXISTS prtcnv_to_radio CASCADE;
-- Create tables
CREATE TABLE IF NOT EXISTS prtcnv_member (
id integer DEFAULT nextval(( 'tab.prtcnv_member_id_seq'::text)::regclass),
issi integer,
licensed integer,
claims integer,
exercise_id integer -- The exercise id where the equipment is currently logged in (only useful for ex_0)
);
COMMENT ON COLUMN prtcnv_member.exercise_id IS 'The exercise id where the equipment is currently logged in (only useful for ex_0)';
COMMENT ON COLUMN prtcnv_member.exercise_id IS 'The exercise id where the equipment is currently logged in (only useful for ex_0)';
CREATE TABLE IF NOT EXISTS prtcnv_status (
id integer,
reset_counter integer,
ctas_operating_state integer,
machine_state integer
);
CREATE TABLE IF NOT EXISTS prtcnv_to_central (
id integer DEFAULT nextval(( 'tab.prtcnv_to_central_id_seq'::text)::regclass),
tel_id integer,
counter integer,
data bytea
);
CREATE TABLE IF NOT EXISTS prtcnv_to_radio (
id integer DEFAULT nextval(( 'tab.prtcnv_to_radio_id_seq'::text)::regclass),
tel_id integer,
counter integer,
broadcast_index integer,
reset_counter integer,
data bytea
);
-- Create sequence(s)
CREATE SEQUENCE IF NOT EXISTS prtcnv_member_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS prtcnv_to_central_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS prtcnv_to_radio_id_seq INCREMENT 1 START 1 MINVALUE 1;
-- Create primary keys
ALTER TABLE IF EXISTS prtcnv_member ADD CONSTRAINT PK_prtcnv_member_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS prtcnv_status ADD CONSTRAINT PK_prtcnv_status_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS prtcnv_to_central ADD CONSTRAINT PK_prtcnv_to_central_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS prtcnv_to_radio ADD CONSTRAINT PK_prtcnv_to_radio_id PRIMARY KEY (id);
-- EXERCISE Updates (ex_14):
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_14
GRANT SELECT,INSERT,UPDATE,DELETE ON TABLES TO ets_ex_14;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_14
GRANT SELECT, REFERENCES ON TABLES TO ets_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_14
GRANT EXECUTE ON FUNCTIONS TO ets_ex_14;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_14
GRANT ALL ON SEQUENCES TO ets_ex_14;
SET SEARCH_PATH TO ex_14, PUBLIC;
-- AES
CREATE TABLE IF NOT EXISTS aes_gas_pipe (
id integer DEFAULT nextval(( 'ex_14.aes_gas_pipe_id_seq'::text)::regclass),
entity_id integer,
operator_id bigint,
width double precision
);
ALTER TABLE aes_gas_pipe OWNER TO ets_exm;
CREATE SEQUENCE IF NOT EXISTS aes_gas_pipe_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS aes_gas_pipe ADD CONSTRAINT PK_aes_gas_pipe_id PRIMARY KEY (id);
ALTER TABLE aes_gas_pipe ADD CONSTRAINT FK_aes_gas_pipe_entity_id_aes_entity_id FOREIGN KEY (entity_id) REFERENCES aes_entity (id) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS aes_gas_pipe_segment (
id integer DEFAULT nextval(( 'ex_14.aes_gas_pipe_segment_id_seq'::text)::regclass),
gas_pipe_id integer,
position_index integer,
position_x double precision,
position_y double precision
);
ALTER TABLE aes_gas_pipe_segment OWNER TO ets_exm;
CREATE SEQUENCE IF NOT EXISTS aes_gas_pipe_segment_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS aes_gas_pipe_segment ADD CONSTRAINT PK_aes_gas_pipe_segment_id PRIMARY KEY (id);
ALTER TABLE aes_gas_pipe_segment ADD CONSTRAINT FK_aes_gas_pipe_segment_gas_pipe_id_aes_gas_pipe_id FOREIGN KEY (gas_pipe_id) REFERENCES aes_gas_pipe (id) ON DELETE CASCADE;
CREATE OR REPLACE VIEW aes_gas_pipe_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_gas_pipe.entity_id AS entity_id, aes_gas_pipe.operator_id AS operator_id, aes_gas_pipe.width AS width, aes_gas_pipe.id AS aes_gas_pipe_id
FROM aes_gas_pipe, aes_entity
WHERE aes_entity.id = aes_gas_pipe.entity_id;
ALTER VIEW aes_gas_pipe_view OWNER TO ets_exm;
CREATE TABLE IF NOT EXISTS rec_gas_pipe (
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,
segments jsonb,
width double precision,
rec_id bigint DEFAULT nextval(( 'ex_14.rec_gas_pipe_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_gas_pipe IS 'recorded data for topic GasPipe';
ALTER TABLE rec_gas_pipe OWNER TO ets_exm;
CREATE SEQUENCE IF NOT EXISTS rec_gas_pipe_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_gas_pipe ADD CONSTRAINT PK_rec_gas_pipe_rec_id PRIMARY KEY (rec_id);
-- CES
ALTER TABLE ces_simulated_movement ADD COLUMN start_time bigint;
ALTER TABLE ces_simulated_movement ADD COLUMN participant_id integer;
ALTER TABLE ces_simulated_movement DROP COLUMN delay;
ALTER TABLE ces_simulated_movement DROP COLUMN speed;
-- TAB
ALTER TABLE IF EXISTS prtcnv_member DROP CONSTRAINT IF EXISTS PK_prtcnv_member_id CASCADE;
ALTER TABLE IF EXISTS prtcnv_status DROP CONSTRAINT IF EXISTS PK_prtcnv_status_id CASCADE;
ALTER TABLE IF EXISTS prtcnv_to_central DROP CONSTRAINT IF EXISTS PK_prtcnv_to_central_id CASCADE;
ALTER TABLE IF EXISTS prtcnv_to_radio DROP CONSTRAINT IF EXISTS PK_prtcnv_to_radio_id CASCADE;
DROP TABLE IF EXISTS prtcnv_member CASCADE;
DROP TABLE IF EXISTS prtcnv_status CASCADE;
DROP TABLE IF EXISTS prtcnv_to_central CASCADE;
DROP TABLE IF EXISTS prtcnv_to_radio CASCADE;
CREATE TABLE IF NOT EXISTS prtcnv_member (
id integer DEFAULT nextval(( 'ex_14.prtcnv_member_id_seq'::text)::regclass),
issi integer,
licensed integer,
claims integer,
exercise_id integer -- The exercise id where the equipment is currently logged in (only useful for ex_0)
);
COMMENT ON COLUMN prtcnv_member.exercise_id IS 'The exercise id where the equipment is currently logged in (only useful for ex_0)';
COMMENT ON COLUMN prtcnv_member.exercise_id IS 'The exercise id where the equipment is currently logged in (only useful for ex_0)';
CREATE TABLE IF NOT EXISTS prtcnv_status (
id integer,
reset_counter integer,
ctas_operating_state integer,
machine_state integer
);
CREATE TABLE IF NOT EXISTS prtcnv_to_central (
id integer DEFAULT nextval(( 'ex_14.prtcnv_to_central_id_seq'::text)::regclass),
tel_id integer,
counter integer,
data bytea
);
CREATE TABLE IF NOT EXISTS prtcnv_to_radio (
id integer DEFAULT nextval(( 'ex_14.prtcnv_to_radio_id_seq'::text)::regclass),
tel_id integer,
counter integer,
broadcast_index integer,
reset_counter integer,
data bytea
);
CREATE SEQUENCE IF NOT EXISTS prtcnv_member_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS prtcnv_to_central_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS prtcnv_to_radio_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS prtcnv_member ADD CONSTRAINT PK_prtcnv_member_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS prtcnv_status ADD CONSTRAINT PK_prtcnv_status_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS prtcnv_to_central ADD CONSTRAINT PK_prtcnv_to_central_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS prtcnv_to_radio ADD CONSTRAINT PK_prtcnv_to_radio_id PRIMARY KEY (id);
-- WHG
DELETE FROM whg.uebungen;
DROP TRIGGER IF EXISTS trg_ai_notifyinsertparticipantassignment_14 ON whg.tln_zuordnung_14;
CREATE TABLE IF NOT EXISTS whg.typen (
id integer,
name text,
ausstg_typ_id integer
);
ALTER TABLE whg.typen OWNER TO ets_whg;
GRANT INSERT,UPDATE,DELETE,SELECT ON whg.typen TO ets_whg;
GRANT SELECT ON whg.typen TO ets_ro;
-- ASM: Fix typo for id 19
DELETE FROM asm.asm_asset WHERE id = 200;
UPDATE asm.asm_asset SET name = 'ECAWOWS38' WHERE id = 19;
-- EXM: New column transferred
ALTER TABLE exm.exercise ADD COLUMN transferred BOOLEAN DEFAULT false;
UPDATE exm.exercise SET transferred = true WHERE id = 14;
-- AVM: TVC00
UPDATE avm.avm_tvc_channel SET ssrc = ssrc + 1;
UPDATE avm.avm_tvc_channel SET port = port + 2;
INSERT INTO avm.avm_tvc_channel (id, name, ssrc, port)
VALUES(31, 'TVC00', 9000, 54320);
-- AVM Video receiver: host_name, is_locked, frequency
ALTER TABLE avm.avm_video_receiver ADD COLUMN host_name TEXT;
ALTER TABLE avm.avm_video_receiver ADD COLUMN is_locked BOOLEAN;
ALTER TABLE avm.avm_video_receiver ADD COLUMN frequency INTEGER;
-- Create user for ex 16, 17, 18, 19 - if needed
-- SELECT * FROM create_user_if_not_exists('ets_ex_16');
-- SELECT * FROM create_user_if_not_exists('ets_ex_17');
-- SELECT * FROM create_user_if_not_exists('ets_ex_18');
-- SELECT * FROM create_user_if_not_exists('ets_ex_19');
-- AES Mine Area
-- Exercise 14
SET SEARCH_PATH TO ex_14, public;
ALTER TABLE aes_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
ALTER TABLE rec_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
DROP VIEW aes_mine_area_view;
CREATE OR REPLACE VIEW aes_mine_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_mine.entity_id AS entity_id, aes_mine.is_laid_hidden AS is_laid_hidden, aes_mine.laying_procedure_type_id AS laying_procedure_type_id, aes_mine_area.mine_id AS mine_id, aes_mine_area.width AS width, aes_mine_area.density AS density, aes_mine_area.is_center_line AS is_center_line, aes_mine_area.id AS aes_mine_area_id
FROM aes_mine_area, aes_entity, aes_mine
WHERE aes_entity.id = aes_mine.entity_id AND
aes_mine.id = aes_mine_area.mine_id;
GRANT SELECT ON aes_mine_area_view TO ets_ex_14;
-- Exercise 16
SET SEARCH_PATH TO ex_16, public;
ALTER TABLE aes_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
ALTER TABLE rec_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
DROP VIEW aes_mine_area_view;
CREATE OR REPLACE VIEW aes_mine_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_mine.entity_id AS entity_id, aes_mine.is_laid_hidden AS is_laid_hidden, aes_mine.laying_procedure_type_id AS laying_procedure_type_id, aes_mine_area.mine_id AS mine_id, aes_mine_area.width AS width, aes_mine_area.density AS density, aes_mine_area.is_center_line AS is_center_line, aes_mine_area.id AS aes_mine_area_id
FROM aes_mine_area, aes_entity, aes_mine
WHERE aes_entity.id = aes_mine.entity_id AND
aes_mine.id = aes_mine_area.mine_id;
GRANT SELECT ON aes_mine_area_view TO ets_ex_16;
-- Exercise 17
SET SEARCH_PATH TO ex_17, public;
ALTER TABLE aes_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
ALTER TABLE rec_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
DROP VIEW aes_mine_area_view;
CREATE OR REPLACE VIEW aes_mine_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_mine.entity_id AS entity_id, aes_mine.is_laid_hidden AS is_laid_hidden, aes_mine.laying_procedure_type_id AS laying_procedure_type_id, aes_mine_area.mine_id AS mine_id, aes_mine_area.width AS width, aes_mine_area.density AS density, aes_mine_area.is_center_line AS is_center_line, aes_mine_area.id AS aes_mine_area_id
FROM aes_mine_area, aes_entity, aes_mine
WHERE aes_entity.id = aes_mine.entity_id AND
aes_mine.id = aes_mine_area.mine_id;
GRANT SELECT ON aes_mine_area_view TO ets_ex_17;
-- Exercise 18
SET SEARCH_PATH TO ex_18, public;
ALTER TABLE aes_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
ALTER TABLE rec_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
DROP VIEW aes_mine_area_view;
CREATE OR REPLACE VIEW aes_mine_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_mine.entity_id AS entity_id, aes_mine.is_laid_hidden AS is_laid_hidden, aes_mine.laying_procedure_type_id AS laying_procedure_type_id, aes_mine_area.mine_id AS mine_id, aes_mine_area.width AS width, aes_mine_area.density AS density, aes_mine_area.is_center_line AS is_center_line, aes_mine_area.id AS aes_mine_area_id
FROM aes_mine_area, aes_entity, aes_mine
WHERE aes_entity.id = aes_mine.entity_id AND
aes_mine.id = aes_mine_area.mine_id;
GRANT SELECT ON aes_mine_area_view TO ets_ex_18;
-- Exercise 19
SET SEARCH_PATH TO ex_19, public;
ALTER TABLE aes_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
ALTER TABLE rec_mine_area ADD COLUMN is_center_line BOOLEAN DEFAULT true;
DROP VIEW aes_mine_area_view;
CREATE OR REPLACE VIEW aes_mine_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_mine.entity_id AS entity_id, aes_mine.is_laid_hidden AS is_laid_hidden, aes_mine.laying_procedure_type_id AS laying_procedure_type_id, aes_mine_area.mine_id AS mine_id, aes_mine_area.width AS width, aes_mine_area.density AS density, aes_mine_area.is_center_line AS is_center_line, aes_mine_area.id AS aes_mine_area_id
FROM aes_mine_area, aes_entity, aes_mine
WHERE aes_entity.id = aes_mine.entity_id AND
aes_mine.id = aes_mine_area.mine_id;
GRANT SELECT ON aes_mine_area_view TO ets_ex_19;
-- WHG ausstg_typ_id
update whg.tln_14 set ausstg_typ_id = typ_id where ausstg_typ_id = 0;
update whg.tln_16 set ausstg_typ_id = typ_id where ausstg_typ_id = 0;
update whg.tln_17 set ausstg_typ_id = typ_id where ausstg_typ_id = 0;
update whg.tln_18 set ausstg_typ_id = typ_id where ausstg_typ_id = 0;
update whg.tln_19 set ausstg_typ_id = typ_id where ausstg_typ_id = 0;
-- PDM: remove 10046, 10047
delete from pdm.pdm_charge_type where id in (10046, 10047);
-- PPM: add column hla_force_identifier
ALTER TABLE ppm.ppm_party ADD hla_force_identifier integer;
UPDATE ppm.ppm_party SET hla_force_identifier = 2 WHERE id = 2;
UPDATE ppm.ppm_party SET hla_force_identifier = 1 WHERE id = 3;
UPDATE ppm.ppm_party SET hla_force_identifier = 3 WHERE id = 4;
UPDATE ppm.ppm_party SET hla_force_identifier = 0 WHERE id = 5;
UPDATE ppm.ppm_party SET hla_force_identifier = 6 WHERE id = 6;
UPDATE ppm.ppm_party SET hla_force_identifier = 9 WHERE id = 7;
UPDATE ppm.ppm_party SET hla_force_identifier = 12 WHERE id = 8;
UPDATE ppm.ppm_party SET hla_force_identifier = 15 WHERE id = 9;
UPDATE ppm.ppm_party SET hla_force_identifier = 18 WHERE id = 10;
UPDATE ppm.ppm_party SET hla_force_identifier = 4 WHERE id = 11;
UPDATE ppm.ppm_party SET hla_force_identifier = 7 WHERE id = 12;
UPDATE ppm.ppm_party SET hla_force_identifier = 10 WHERE id = 13;
-- AES in exercise: add column external_id in table ex_<n>.aes_entity
-- check exercise no!
-- ALTER TABLE ex_42.aes_entity ADD external_id bigint;
-- FLM typo in rights
UPDATE opm.opm_group SET name = 'File Library Organisation' WHERE id = 218169344;
-- EXM: Set some exercises terminated (24.06.2019)
UPDATE exm.exercise SET exercise_state_id = 6 WHERE id IN (14,16);
-- MSG: add column exercise_id (02.07.2019)
ALTER TABLE msg.msg_message_operator_data ADD exercise_id integer;
-- PDM: vba 21/4095 - empty string
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 1380451, 4, '');
-- ASM - fix FuSta Workstations
DELETE FROM asm.asm_asset WHERE id = 1;
DELETE FROM asm.asm_asset WHERE id >= 70 and id <= 80;
-- FuSta 2,3,4,5,6,7,8,9
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(72, 'ECF02KWS01', 1, 5),
(73, 'ECF03KWS01', 1, 5),
(74, 'ECF04KWS01', 1, 5),
(75, 'ECF05KWS01', 1, 5),
(76, 'ECF06KWS01', 1, 5),
(77, 'ECF07KWS01', 1, 5),
(78, 'ECF08KWS01', 1, 5),
(79, 'ECF09KWS01', 1, 5);
-- Wache
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES (81, 'ECWAOWS11', 1, 6);
-- Typo in pdm_vulnerability_kind
UPDATE pdm.pdm_vulnerability_kind SET name = 'Waffenkreisel defekt' WHERE ta_vulnerability_kind = 1376258;
-- CAN-Komponente AGDUS passiv (neu)
INSERT INTO pdm.pdm_can_component_string (name, bit_mask, can_device_id, sub_device_id) VALUES ('AGDUS passiv', 0, 17, -1);
-- CES: rec_building_ownership in ex_NN (NN to be replaced)
SET SEARCH_PATH TO ex_NN, public;
DROP TABLE IF EXISTS rec_building_ownership CASCADE;
CREATE TABLE IF NOT EXISTS rec_building_ownership (
building_id integer,
sample_time bigint,
ownerships jsonb,
rec_id bigint DEFAULT nextval(( 'ex_NN.rec_building_ownership_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_building_ownership IS 'recorded data for topic BuildingOwnership';
CREATE SEQUENCE IF NOT EXISTS rec_building_ownership_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE INDEX IDX_rec_building_ownership_sample_time ON rec_building_ownership (sample_time);
-- AVM: 5 mobile video teams (MVS01 is already in DB)
-- INSERT INTO avm.avm_video_team (id, name) VALUES (1, 'MVS01');
INSERT INTO avm.avm_video_team (id, name) VALUES (2, 'MVS02');
INSERT INTO avm.avm_video_team (id, name) VALUES (3, 'MVS03');
INSERT INTO avm.avm_video_team (id, name) VALUES (4, 'MVS04');
INSERT INTO avm.avm_video_team (id, name) VALUES (5, 'MVS05');
ALTER SEQUENCE avm.avm_video_team_id_seq RESTART WITH 6;
-- MRK: column file_content_id for snapshots (18.07.2019), Foreign key or null (24.07.2019)
SET SEARCH_PATH TO ex_NN, public;
ALTER TABLE mrk_snapshot ADD COLUMN file_content_id INTEGER;
-- PRE: update sequence pre_presentation_content_id_seq (23.07.2019)
-- get max id from ex_nn
SELECT max(id) FROM ex_nn.pre_presentation_content;
-- and use it in the following stmt
ALTER SEQUENCE ex_<nn>.pre_presentation_content_id_seq restart with <maxId>;
-- EXM: start time
update exm.exercise set start_time = 1546504609543 where id = 14;
update exm.exercise set start_time = 1554128603489 where id = 16;
update exm.exercise set start_time = 1556602602335 where id = 17;
update exm.exercise set start_time = 1558328525592 where id = 18;
update exm.exercise set start_time = 1560227691308 where id = 19;
update exm.exercise set start_time = 1561380204294 where id = 20;
update exm.exercise set start_time = 1561380204268 where id = 21;
-- MRK: column file_content_id for Markers and Markers folder
SET SEARCH_PATH TO ex_NN, public;
ALTER TABLE mrk_marker ADD COLUMN file_content_id INTEGER;
INSERT INTO pdm.pdm_translation (iso_code, context, key, disambiguation, translation)
values ( 'de_DE', 'Folder', 'Markers', 'name', 'Marken');
-- AVM: menu_struct: drop foreigen_key-constraint to ism.main_structure_element (mounting_point_id) (26.07.2019)
ALTER TABLE avm.menu_struct DROP CONSTRAINT fk_menu_struct_mounting_point_id_ism_structure_element_id;
-- AVM: avm_video_team: two new columns: program_id, time_offset (26.07.2019)
ALTER TABLE avm.avm_video_team ADD COLUMN program_id integer;
ALTER TABLE avm.avm_video_team ADD COLUMN time_offset integer;
UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404040, 1, 200) WHERE id = 1;
UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404041, 2, 200) WHERE id = 2;
UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404042, 3, 200) WHERE id = 3;
UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404043, 4, 200) WHERE id = 4;
UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404044, 5, 200) WHERE id = 5;
-- UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404045, 6, 200) WHERE id = 6;
-- UPDATE avm.avm_video_team SET (ssrc, port, program_id, time_offset) = (9872, 404046, 7, 200) WHERE id = 7;
-- Missing grants for recording table rec_building_ownership
ALTER TABLE ex_22.rec_building_ownership OWNER TO ets_exm;
GRANT ALL ON TABLE ex_22.rec_building_ownership TO ets_exm, ets_ex_22;
GRANT SELECT, REFERENCES ON TABLE ex_22.rec_building_ownership TO ets_ro;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA ex_22 TO ets_ex_22;
ALTER TABLE ex_23.rec_building_ownership OWNER TO ets_exm;
GRANT ALL ON TABLE ex_23.rec_building_ownership TO ets_exm, ets_ex_23;
GRANT SELECT, REFERENCES ON TABLE ex_23.rec_building_ownership TO ets_ro;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA ex_23 TO ets_ex_23;
ALTER TABLE ex_24.rec_building_ownership OWNER TO ets_exm;
GRANT ALL ON TABLE ex_24.rec_building_ownership TO ets_exm, ets_ex_24;
GRANT SELECT, REFERENCES ON TABLE ex_24.rec_building_ownership TO ets_ro;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA ex_24 TO ets_ex_24;
-- ASM workstations
UPDATE asm.asm_asset SET name = 'ECAWOWS23' WHERE id = 7;
-- DELETE FROM asm.asm_asset WHERE id IN (151, 152); -- double records but different location?? (FuSta - 73 ECF03KWS01, 74 ECF04KWS01)
UPDATE asm.asm_asset SET location_id = 7 WHERE id BETWEEN 101 AND 150;
-- Markers folders (when last id from flm_folder was 432)
-- Ex 22
INSERT INTO flm.flm_folder (id, name, path, is_editable, parent_id, operator_id)
VALUES (433, 'Markers', '{2, 396, 433}', false, 396, 99);
-- Ex 23
INSERT INTO flm.flm_folder (id, name, path, is_editable, parent_id, operator_id)
VALUES (434, 'Markers', '{2, 406, 434}', false, 406, 99);
-- Ex 24
INSERT INTO flm.flm_folder (id, name, path, is_editable, parent_id, operator_id)
VALUES (435, 'Markers', '{2, 416, 435}', false, 416, 99);
ALTER SEQUENCE flm.flm_folder_id_seq RESTART WITH 436;
-- Add new column exercise.has_hla_interface
ALTER TABLE exm.exercise ADD has_hla_interface boolean DEFAULT false;
--WHG
DELETE FROM whg.vb_agdus WHERE id = 1;
-- accidentally create without a proper schema
SET SEARCH_PATH TO public;
DROP TABLE tne_sn_zuordnung;
DROP SEQUENCE ausstg_konfig_id_seq;
DROP SEQUENCE tne_sn_zuordnung_id_seq;
-- AVM/FLM: with REGG-4433 saved FrequencyPlannings in the library are not compatible anymore and must be removed
DELETE FROM flm.flm_file_content WHERE file_type_id = 2 AND (convert_from(content, 'UTF8')::jsonb->'XmlType')::text = '"AVMEditFrequencyPlanning"';
-- Set DIS entities for participant types
-- SELECT * FROM ppm.ppm_type WHERE type_class_id != 2 AND type_class_id != 9 AND (is_deleted = false OR is_deleted IS NULL) ORDER BY id;
UPDATE ppm.ppm_type SET dis_entities = '{1001078015002000000}' WHERE id = 3;
UPDATE ppm.ppm_type SET dis_entities = '{1001078010001000000}' WHERE id = 5;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003009001000}' WHERE id = 6;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003001000000}' WHERE id = 7;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001001005000}' WHERE id = 19;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007001000000}' WHERE id = 21;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007004000000}' WHERE id = 22;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007002000000}' WHERE id = 23;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007005003000}' WHERE id = 24;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007005004000}' WHERE id = 25;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007001000000}' WHERE id = 26;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007002000000}' WHERE id = 27;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007003000000}' WHERE id = 28;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007005004000}' WHERE id = 29;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007005004000}' WHERE id = 30;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007005004000}' WHERE id = 31;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007005003000}' WHERE id = 32;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003003000000}' WHERE id = 33;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003004000000}' WHERE id = 34;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003002000000}' WHERE id = 37;
UPDATE ppm.ppm_type SET dis_entities = '{3001000002001000000}' WHERE id = 53;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 54;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 55;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007003003000}' WHERE id = 56;
UPDATE ppm.ppm_type SET dis_entities = '{1001078002001003000}' WHERE id = 57;
UPDATE ppm.ppm_type SET dis_entities = '{1001078002001000000}' WHERE id = 58;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 59;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 60;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 61;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003008001000}' WHERE id = 62;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 66;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 69;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 70;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 71;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 72;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 74;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 75;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 76;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001002004000}' WHERE id = 77;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001002005000}' WHERE id = 78;
UPDATE ppm.ppm_type SET dis_entities = '{1001078004001000000}' WHERE id = 79;
UPDATE ppm.ppm_type SET dis_entities = '{1001078004002000000}' WHERE id = 80;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001001006000}' WHERE id = 81;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001001000000}' WHERE id = 82;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 83;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007001000000}' WHERE id = 84;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 85;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 86;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 88;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 89;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 90;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 91;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 92;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id = 93;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id = 94;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007010001000}' WHERE id = 95;
UPDATE ppm.ppm_type SET dis_entities = '{1001078093000000000}' WHERE id = 96;
UPDATE ppm.ppm_type SET dis_entities = '{1001078093000000000}' WHERE id = 97;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id = 98;
UPDATE ppm.ppm_type SET dis_entities = '{1001198002003004098}' WHERE id =112;
UPDATE ppm.ppm_type SET dis_entities = '{1002078029001002000}' WHERE id =121;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001002006000}' WHERE id =123;
UPDATE ppm.ppm_type SET dis_entities = '{1001078028003003000}' WHERE id =124;
UPDATE ppm.ppm_type SET dis_entities = '{1001078002013001000}' WHERE id =125;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007003000000}' WHERE id =127;
UPDATE ppm.ppm_type SET dis_entities = '{1002078002002000000}' WHERE id =130;
UPDATE ppm.ppm_type SET dis_entities = '{1002078005000000000}' WHERE id =132;
UPDATE ppm.ppm_type SET dis_entities = '{1001078010001000000}' WHERE id =134;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003007000000}' WHERE id =135;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id =138;
UPDATE ppm.ppm_type SET dis_entities = '{1001078006001000000}' WHERE id =139;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003014000000}' WHERE id =140;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003006000000}' WHERE id =141;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001002005000}' WHERE id =142;
UPDATE ppm.ppm_type SET dis_entities = '{1001078001002007000}' WHERE id =143;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003008000000}' WHERE id =144;
UPDATE ppm.ppm_type SET dis_entities = '{1001078006000000000}' WHERE id =145;
UPDATE ppm.ppm_type SET dis_entities = '{1001078007006000000}' WHERE id =146;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003008002000}' WHERE id =147;
UPDATE ppm.ppm_type SET dis_entities = '{1001078002013002000}' WHERE id =150;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001011000000}' WHERE id =156;
UPDATE ppm.ppm_type SET dis_entities = '{1001078002010001000}' WHERE id =157;
UPDATE ppm.ppm_type SET dis_entities = '{1001078002010002000}' WHERE id =158;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003012000000}' WHERE id =159;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003011000000}' WHERE id =160;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003000000000}' WHERE id =161;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003000000000}' WHERE id =163;
UPDATE ppm.ppm_type SET dis_entities = '{1001078003010000000}' WHERE id =164;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id =165;
UPDATE ppm.ppm_type SET dis_entities = '{3001000003000000000}' WHERE id =166;
UPDATE ppm.ppm_type SET dis_entities = '{1001078081000000000}' WHERE id =167;
UPDATE ppm.ppm_type SET dis_entities = '{3001000001000000000}' WHERE id =169;
-- update pdm_charge_type.dis_entity;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.111.0.0.0.0' WHERE id = 5001;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.112.0.0.0.0' WHERE id = 5002;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.113.0.0.0.0' WHERE id = 5003;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.203.0.0.0.0' WHERE id = 5004;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.202.1.0.0.0' WHERE id = 5005;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.202.2.0.0.0' WHERE id = 5006;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.1.0.0.0' WHERE id = 7001;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.2.0.0.0' WHERE id = 7002;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.3.0.0.0' WHERE id = 7003;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.4.0.0.0' WHERE id = 7004;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.5.0.0.0' WHERE id = 7005;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.6.0.0.0' WHERE id = 8001;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.201.7.0.0.0' WHERE id = 8002;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.1.0.0.0.0' WHERE id = 10001;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.2.0.0.0.0' WHERE id = 10002;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.3.0.0.0.0' WHERE id = 10003;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.4.0.0.0.0' WHERE id = 10004;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.5.0.0.0.0' WHERE id = 10005;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.6.0.0.0.0' WHERE id = 10006;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.7.0.0.0.0' WHERE id = 10007;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.8.0.0.0.0' WHERE id = 10008;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.9.0.0.0.0' WHERE id = 10009;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.10.0.0.0.0' WHERE id = 10010;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.11.0.0.0.0' WHERE id = 10011;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.12.0.0.0.0' WHERE id = 10012;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.13.0.0.0.0' WHERE id = 10013;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.14.0.0.0.0' WHERE id = 10014;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.15.0.0.0.0' WHERE id = 10015;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.16.0.0.0.0' WHERE id = 10016;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.17.0.0.0.0' WHERE id = 10017;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.18.0.0.0.0' WHERE id = 10018;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.19.0.0.0.0' WHERE id = 10019;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.20.0.0.0.0' WHERE id = 10020;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.21.0.0.0.0' WHERE id = 10021;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.22.0.0.0.0' WHERE id = 10022;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.23.0.0.0.0' WHERE id = 10023;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.24.0.0.0.0' WHERE id = 10024;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.25.0.0.0.0' WHERE id = 10025;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.26.0.0.0.0' WHERE id = 10026;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.27.0.0.0.0' WHERE id = 10027;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.28.0.0.0.0' WHERE id = 10028;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.29.0.0.0.0' WHERE id = 10029;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.30.0.0.0.0' WHERE id = 10030;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.31.0.0.0.0' WHERE id = 10031;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.32.0.0.0.0' WHERE id = 10032;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.33.0.0.0.0' WHERE id = 10033;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.34.0.0.0.0' WHERE id = 10034;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.35.0.0.0.0' WHERE id = 10035;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.36.0.0.0.0' WHERE id = 10036;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.37.0.0.0.0' WHERE id = 10037;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.38.0.0.0.0' WHERE id = 10038;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.39.0.0.0.0' WHERE id = 10039;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.40.0.0.0.0' WHERE id = 10040;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.41.0.0.0.0' WHERE id = 10041;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.42.0.0.0.0' WHERE id = 10042;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.43.0.0.0.0' WHERE id = 10043;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.44.0.0.0.0' WHERE id = 10044;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.45.0.0.0.0' WHERE id = 10045;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.48.0.0.0.0' WHERE id = 10048;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.49.0.0.0.0' WHERE id = 10049;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.50.0.0.0.0' WHERE id = 10050;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.51.0.0.0.0' WHERE id = 10051;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.52.0.0.0.0' WHERE id = 10052;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.53.0.0.0.0' WHERE id = 10053;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.54.0.0.0.0' WHERE id = 10054;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.55.0.0.0.0' WHERE id = 10055;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.56.0.0.0.0' WHERE id = 10056;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.57.0.0.0.0' WHERE id = 10057;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.58.0.0.0.0' WHERE id = 10058;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.59.0.0.0.0' WHERE id = 10059;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.60.0.0.0.0' WHERE id = 10060;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.61.0.0.0.0' WHERE id = 10061;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.62.0.0.0.0' WHERE id = 10062;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.63.0.0.0.0' WHERE id = 10063;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.64.0.0.0.0' WHERE id = 10064;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.65.0.0.0.0' WHERE id = 10065;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.66.0.0.0.0' WHERE id = 10066;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.67.0.0.0.0' WHERE id = 10067;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.68.0.0.0.0' WHERE id = 10068;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.69.0.0.0.0' WHERE id = 10069;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.70.0.0.0.0' WHERE id = 10070;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.71.0.0.0.0' WHERE id = 10071;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.72.0.0.0.0' WHERE id = 10072;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.73.0.0.0.0' WHERE id = 10073;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.74.0.0.0.0' WHERE id = 10074;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.75.0.0.0.0' WHERE id = 10075;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.76.0.0.0.0' WHERE id = 10076;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.77.0.0.0.0' WHERE id = 10077;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.78.0.0.0.0' WHERE id = 10078;
UPDATE pdm.pdm_charge_type SET dis_entity = '2.127.79.0.0.0.0' WHERE id = 10079;
-- add fk/index on ppm.participant_exercise_mapping
-- TODO: remove equipment exercise mappings from stopped exercises
SET SEARCH_PATH TO ppm, PUBLIC;
ALTER TABLE ppm_equipment_exercise_mapping ADD CONSTRAINT FK_ppm_equipment_exercise_mapping_exercise_id_exercise_id FOREIGN KEY (exercise_id) REFERENCES exm.exercise (id) ON DELETE CASCADE;
CREATE INDEX IDX_ppm_equipment_exercise_mapping_exercise_id ON ppm_equipment_exercise_mapping (exercise_id);
-- rec_air_support_impact in ex_22
SET SEARCH_PATH to ex_22, public;
CREATE TABLE IF NOT EXISTS aes_air_support_impact (
id integer DEFAULT nextval(( 'ex_42.aes_air_support_impact_id_seq'::text)::regclass),
entity_id integer,
impact_position_x double precision,
impact_position_y double precision,
flight_time integer
);
CREATE SEQUENCE IF NOT EXISTS aes_air_support_impact_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS aes_air_support_impact ADD CONSTRAINT PK_aes_air_support_impact_id PRIMARY KEY (id);
ALTER TABLE aes_air_support_impact ADD CONSTRAINT FK_aes_air_support_impact_entity_id_aes_entity_id FOREIGN KEY (entity_id) REFERENCES aes_entity (id) ON DELETE CASCADE;
ALTER TABLE ex_22.aes_air_support_impact OWNER TO ets_exm;
GRANT ALL ON TABLE ex_22.aes_air_support_impact TO ets_exm, ets_ex_22;
GRANT SELECT, REFERENCES ON TABLE ex_22.aes_air_support_impact TO ets_ro;
CREATE TABLE IF NOT EXISTS rec_air_support_impact (
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,
flight_time integer,
rec_id bigint DEFAULT nextval(( 'ex_42.rec_air_support_impact_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_air_support_impact IS 'recorded data for topic AirSupportImpact';
CREATE SEQUENCE IF NOT EXISTS rec_air_support_impact_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_air_support_impact ADD CONSTRAINT PK_rec_air_support_impact_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_air_support_impact_sample_time ON rec_air_support_impact (sample_time);
ALTER TABLE ex_22.rec_air_support_impact OWNER TO ets_exm;
GRANT ALL ON TABLE ex_22.rec_air_support_impact TO ets_exm, ets_ex_22;
GRANT SELECT, REFERENCES ON TABLE ex_22.rec_air_support_impact TO ets_ro;
CREATE OR REPLACE VIEW aes_air_support_impact_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_air_support_impact.entity_id AS entity_id, aes_air_support_impact.impact_position_x AS impact_position_x, aes_air_support_impact.impact_position_y AS impact_position_y, aes_air_support_impact.flight_time AS flight_time, aes_air_support_impact.id AS aes_air_support_impact_id
FROM aes_air_support_impact, aes_entity
WHERE aes_entity.id = aes_air_support_impact.entity_id;
ALTER VIEW aes_air_support_impact_view OWNER TO ets_exm;
GRANT SELECT ON aes_air_support_impact_view TO ets_ex_22, ets_ro;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA ex_22 TO ets_ex_22;
-- additional event types (25.09.19)
INSERT INTO pdm.pdm_event_type (id, name) VALUES (30, 'MineArea');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (31, 'NContamination');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (32, 'BCContamination');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (33, 'DangerArea');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (34, 'FunctionalArea');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (35, 'MineCorridor');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (36, 'Borderline');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (37, 'TechnicalArea');
INSERT INTO pdm.pdm_event_type (id, name) VALUES (38, 'GasPipe');
--
-- MRK: additional column movement_tracks in table snapshot (14.10.2019)
SET SEARCH_PATH to ex_22, public;
ALTER TABLE mrk_snapshot ADD movement_tracks text;
-- 2019.10.23 - updates to import assets from excel file
UPDATE ism.ism_asset SET barcode=null WHERE barcode='';
UPDATE ism.ism_asset SET hostname=null WHERE hostname='';
ALTER TABLE ism.ism_asset ADD CONSTRAINT ism_unique_barcode UNIQUE (barcode);
DELETE FROM ism.ism_asset WHERE mounting_point_type_id IN (1,2,3,4) AND barcode IS null;
DELETE FROM ism.ism_asset WHERE mounting_point_type_id IN (1,2,3,4) AND barcode IS NOT null AND hostname IS null;
-- after importing guez_ism_values_ruag.sql
UPDATE ism.ism_asset SET asset_state_id = 0 WHERE asset_state_id IS null;
-- Guez DB 13.11.2019 update
ALTER TABLE ex_28.mrk_snapshot ADD movement_tracks text;
ALTER TABLE ex_30.mrk_snapshot ADD movement_tracks text;
ALTER TABLE ex_31.mrk_snapshot ADD movement_tracks text;
ALTER TABLE ex_32.mrk_snapshot ADD movement_tracks text;
-- Air Support (PDM) 2019.11.18
DELETE FROM pdm.pdm_gear_class WHERE id = 13;
INSERT INTO pdm.pdm_gear_class (id, name) VALUES (16, 'GasPipe');
INSERT INTO pdm.pdm_gear_class (id, name) VALUES (17, 'AirSupport');
ALTER SEQUENCE pdm.pdm_gear_class_id_seq RESTART WITH 18;
INSERT INTO pdm.pdm_gear_type (id, tas_code, name, gear_class_id) VALUES (1701, NULL, 'Luftunterstützung', 17);
DELETE FROM pdm.pdm_charge_type WHERE id BETWEEN 13000 AND 13999;
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17001, 201, 20, 'Bordkanone', 'BK', '{"nasatId":1, "impactRadius":3}', '2.254.17.1');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17002, 201, 21, 'Rakete AGM 114', 'AGM 114', '{"nasatId":2, "impactRadius":60}', '2.254.17.2');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17003, 201, 21, 'Rakete AGM 65', 'AGM 65', '{"nasatId":3, "impactRadius":60}', '2.254.17.3');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17004, 201, 21, 'Rakete MK 151', 'MK 151', '{"nasatId":4, "impactRadius":60}', '2.254.17.4');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17005, 201, 21, 'Rakete MK 24', 'MK 24', '{"nasatId":5, "impactRadius":60}', '2.254.17.5');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17006, 201, 22, 'Bombe MK 82LD', 'MK 82LD', '{"nasatId":6, "impactRadius":125}', '2.254.17.6');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17007, 201, 22, 'Bombe MK 83LD', 'MK 83LD', '{"nasatId":7, "impactRadius":125}', '2.254.17.7');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17008, 201, 22, 'Bombe MK 84LD', 'MK 84LD', '{"nasatId":8, "impactRadius":125}', '2.254.17.8');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17009, 201, 22, 'Bombe MK 82HD', 'MK 82HD', '{"nasatId":9, "impactRadius":125}', '2.254.17.9');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17010, 201, 22, 'Bombe MK 83HD', 'MK 83HD', '{"nasatId":10, "impactRadius":125}', '2.254.17.10');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17011, 201, 22, 'Bombe MK 84HD', 'MK 84HD', '{"nasatId":11, "impactRadius":125}', '2.254.17.11');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17012, 201, 23, 'PGM 500 lb', 'PGM 500 lb', '{"nasatId":12, "impactRadius":40}', '2.254.17.12');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17013, 201, 23, 'PGM 1000 lb', 'PGM 1000 lb', '{"nasatId":13, "impactRadius":40}', '2.254.17.13');
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (17014, 201, 23, 'PGM 2000 lb', 'PGM 2000 lb', '{"nasatId":14, "impactRadius":40}', '2.254.17.14');
ALTER SEQUENCE pdm.pdm_charge_type_id_seq RESTART WITH 20001;
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17001, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17002, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17003, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17004, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17005, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17006, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17007, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17008, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17009, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17010, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17011, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17012, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17013, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (1701, 17014, NULL);
UPDATE pdm.pdm_translation SET key = 'Air Support' where key = 'Aerial Ordnance';
UPDATE pdm.pdm_translation SET translation = 'Air Support' where translation = 'Aerial Ordnance';
-- rights for Air Support
UPDATE opm.opm_group SET name = 'Air Support' WHERE name = 'Aerial Ordnance';
UPDATE opm.opm_group SET name = 'AirSupportEdit' WHERE name = 'AerialOrdnanceEdit';
UPDATE opm.opm_group SET name = 'AirSupportShow' WHERE name = 'AerialOrdnanceShow';
UPDATE opm.opm_access_control_level SET name = 'AirSupportEdit', description = 'Edit Air Support Entries' WHERE name = 'AerialOrdnanceEdit';
UPDATE opm.opm_access_control_level SET name = 'AirSupportShow', description = 'Show Air Support Entries' WHERE name = 'AerialOrdnanceShow';
DELETE FROM ex_28.aes_charge_administration WHERE charge_type_id BETWEEN 13000 AND 13999;
DELETE FROM ex_30.aes_charge_administration WHERE charge_type_id BETWEEN 13000 AND 13999;
DELETE FROM ex_31.aes_charge_administration WHERE charge_type_id BETWEEN 13000 AND 13999;
DELETE FROM ex_32.aes_charge_administration WHERE charge_type_id BETWEEN 13000 AND 13999;
-- AssetType MobileAfterActionVehicle
INSERT INTO asm.asm_asset_type (id, name) VALUES (5, 'MobileAfterActionVehicle');
UPDATE asm.asm_asset SET asset_type_id = 5 WHERE name = 'ECRF1KWS01';
UPDATE asm.asm_asset SET asset_type_id = 5 WHERE name = 'ECRF2KWS01';
-- PPM equipment_exercise_mapping - add constraint
ALTER TABLE ppm.ppm_equipment_exercise_mapping ADD CONSTRAINT UQ_ppm_equipment_exercise_mapping_equipment_number_exercise_id UNIQUE (equipment_number, exercise_id);
ALTER TABLE ppm.ppm_equipment_exercise_mapping DROP CONSTRAINT uq_ppm_equipment_exercise_mapping_equipment_number;
-- DynamicParticipantData - add column designator
ALTER TABLE ex_NN.rec_dynamic_participant_data ADD COLUMN designation jsonb;
-- Recording table for Nasat 9-liner
SET SEARCH_PATH TO ex_NN, PUBLIC;
CREATE TABLE IF NOT EXISTS rec_nasat9_liner (
id integer,
name text,
is_deleted boolean,
is_used boolean,
sample_time bigint,
participant_id integer,
initial_point_lon double precision,
initial_point_lat double precision,
hdg_initial_point2_target integer,
hdg2_initial_point_mode integer,
distance_initial_point2_target double precision,
target_position_lon double precision,
target_position_lat double precision,
target_position_z double precision,
friendlies_bearing integer,
friendlies_distance double precision,
final_attack_heading integer,
final_attack_heading_low integer,
final_attack_heading_high integer,
time_for_target integer,
is_current boolean,
rec_id bigint DEFAULT nextval(( 'rec_nasat9_liner_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_nasat9_liner IS 'recorded data for topic Nasat9Liner';
CREATE SEQUENCE IF NOT EXISTS rec_nasat9_liner_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_nasat9_liner ADD CONSTRAINT PK_rec_nasat9_liner_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_nasat9_liner_sample_time ON rec_nasat9_liner (sample_time);
-- Recording table for TAB Laser Designation
SET SEARCH_PATH TO ex_NN, PUBLIC;
CREATE TABLE IF NOT EXISTS rec_laser_designation (
equipment_number integer,
sample_time bigint,
code integer,
output_power double precision,
spot_location_lon double precision,
spot_location_lat double precision,
rec_id bigint DEFAULT nextval(( 'ex_NN.rec_laser_designation_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_laser_designation IS 'recorded data for topic LaserDesignation';
CREATE SEQUENCE IF NOT EXISTS rec_laser_designation_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_laser_designation ADD CONSTRAINT PK_rec_laser_designation_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_laser_designation_sample_time ON rec_laser_designation (sample_time);
GRANT ALL ON TABLE ex_NN.rec_laser_designation TO ets_exm, ets_ex_NN;
GRANT SELECT, REFERENCES ON TABLE ex_NN.rec_laser_designation TO ets_ro;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA ex_NN TO ets_ex_NN;
-- fixup MDM operator rights mess after r49100
BEGIN;
--- Meteo Data Management - Static Weather Data - 0x16020000 = 369229824
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (369229824, 'Meteo Data Management - Static Weather Data', 'Edit static weather', 4, false);
--- Meteo Data Management - Weather Stations - 0x16010000 = 369164288
UPDATE opm.opm_group SET name = 'Meteo Data Management - Weather Stations', description = 'Show Weather Stations' WHERE id = 369164288;
--- Base: 369229824, MeteoDataStaticWeatherEdit - 369229825 = 0x16020001
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (369229825, 'MeteoDataStaticWeatherEdit', 'Edit Meteorological Data');
UPDATE opm.opm_group SET name = 'MeteoDataStaticWeatherEdit', description = 'Edit Meteorological Data' WHERE id = 369098752;
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (369098752, 369229825); -- group_id is: 369098752 = 0x16000000
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (369229824, 369098752); -- Meteo Data Management - Static Weather Data
--- Base: 369229824, MeteoDataStaticWeatherShow - 369229826 = 0x16020002
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (369229826, 'MeteoDataStaticWeatherShow', 'Show Meteorological Data');
UPDATE opm.opm_group SET name = 'MeteoDataStaticWeatherShow', description = 'Show Meteorological Data' WHERE id = 369098753;
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (369098753, 369229826); -- group_id is: 369098753 = 0x16000001
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (369229824, 369098753); -- Meteo Data Management - Static Weather Data
--- Base: 369164288, MeteoDataWeatherStationsShow - 369164290 = 0x16010002
UPDATE opm.opm_access_control_level SET name = 'MeteoDataWeatherStationsShow', description = 'Show Meteorological Data' WHERE id = 369164290;
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (369098754, 'MeteoDataWeatherStationsShow', 'Show Meteorological Data', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (369098754, 369164290); -- group_id is: 369098754 = 0x16000002
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (369164288, 369098754); -- Meteo Data Management - Weather Stations
-- remove old
DELETE FROM opm.opm_access_control_level WHERE id = 369164289;
DELETE FROM opm.opm_acl_allow WHERE group_id = 369098753 AND acl_id = 369164290;
DELETE FROM opm.opm_group_group WHERE group_id = 369164288 AND is_member_of_group_id = 369098752;
DELETE FROM opm.opm_group_group WHERE group_id = 369164288 AND is_member_of_group_id = 369098753;
COMMIT;
-- BLD: add hit_on_room_id to rec_building_hit_line_info/rec_building_state
ALTER TABLE ex_NN.rec_building_hit_line_info ADD COLUMN hit_on_room_id integer;
ALTER TABLE ex_NN.rec_building_state ADD COLUMN hit_on_room_id integer;
-- AVM: set avm.avm_cnr_channel.channel to 0 (a channel != 0 means it's an addac channel)
UPDATE avm.avm_cnr_channel SET channel = 0;
ALTER TABLE avm.avm_cnr_channel RENAME channel TO addac_channel;
-- EXM: add operator_id and wokrstation_id to exercise and exercise_state_change (20.02.20)
ALTER TABLE exm.exercise ADD operator_id integer;
ALTER TABLE exm.exercise ADD workstation_id integer;
ALTER TABLE exm.exercise_state_change ADD operator_id integer;
ALTER TABLE exm.exercise_state_change ADD workstation_id integer;
-- ASM: new table for technical areas (20.02.2020)
SET SEARCH_PATH TO asm, PUBLIC;
CREATE TABLE IF NOT EXISTS asm_technical_area (
id integer DEFAULT nextval(( 'asm.asm_technical_area_id_seq'::text)::regclass),
name text,
training_area_id integer,
position_x double precision,
position_y double precision,
width integer,
length integer,
charge_type_id integer
);
CREATE SEQUENCE IF NOT EXISTS asm_technical_area_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS asm_technical_area ADD CONSTRAINT PK_asm_technical_area_id PRIMARY KEY (id);
ALTER TABLE asm_technical_area ADD CONSTRAINT FK_asm_technical_area_training_area_id_asm_training_area_id FOREIGN KEY (training_area_id) REFERENCES asm_training_area (id) ON DELETE CASCADE;
-- ASM: grants for new table asm.asm_technical_area
ALTER TABLE asm_technical_area OWNER TO ets_asm;
GRANT SELECT,INSERT,UPDATE,DELETE ON asm_technical_area TO ets_asm;
GRANT SELECT, USAGE ON SEQUENCE asm_technical_area_id_seq TO ets_asm;
-- PDM: fix pdm_vulnerability_kind 21/4095
UPDATE pdm.pdm_vulnerability_kind SET ta_vulnerability_kind = 1380351 WHERE ta_vulnerability_kind = 1380451;
-- PDM: remove unused event types from pdm_event_type
DELETE FROM pdm.pdm_event_type WHERE id IN (7, 11, 12);
-- AVM: fix HF frequencies to match the range needed by the radios
UPDATE avm.avm_frequency_set_data SET frequency = 59150 WHERE function = 'AufklKrs HF 1';
UPDATE avm.avm_frequency_set_data SET frequency = 110900 WHERE function = 'AufklKrs HF 2';
DELETE FROM avm.avm_frequency_set_data WHERE function = 'AufklKrs HF 3';
DELETE FROM avm.avm_frequency_set_data WHERE function = 'AufklKrs HF 4';
-- SMO: add new operator right for SPS/Nagios view
BEGIN;
UPDATE opm.opm_group SET name = 'Service Monitors - Participants' WHERE id = 738263040;
UPDATE opm.opm_group SET description = 'Service Monitors for Participants (BITE/Manipulation/CTAS Error Monitor, Equipment Check, Equipment Error Registration, Handgrenade and Mine Search)' WHERE id = 738263040;
-- old: SystemMonitorShow
DELETE FROM opm.opm_access_control_level WHERE id = 738263045;
DELETE FROM opm.opm_group WHERE id = 738197508;
DELETE FROM opm.opm_acl_allow WHERE group_id = 738197508;
DELETE FROM opm.opm_group_group WHERE is_member_of_group_id = 738197508;
-- new ids: HandgrenadeMineSearchShow
DELETE FROM opm.opm_group WHERE id = 738197509;
DELETE FROM opm.opm_acl_allow WHERE group_id = 738197509;
DELETE FROM opm.opm_group_group WHERE is_member_of_group_id = 738197509;
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (738197508, 'HandgrenadeMineSearchShow', 'Show Hand grenade / DUS Mine Search Window', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (738197508, 738263046); -- group_id is: 738197508 = 0x2c000004
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (738263040, 738197508); -- Service Monitors
--- Service Monitors - System - 0x2c020000 = 738328576
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (738328576, 'Service Monitors - System', 'Service Monitors for System (SPS and Nagios)', 4, false);
--- Base: 738328576, SystemMonitorSPS - 738328577 = 0x2c020001
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (738328577, 'SystemMonitorSPS', 'Show System Monitor');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (738197509, 'SystemMonitorSPS', 'Show System Monitor', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (738197509, 738328577); -- group_id is: 738197509 = 0x2c000005
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (738328576, 738197509); -- Service Monitors - System
--- Base: 738328576, SystemMonitorNagios - 738328578 = 0x2c020002
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (738328578, 'SystemMonitorNagios', 'Nagios System Monitor');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (738197510, 'SystemMonitorNagios', 'Nagios System Monitor', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (738197510, 738328578); -- group_id is: 738197510 = 0x2c000006
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (738328576, 738197510); -- Service Monitors - System
COMMIT;
-- AVM: add new operator right AvVoiceCommunicationAccess
ALTER TABLE opm.opm_acl_allow ALTER CONSTRAINT fk_opm_acl_allow_group_id_opm_group_id DEFERRABLE;
ALTER TABLE opm.opm_group_group ALTER CONSTRAINT fk_opm_group_group_is_member_of_group_id_opm_group_id DEFERRABLE;
BEGIN;
SET CONSTRAINTS ALL DEFERRED;
-- move all rights one up
-- MvsConfig from 83886088 -> 83886089
UPDATE opm.opm_group SET id = 83886089 WHERE id = 83886088;
UPDATE opm.opm_acl_allow SET group_id = 83886089 WHERE group_id = 83886088;
UPDATE opm.opm_group_group SET is_member_of_group_id = 83886089 WHERE is_member_of_group_id = 83886088;
-- MvsStart from 83886087 -> 83886088
UPDATE opm.opm_group SET id = 83886088 WHERE id = 83886087;
UPDATE opm.opm_acl_allow SET group_id = 83886088 WHERE group_id = 83886087;
UPDATE opm.opm_group_group SET is_member_of_group_id = 83886088 WHERE is_member_of_group_id = 83886087;
-- AvmEwmEdit from 83886086 -> 83886087
UPDATE opm.opm_group SET id = 83886087 WHERE id = 83886086;
UPDATE opm.opm_acl_allow SET group_id = 83886087 WHERE group_id = 83886086;
UPDATE opm.opm_group_group SET is_member_of_group_id = 83886087 WHERE is_member_of_group_id = 83886086;
-- FrequencyPlanningEdit from 83886085 -> 83886086
UPDATE opm.opm_group SET id = 83886086 WHERE id = 83886085;
UPDATE opm.opm_acl_allow SET group_id = 83886086 WHERE group_id = 83886085;
UPDATE opm.opm_group_group SET is_member_of_group_id = 83886086 WHERE is_member_of_group_id = 83886085;
-- SettingsEdit from 83886084 -> 83886085
UPDATE opm.opm_group SET id = 83886085 WHERE id = 83886084;
UPDATE opm.opm_acl_allow SET group_id = 83886085 WHERE group_id = 83886084;
UPDATE opm.opm_group_group SET is_member_of_group_id = 83886085 WHERE is_member_of_group_id = 83886084;
-- 83886084 - new
--- Voice Communication Access - 0x5010200 = 83952128
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (83952128, 'Voice Communication Access', 'Allow access to the voice communication channels', 4, false);
--- Base: 83952128, AvVoiceCommunicationAccess - 83952129 = 0x5010201
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (83952129, 'AvVoiceCommunicationAccess', '');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (83886084, 'AvVoiceCommunicationAccess', '', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (83886084, 83952129); -- group_id is: 83886084 = 0x5000004
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (83952128, 83886084); -- Voice Communication Access
COMMIT;
ALTER TABLE opm.opm_acl_allow ALTER CONSTRAINT fk_opm_acl_allow_group_id_opm_group_id NOT DEFERRABLE;
ALTER TABLE opm.opm_group_group ALTER CONSTRAINT fk_opm_group_group_is_member_of_group_id_opm_group_id NOT DEFERRABLE;
-- PPM: add injuryBuildingId and injuryRoomId to HitLineInfo
SET SEARCH_PATH TO ex_NN, public;
ALTER TABLE rec_hit_line_info ADD COLUMN injury_building_id integer;
ALTER TABLE rec_hit_line_info ADD COLUMN injury_room_id integer;
-- PDM: add '{"showHitline":false}' as property to charge type 62 (indirect transport)
UPDATE pdm.pdm_charge_type SET properties = '{"showHitline":false}' WHERE id = 10062;
-- PDM: add column predefined_name in table pdm_charge_type (17.03.20)
ALTER TABLE pdm.pdm_charge_type ADD COLUMN predefined_name text;
-- TGT: new tables in ex_NN (30.04.2020)
SET SEARCH_PATH TO ex_NN, public;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_NN
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON TABLES TO ets_ex_NN;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_NN
GRANT SELECT, REFERENCES ON TABLES TO ets_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_NN
GRANT EXECUTE ON FUNCTIONS TO ets_ex_NN;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_NN
GRANT ALL ON SEQUENCES TO ets_ex_NN;
SET SEARCH_PATH TO ex_NN, PUBLIC;
-- Drop tables/views/sequences/constraints
ALTER TABLE IF EXISTS tgt_config DROP CONSTRAINT IF EXISTS PK_tgt_config_id CASCADE;
ALTER TABLE IF EXISTS tgt_effect_type DROP CONSTRAINT IF EXISTS PK_tgt_effect_type_id CASCADE;
ALTER TABLE IF EXISTS tgt_shootback_area DROP CONSTRAINT IF EXISTS PK_tgt_shootback_area_id CASCADE;
ALTER TABLE IF EXISTS tgt_shootback_target DROP CONSTRAINT IF EXISTS PK_tgt_shootback_target_id CASCADE;
ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS PK_tgt_target_area_assignment_id CASCADE;
ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS FK_tgt_target_area_assignment_effect_1_tgt_effect_type_id CASCADE;
ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS FK_tgt_target_area_assignment_effect_2_tgt_effect_type_id CASCADE;
ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS FK_tgt_target_area_assignment_target_id_tgt_shootback_target_id CASCADE;
ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS FK_tgt_target_area_assignment_area_id_tgt_shootback_area_id CASCADE;
DROP TABLE IF EXISTS tgt_config CASCADE;
DROP TABLE IF EXISTS tgt_effect_type CASCADE;
DROP TABLE IF EXISTS tgt_shootback_area CASCADE;
DROP TABLE IF EXISTS tgt_shootback_target CASCADE;
DROP TABLE IF EXISTS tgt_target_area_assignment CASCADE;
-- Create tables
CREATE TABLE IF NOT EXISTS tgt_config (
id integer DEFAULT nextval(( 'ex_NN.tgt_config_id_seq'::text)::regclass),
participant_id integer
);
CREATE TABLE IF NOT EXISTS tgt_effect_type (
id integer DEFAULT nextval(( 'ex_NN.tgt_effect_type_id_seq'::text)::regclass),
name text
);
CREATE TABLE IF NOT EXISTS tgt_shootback_area (
id integer DEFAULT nextval(( 'ex_NN.tgt_shootback_area_id_seq'::text)::regclass),
name text,
position_x double precision,
position_y double precision,
width double precision,
height double precision
);
CREATE TABLE IF NOT EXISTS tgt_shootback_target (
id integer DEFAULT nextval(( 'ex_NN.tgt_shootback_target_id_seq'::text)::regclass),
name text,
is_movable boolean
);
CREATE TABLE IF NOT EXISTS tgt_target_area_assignment (
id integer DEFAULT nextval(( 'ex_NN.tgt_target_area_assignment_id_seq'::text)::regclass),
name text,
target_id integer,
area_id integer,
interval_1 integer,
flash_1 boolean,
effect_1 integer,
interval_2 integer,
flash_2 boolean,
effect_2 integer
);
-- Create sequence(s)
CREATE SEQUENCE IF NOT EXISTS tgt_config_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS tgt_effect_type_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS tgt_shootback_area_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS tgt_shootback_target_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS tgt_target_area_assignment_id_seq INCREMENT 1 START 1 MINVALUE 1;
-- Create primary keys
ALTER TABLE IF EXISTS tgt_config ADD CONSTRAINT PK_tgt_config_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS tgt_effect_type ADD CONSTRAINT PK_tgt_effect_type_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS tgt_shootback_area ADD CONSTRAINT PK_tgt_shootback_area_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS tgt_shootback_target ADD CONSTRAINT PK_tgt_shootback_target_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS tgt_target_area_assignment ADD CONSTRAINT PK_tgt_target_area_assignment_id PRIMARY KEY (id);
-- Create foreign keys
ALTER TABLE tgt_target_area_assignment ADD CONSTRAINT FK_tgt_target_area_assignment_effect_1_tgt_effect_type_id FOREIGN KEY (effect_1) REFERENCES tgt_effect_type (id) ON DELETE CASCADE;
ALTER TABLE tgt_target_area_assignment ADD CONSTRAINT FK_tgt_target_area_assignment_effect_2_tgt_effect_type_id FOREIGN KEY (effect_2) REFERENCES tgt_effect_type (id) ON DELETE CASCADE;
ALTER TABLE tgt_target_area_assignment ADD CONSTRAINT FK_tgt_target_area_assignment_target_id_tgt_shootback_target_id FOREIGN KEY (target_id) REFERENCES tgt_shootback_target (id) ON DELETE CASCADE;
ALTER TABLE tgt_target_area_assignment ADD CONSTRAINT FK_tgt_target_area_assignment_area_id_tgt_shootback_area_id FOREIGN KEY (area_id) REFERENCES tgt_shootback_area (id) ON DELETE CASCADE;
-- Inserts for static data i.e. enums
INSERT INTO tgt_effect_type (id, name) VALUES (0, 'NearMiss');
INSERT INTO tgt_effect_type (id, name) VALUES (1, 'MobilityKill');
INSERT INTO tgt_effect_type (id, name) VALUES (2, 'WeaponKill');
-- EVL: new tables san_nine_liner and san_category_line in ex_NN and rights (27.05.2020)
SET SEARCH_PATH TO ex_NN, PUBLIC;
CREATE TABLE IF NOT EXISTS san_category_line (
id bigint DEFAULT nextval(( 'ex_NN.san_category_line_id_seq'::text)::regclass),
nine_liner_id bigint,
line integer,
amount integer,
category text
);
CREATE TABLE IF NOT EXISTS san_nine_liner (
id bigint DEFAULT nextval(( 'ex_NN.san_nine_liner_id_seq'::text)::regclass),
last_modified bigint,
position_x double precision,
position_y double precision,
radio_frequency_suffix_callsign text
);
CREATE SEQUENCE IF NOT EXISTS san_category_line_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS san_nine_liner_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS san_category_line ADD CONSTRAINT PK_san_category_line_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS san_nine_liner ADD CONSTRAINT PK_san_nine_liner_id PRIMARY KEY (id);
ALTER TABLE san_category_line ADD CONSTRAINT FK_san_category_line_nine_liner_id_san_nine_liner_id FOREIGN KEY (nine_liner_id) REFERENCES san_nine_liner (id) ON DELETE CASCADE;
--- SanNineLiner rights - 0xa020000 = 167903232
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (167903232, 'SanNineLiner', 'SanNineLiner', 4, false);
--- Base: 167903232, SanNineLinerEdit - 167903233 = 0xa020001
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (167903233, 'SanNineLinerEdit', 'SanNineLinerEdit');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (167772163, 'SanNineLinerEdit', 'SanNineLinerEdit', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (167772163, 167903233); -- group_id is: 167772163 = 0xa000003
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (167903232, 167772163); -- SanNineLiner
--- Base: 167903232, SanNineLinerShow - 167903234 = 0xa020002
INSERT INTO opm.opm_access_control_level (id, name, description) VALUES (167903234, 'SanNineLinerShow', 'SanNineLinerShow');
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (167772164, 'SanNineLinerShow', 'SanNineLinerShow', 1, true);
INSERT INTO opm.opm_acl_allow (group_id, acl_id) VALUES (167772164, 167903234); -- group_id is: 167772164 = 0xa000004
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (167903232, 167772164); -- SanNineLiner
-- add right to group evaluation / PvSanEvaluation
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1009,167903232);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,167903232);
-- PPM, PDM, TAB: Vitality & ExistingMedicalSupplies (09.06.2020)
-- pdm_vulnerability_state: NoChange
--DELETE FROM pdm.pdm_vulnerability_state WHERE id = -1;
INSERT INTO pdm.pdm_vulnerability_state (id, name) VALUES (-1, 'NoChange');
-- TAB recording table rec_equipment_state in ex_45, 44, 46, 28
--ALTER TABLE ex_45.rec_equipment_state ADD COLUMN IF NOT EXISTS vulnerability_kind_id INTEGER;
ALTER TABLE ex_45.rec_equipment_state ADD COLUMN IF NOT EXISTS vitality INTEGER;
--ALTER TABLE ex_44.rec_equipment_state ADD COLUMN IF NOT EXISTS vulnerability_kind_id INTEGER;
ALTER TABLE ex_44.rec_equipment_state ADD COLUMN IF NOT EXISTS vitality INTEGER;
--ALTER TABLE ex_46.rec_equipment_state ADD COLUMN IF NOT EXISTS vulnerability_kind_id INTEGER;
ALTER TABLE ex_46.rec_equipment_state ADD COLUMN IF NOT EXISTS vitality INTEGER;
--ALTER TABLE ex_28.rec_equipment_state ADD COLUMN IF NOT EXISTS vulnerability_kind_id INTEGER;
ALTER TABLE ex_28.rec_equipment_state ADD COLUMN IF NOT EXISTS vitality INTEGER;
-- PPM recording table rec_existing_medical_supplies in ex 44, 45, 46, 28
SET SEARCH_PATH TO ex_44, PUBLIC;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS PK_rec_existing_medical_supplies_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS IDX_rec_existing_medical_supplies_sample_time CASCADE;
DROP TABLE IF EXISTS rec_existing_medical_supplies CASCADE;
CREATE SEQUENCE IF NOT EXISTS rec_existing_medical_supplies_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS rec_existing_medical_supplies (
participant_id integer,
sample_time bigint,
list jsonb,
rec_id bigint DEFAULT nextval(( 'ex_44.rec_existing_medical_supplies_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_existing_medical_supplies IS 'recorded data for topic ExistingMedicalSupplies';
ALTER TABLE IF EXISTS rec_existing_medical_supplies ADD CONSTRAINT PK_rec_existing_medical_supplies_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_existing_medical_supplies_sample_time ON rec_existing_medical_supplies (sample_time);
SET SEARCH_PATH TO ex_45, PUBLIC;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS PK_rec_existing_medical_supplies_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS IDX_rec_existing_medical_supplies_sample_time CASCADE;
DROP TABLE IF EXISTS rec_existing_medical_supplies CASCADE;
CREATE SEQUENCE IF NOT EXISTS rec_existing_medical_supplies_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS rec_existing_medical_supplies (
participant_id integer,
sample_time bigint,
list jsonb,
rec_id bigint DEFAULT nextval(( 'ex_45.rec_existing_medical_supplies_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_existing_medical_supplies IS 'recorded data for topic ExistingMedicalSupplies';
ALTER TABLE IF EXISTS rec_existing_medical_supplies ADD CONSTRAINT PK_rec_existing_medical_supplies_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_existing_medical_supplies_sample_time ON rec_existing_medical_supplies (sample_time);
SET SEARCH_PATH TO ex_46, PUBLIC;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS PK_rec_existing_medical_supplies_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS IDX_rec_existing_medical_supplies_sample_time CASCADE;
DROP TABLE IF EXISTS rec_existing_medical_supplies CASCADE;
CREATE SEQUENCE IF NOT EXISTS rec_existing_medical_supplies_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS rec_existing_medical_supplies (
participant_id integer,
sample_time bigint,
list jsonb,
rec_id bigint DEFAULT nextval(( 'ex_46.rec_existing_medical_supplies_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_existing_medical_supplies IS 'recorded data for topic ExistingMedicalSupplies';
ALTER TABLE IF EXISTS rec_existing_medical_supplies ADD CONSTRAINT PK_rec_existing_medical_supplies_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_existing_medical_supplies_sample_time ON rec_existing_medical_supplies (sample_time);
SET SEARCH_PATH TO ex_28, PUBLIC;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS PK_rec_existing_medical_supplies_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_existing_medical_supplies DROP CONSTRAINT IF EXISTS IDX_rec_existing_medical_supplies_sample_time CASCADE;
DROP TABLE IF EXISTS rec_existing_medical_supplies CASCADE;
CREATE SEQUENCE IF NOT EXISTS rec_existing_medical_supplies_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE TABLE IF NOT EXISTS rec_existing_medical_supplies (
participant_id integer,
sample_time bigint,
list jsonb,
rec_id bigint DEFAULT nextval(( 'ex_28.rec_existing_medical_supplies_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_existing_medical_supplies IS 'recorded data for topic ExistingMedicalSupplies';
ALTER TABLE IF EXISTS rec_existing_medical_supplies ADD CONSTRAINT PK_rec_existing_medical_supplies_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_existing_medical_supplies_sample_time ON rec_existing_medical_supplies (sample_time);
-- Grants for new recording tables (09.06.2020)
SET SEARCH_PATH TO ex_44, PUBLIC;
ALTER TABLE rec_existing_medical_supplies OWNER TO ets_ex_44;
GRANT SELECT,INSERT,UPDATE,DELETE ON rec_existing_medical_supplies TO ets_ex_44;
GRANT SELECT, USAGE ON SEQUENCE rec_existing_medical_supplies_rec_id_seq TO ets_ex_44;
ALTER TABLE san_category_line OWNER TO ets_ex_44;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_category_line TO ets_ex_44;
GRANT SELECT, USAGE ON SEQUENCE san_category_line_id_seq TO ets_ex_44;
ALTER TABLE san_nine_liner OWNER TO ets_ex_44;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_nine_liner TO ets_ex_44;
GRANT SELECT, USAGE ON SEQUENCE san_nine_liner_id_seq TO ets_ex_44;
SET SEARCH_PATH TO ex_45, PUBLIC;
ALTER TABLE rec_existing_medical_supplies OWNER TO ets_ex_45;
GRANT SELECT,INSERT,UPDATE,DELETE ON rec_existing_medical_supplies TO ets_ex_45;
GRANT SELECT, USAGE ON SEQUENCE rec_existing_medical_supplies_rec_id_seq TO ets_ex_45;
ALTER TABLE san_category_line OWNER TO ets_ex_45;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_category_line TO ets_ex_45;
GRANT SELECT, USAGE ON SEQUENCE san_category_line_id_seq TO ets_ex_45;
ALTER TABLE san_nine_liner OWNER TO ets_ex_45;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_nine_liner TO ets_ex_45;
GRANT SELECT, USAGE ON SEQUENCE san_nine_liner_id_seq TO ets_ex_45;
SET SEARCH_PATH TO ex_46, PUBLIC;
ALTER TABLE rec_existing_medical_supplies OWNER TO ets_ex_46;
GRANT SELECT,INSERT,UPDATE,DELETE ON rec_existing_medical_supplies TO ets_ex_46;
GRANT SELECT, USAGE ON SEQUENCE rec_existing_medical_supplies_rec_id_seq TO ets_ex_46;
ALTER TABLE san_category_line OWNER TO ets_ex_46;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_category_line TO ets_ex_46;
GRANT SELECT, USAGE ON SEQUENCE san_category_line_id_seq TO ets_ex_46;
ALTER TABLE san_nine_liner OWNER TO ets_ex_46;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_nine_liner TO ets_ex_46;
GRANT SELECT, USAGE ON SEQUENCE san_nine_liner_id_seq TO ets_ex_46;
SET SEARCH_PATH TO ex_28, PUBLIC;
ALTER TABLE rec_existing_medical_supplies OWNER TO ets_ex_28;
GRANT SELECT,INSERT,UPDATE,DELETE ON rec_existing_medical_supplies TO ets_ex_28;
GRANT SELECT, USAGE ON SEQUENCE rec_existing_medical_supplies_rec_id_seq TO ets_ex_28;
ALTER TABLE san_category_line OWNER TO ets_ex_28;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_category_line TO ets_ex_28;
GRANT SELECT, USAGE ON SEQUENCE san_category_line_id_seq TO ets_ex_28;
ALTER TABLE san_nine_liner OWNER TO ets_ex_28;
GRANT SELECT,INSERT,UPDATE,DELETE ON san_nine_liner TO ets_ex_28;
GRANT SELECT, USAGE ON SEQUENCE san_nine_liner_id_seq TO ets_ex_28;
-- PVSan recording tables in ex_44, similar must be done in ex_45, ex_46, ex_28
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_44
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON TABLES TO ets_ex_44;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_44
GRANT SELECT, REFERENCES ON TABLES TO ets_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_44
GRANT EXECUTE ON FUNCTIONS TO ets_ex_44;
ALTER DEFAULT PRIVILEGES IN SCHEMA ex_44
GRANT ALL ON SEQUENCES TO ets_ex_44;
SET SEARCH_PATH TO ex_44, PUBLIC;
ALTER TABLE IF EXISTS rec_sanitation DROP CONSTRAINT IF EXISTS PK_rec_sanitation_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_sanitation DROP CONSTRAINT IF EXISTS IDX_rec_sanitation_sample_time CASCADE;
DROP TABLE IF EXISTS rec_sanitation CASCADE;
CREATE TABLE IF NOT EXISTS rec_sanitation (
participant_id integer,
sample_time bigint,
data_treating_id integer,
data_medical_measure integer,
data_qualification integer,
rec_id bigint DEFAULT nextval(( 'ex_44.rec_sanitation_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_sanitation IS 'recorded data for topic Sanitation';
CREATE SEQUENCE IF NOT EXISTS rec_sanitation_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_sanitation ADD CONSTRAINT PK_rec_sanitation_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_sanitation_sample_time ON rec_sanitation (sample_time);
ALTER TABLE IF EXISTS rec_participant_sanitary_material_stock_report DROP CONSTRAINT IF EXISTS PK_rec_participant_sanitary_material_stock_report_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_participant_sanitary_material_stock_report DROP CONSTRAINT IF EXISTS IDX_rec_participant_sanitary_material_stock_report_sample_time CASCADE;
ALTER TABLE IF EXISTS rec_participant_sanitation DROP CONSTRAINT IF EXISTS PK_rec_participant_sanitation_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_participant_sanitation DROP CONSTRAINT IF EXISTS IDX_rec_participant_sanitation_sample_time CASCADE;
ALTER TABLE IF EXISTS rec_participant_sanitation_repair DROP CONSTRAINT IF EXISTS PK_rec_participant_sanitation_repair_rec_id CASCADE;
ALTER TABLE IF EXISTS rec_participant_sanitation_repair DROP CONSTRAINT IF EXISTS IDX_rec_participant_sanitation_repair_sample_time CASCADE;
DROP TABLE IF EXISTS rec_participant_sanitary_material_stock_report CASCADE;
DROP TABLE IF EXISTS rec_participant_sanitation CASCADE;
DROP TABLE IF EXISTS rec_participant_sanitation_repair CASCADE;
CREATE TABLE IF NOT EXISTS rec_participant_sanitary_material_stock_report (
equipment_number integer,
sample_time bigint,
sanitary_material_count integer,
sanitary_material_stock jsonb,
rec_id bigint DEFAULT nextval(( 'ex_44.rec_participant_sanitary_material_stock_report_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_participant_sanitary_material_stock_report IS 'recorded data for topic ParticipantSanitaryMaterialStockReport';
CREATE TABLE IF NOT EXISTS rec_participant_sanitation (
equipment_number integer,
sample_time bigint,
procedure integer,
originator_equipment_number integer,
qualification integer,
rec_id bigint DEFAULT nextval(( 'ex_44.rec_participant_sanitation_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_participant_sanitation IS 'recorded data for topic ParticipantSanitation';
CREATE TABLE IF NOT EXISTS rec_participant_sanitation_repair (
equipment_number integer,
sample_time bigint,
originator_type integer,
equipment_number_origin integer,
state_start integer,
type_of_treatment integer,
triage integer,
tye_of_damage integer,
state_result integer,
treatment_result integer,
triage_priority integer,
full_state integer,
time_of_treatment integer,
time_of_recovery integer,
rec_id bigint DEFAULT nextval(( 'ex_44.rec_participant_sanitation_repair_rec_id_seq'::text)::regclass),
dds_is_alive boolean DEFAULT true,
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
);
COMMENT ON TABLE rec_participant_sanitation_repair IS 'recorded data for topic ParticipantSanitationRepair';
CREATE SEQUENCE IF NOT EXISTS rec_participant_sanitary_material_stock_report_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS rec_participant_sanitation_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS rec_participant_sanitation_repair_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rec_participant_sanitary_material_stock_report ADD CONSTRAINT PK_rec_participant_sanitary_material_stock_report_rec_id PRIMARY KEY (rec_id);
ALTER TABLE IF EXISTS rec_participant_sanitation ADD CONSTRAINT PK_rec_participant_sanitation_rec_id PRIMARY KEY (rec_id);
ALTER TABLE IF EXISTS rec_participant_sanitation_repair ADD CONSTRAINT PK_rec_participant_sanitation_repair_rec_id PRIMARY KEY (rec_id);
CREATE INDEX IDX_rec_participant_sanitary_material_stock_report_sample_time ON rec_participant_sanitary_material_stock_report (sample_time);
CREATE INDEX IDX_rec_participant_sanitation_sample_time ON rec_participant_sanitation (sample_time);
CREATE INDEX IDX_rec_participant_sanitation_repair_sample_time ON rec_participant_sanitation_repair (sample_time);
-- Nebel charge type (09.06.2020)
INSERT INTO pdm.pdm_charge_type (id, tas_code_direct, tas_code_indirect, name, short_name, properties, dis_entity) VALUES (8005, 201, 5, 'Nebel', 'Nebel', '{"impactRadius":25, "impactEdgeLength":25, "isSmoke":true}', '2.255.201.5');
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (801, 8005, NULL);
-- MSG: drop FK FK_msg_message_operator_data_msg_message_operator_data (SVN 31353 - needed for Base Download!)
SET SEARCH_PATH to msg, PUBLIC;
ALTER TABLE IF EXISTS msg_message_operator_data DROP CONSTRAINT IF EXISTS fk_msg_message_operator_data_corresponding_outbox_message_id_ms CASCADE;
ALTER TABLE IF EXISTS msg_message_operator_data ALTER COLUMN corresponding_outbox_message_id SET DEFAULT 0;
-- PDM: pdm_sanitation_material (SVN 51383, 51362, 51358, 51357)
SET SEARCH_PATH TO pdm, PUBLIC;
ALTER TABLE IF EXISTS pdm_sanitation_material DROP CONSTRAINT IF EXISTS PK_pdm_sanitation_material_id CASCADE;
ALTER TABLE IF EXISTS pdm_sanitation_material DROP CONSTRAINT IF EXISTS UQ_pdm_sanitation_material_name CASCADE;
--DROP TABLE IF EXISTS pdm_sanitation_material CASCADE;
CREATE TABLE IF NOT EXISTS pdm_sanitation_material (
id integer DEFAULT nextval(( 'pdm.pdm_sanitation_material_id_seq'::text)::regclass),
name text,
description text
);
ALTER TABLE pdm_sanitation_material OWNER TO ets_pdm;
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON pdm_sanitation_material TO ets_pdm;
CREATE SEQUENCE IF NOT EXISTS pdm_sanitation_material_id_seq INCREMENT 1 START 1 MINVALUE 1;
GRANT SELECT, USAGE ON SEQUENCE pdm_sanitation_material_id_seq TO ets_pdm;
ALTER TABLE IF EXISTS pdm_sanitation_material ADD CONSTRAINT PK_pdm_sanitation_material_id PRIMARY KEY (id);
ALTER TABLE pdm_sanitation_material ADD CONSTRAINT UQ_pdm_sanitation_material_name UNIQUE (name);
-- PPM: sanitation_material_stock column in dynamic data in ex_NN (SVN 51355)
ALTER TABLE ex_NN.rec_dynamic_participant_data ADD COLUMN sanitation_material_stock jsonb;
-- TGT: New columns in tgt_shootback_target for ex_NN (SVN 51371)
SET SEARCH_PATH TO ex_NN, PUBLIC;
ALTER TABLE tgt_shootback_target ADD COLUMN IF NOT EXISTS activate_laser_designation boolean;
ALTER TABLE tgt_shootback_target ADD COLUMN IF NOT EXISTS permanent_installed_target boolean;
ALTER TABLE tgt_shootback_target ADD COLUMN IF NOT EXISTS activate_lights boolean;
ALTER TABLE tgt_shootback_target ADD COLUMN IF NOT EXISTS hits_to_kill integer;
ALTER TABLE tgt_shootback_target ADD COLUMN IF NOT EXISTS activate_popup_automatic boolean;
ALTER TABLE tgt_shootback_target DROP COLUMN IF EXISTS is_movable CASCADE;
-- SOM: New global schema and user for SoundManagement (SVN 51387)
SELECT create_user_if_not_exists('ets_som');
-- GRANT ets_ro TO ets_som;
GRANT ets_som TO ets_admin;
CREATE SCHEMA IF NOT EXISTS som;
ALTER SCHEMA som OWNER TO ets_som;
GRANT ALL ON SCHEMA som TO ets_admin;
GRANT USAGE ON SCHEMA som TO ets_ro;
-- ISM: new MountingPointType OutdoorControlUnit (SVN 51414)
INSERT INTO ism.ism_mounting_point_type (id, name) VALUES (13, 'OutdoorControlUnit');
-- REP: update tables for sanitation material report (SVN 51332, 51380, 51419)
SET SEARCH_PATH TO ex_NN, PUBLIC;
ALTER TABLE IF EXISTS rep_sanitation_material_data DROP CONSTRAINT IF EXISTS PK_rep_sanitation_material_data_id CASCADE;
ALTER TABLE IF EXISTS rep_sanitation_material_data DROP CONSTRAINT IF EXISTS FK_rep_sanitation_material_data_material_id_pdm_sanitation_mate CASCADE;
ALTER TABLE IF EXISTS rep_sanitation_material_result DROP CONSTRAINT IF EXISTS PK_rep_sanitation_material_result_id CASCADE;
ALTER TABLE IF EXISTS rep_sanitation_material_result DROP CONSTRAINT IF EXISTS FK_rep_sanitation_material_result_material_id_pdm_sanitation_ma CASCADE;
DROP TABLE IF EXISTS rep_sanitation_material_data CASCADE;
DROP TABLE IF EXISTS rep_sanitation_material_result CASCADE;
CREATE TABLE IF NOT EXISTS rep_sanitation_material_data (
id bigint DEFAULT nextval(( 'ex_NN.rep_sanitation_material_data_id_seq'::text)::regclass),
party_id integer,
event_time bigint,
participant_id integer,
material_id integer,
planned integer,
amount integer,
used integer
);
CREATE TABLE IF NOT EXISTS rep_sanitation_material_result (
id bigint DEFAULT nextval(( 'ex_NN.rep_sanitation_material_result_id_seq'::text)::regclass),
report_id bigint,
start_time bigint,
end_time bigint,
material_id integer,
amount_start integer,
amount_resupplied integer,
amount_end integer,
amount_used integer
);
CREATE SEQUENCE IF NOT EXISTS rep_sanitation_material_data_id_seq INCREMENT 1 START 1 MINVALUE 1;
CREATE SEQUENCE IF NOT EXISTS rep_sanitation_material_result_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rep_sanitation_material_data ADD CONSTRAINT PK_rep_sanitation_material_data_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS rep_sanitation_material_result ADD CONSTRAINT PK_rep_sanitation_material_result_id PRIMARY KEY (id);
ALTER TABLE rep_sanitation_material_data ADD CONSTRAINT FK_rep_sanitation_material_data_material_id_pdm_sanitation_mate FOREIGN KEY (material_id) REFERENCES pdm.pdm_sanitation_material (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_sanitation_material_result ADD CONSTRAINT FK_rep_sanitation_material_result_material_id_pdm_sanitation_ma FOREIGN KEY (material_id) REFERENCES pdm.pdm_sanitation_material (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- New report type in enum
INSERT INTO rep_report_type (id, name) VALUES (13, 'SanitationMaterial');
-- Grants
ALTER TABLE rep_sanitation_material_data OWNER TO ets_exm;
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON rep_sanitation_material_data TO ets_exm, ets_ex_NN;
GRANT SELECT, USAGE ON SEQUENCE rep_sanitation_material_data_id_seq TO ets_ro;
ALTER TABLE rep_sanitation_material_result OWNER TO ets_exm;
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON rep_sanitation_material_result TO ets_exm, ets_ex_NN;
GRANT SELECT, USAGE ON SEQUENCE rep_sanitation_material_result_id_seq TO ets_ro;
-- PDM: sanitation procedures and new originator types (SVN 51480, 51504)
SET SEARCH_PATH TO pdm, PUBLIC;
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 DEFAULT nextval(( 'pdm.pdm_sanitation_procedures_id_seq'::text)::regclass),
name text
);
CREATE SEQUENCE IF NOT EXISTS pdm_sanitation_procedures_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS pdm_sanitation_procedures ADD CONSTRAINT PK_pdm_sanitation_procedures_id PRIMARY KEY (id);
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (0, 'None');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (1, 'Bandage');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (2, 'PressureBandage');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (3, 'Tourniquet');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (4, 'Padding');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (5, 'HeadBandage');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (6, 'PatientPositioning');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (7, 'AirtightBandage');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (8, 'Splinting');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (9, 'Cooling');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (10, 'Cover');
-- Grants
ALTER TABLE pdm_sanitation_procedures OWNER TO ets_pdm;
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON pdm_sanitation_procedures TO ets_pdm;
GRANT SELECT, USAGE ON SEQUENCE pdm_sanitation_procedures_id_seq TO ets_ro;
-- New originators
INSERT INTO pdm_state_change_originator (id, name) VALUES (9, 'MedicalTimeout');
INSERT INTO pdm_state_change_originator (id, name) VALUES (10, 'Sanitation');
-- REP: sanitation report (SVN 51607, 51677)
SET SEARCH_PATH TO ex_NN, PUBLIC;
INSERT INTO rep_report_type (id, name) VALUES (14, 'Sanitation');
ALTER TABLE rep_maintenance_data ADD COLUMN time_sanitation bigint;
ALTER TABLE rep_maintenance_data ADD COLUMN success_sanitation boolean;
ALTER TABLE rep_maintenance_data ADD COLUMN vitality integer;
ALTER TABLE rep_maintenance_result ADD COLUMN time_sanitation bigint;
ALTER TABLE rep_maintenance_result ADD COLUMN success_sanitation boolean;
ALTER TABLE rep_maintenance_result ADD COLUMN vitality integer;
-- TGT: columns names, drop foreign keys (SVN 51604, 51622)
SET SEARCH_PATH TO ex_NN, PUBLIC;
--ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS FK_tgt_target_area_assignment_tgt_shootback_target;
--ALTER TABLE IF EXISTS tgt_target_area_assignment DROP CONSTRAINT IF EXISTS FK_tgt_target_area_assignment_tgt_shootback_area;
ALTER TABLE IF EXISTS tgt_target_area_assignment DROP COLUMN IF EXISTS target_data_id;
ALTER TABLE IF EXISTS tgt_target_area_assignment ADD COLUMN target_participant_id INTEGER;
ALTER TABLE IF EXISTS tgt_target_area_assignment ADD COLUMN is_active BOOLEAN DEFAULT false;
-- Mobile Besprechung Ausstattung (MobileAfterActionVehicle)
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(170, 'ECMAPWS11', 5, 7),
(171, 'ECMAPWS12', 5, 7);
-- PDM: new event type Sanitation (SVN 51633)
INSERT INTO pdm.pdm_event_type (id, name) VALUES (39, 'Sanitation');
-- Workstation Bremen BR01-05 - 13.07.2020
INSERT INTO asm.asm_asset(id, name, asset_type_id, location_id) VALUES
(172, 'ECBROWS01', 1, 1),
(173, 'ECBROWS02', 1, 1),
(174, 'ECBROWS03', 1, 1),
(175, 'ECBROWS04', 1, 1),
(176, 'ECBROWS05', 1, 1);
-- PDM: Sanitation Procedures updated (SVN 51722)
SET SEARCH_PATH TO pdm, PUBLIC;
DELETE FROM pdm_sanitation_procedures;
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (0, 'None');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (1, 'Dressing');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (2, 'PressureDressing');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (3, 'Tourniquet');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (4, 'Tamponing');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (5, 'HeadDressing');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (6, 'LayingDown');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (7, 'AirtightDressing');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (8, 'Splinting');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (9, 'Cooling');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (10, 'Covering');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (11, 'Sweep');
-- REP: Treatment instead of Sanitation (SVN 51728)
UPDATE ex_NN.rep_report_type SET name = "Treatment" where id = 14;
-- PDM: Update destructive_factor not null (26.08.20)
UPDATE pdm.pdm_building_charge_effect SET destructive_factor = 1 WHERE destructive_factor = 0;
-- PDM: missing charge_legacy_id (A-Wirkfeld, Nebel Klasse 8) (26.08.2020)
UPDATE pdm.pdm_charge_type SET charge_legacy_id = 1 WHERE id = 321;
UPDATE pdm.pdm_charge_type SET charge_legacy_id = 5 WHERE id = 385;
-- PDM: Change manually created MineCorridor dummy charge 106 to 315 (26.08.20)
UPDATE pdm.pdm_charge_type SET id = 315 WHERE id = 106;
-- REP: Position added (28.08.20)
ALTER TABLE ex_<N>.rep_report ADD position_x double precision;
ALTER TABLE ex_<N>.rep_report ADD position_y double precision;
ALTER TABLE ex_<N>.rep_report ADD width double precision;
ALTER TABLE ex_<N>.rep_report ADD height double precision;
-- EXM: New table exercise image + saved images (16.09.2020)
SET SEARCH_PATH TO exm, PUBLIC;
ALTER TABLE IF EXISTS exercise_image DROP CONSTRAINT IF EXISTS PK_exercise_image_exercise_id CASCADE;
ALTER TABLE IF EXISTS exercise_image DROP CONSTRAINT IF EXISTS FK_exercise_image_exercise_id_exercise_id CASCADE;
CREATE TABLE IF NOT EXISTS exercise_image (
exercise_id integer,
image bytea
);
ALTER TABLE IF EXISTS exercise_image ADD CONSTRAINT PK_exercise_image_exercise_id PRIMARY KEY (exercise_id);
ALTER TABLE exercise_image ADD CONSTRAINT FK_exercise_image_exercise_id_exercise_id FOREIGN KEY (exercise_id) REFERENCES exercise (id) ON DELETE CASCADE ON UPDATE CASCADE;
INSERT INTO exm.exercise_image (SELECT id, image FROM exm.exercise);
-- after everything is done and looks ok!
-- ALTER TABLE exm.exercise DROP COLUMN image;
-- EVL: Position in meter added (17.09.20)
ALTER TABLE ex_<N>.san_nine_liner ADD position_x_m double precision;
ALTER TABLE ex_<N>.san_nine_liner ADD position_y_m double precision;
-- REP: Added table rep_san_nine_liner (17.09.20)
SET SEARCH_PATH TO ex_<n>, PUBLIC;
CREATE TABLE IF NOT EXISTS rep_san_nine_liner (
id bigint DEFAULT nextval(( 'ex_<n>.rep_san_nine_liner_id_seq'::text)::regclass),
report_id bigint,
nine_liner_id bigint
);
CREATE SEQUENCE IF NOT EXISTS rep_san_nine_liner_id_seq INCREMENT 1 START 1 MINVALUE 1;
ALTER TABLE IF EXISTS rep_san_nine_liner ADD CONSTRAINT PK_rep_san_nine_liner_id PRIMARY KEY (id);
ALTER TABLE rep_san_nine_liner ADD CONSTRAINT FK_rep_san_nine_liner_report_id_rep_report_id FOREIGN KEY (report_id) REFERENCES rep_report (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE rep_san_nine_liner ADD CONSTRAINT FK_rep_san_nine_liner_nine_liner_id_san_nine_liner_id FOREIGN KEY (nine_liner_id) REFERENCES san_nine_liner (id) ON DELETE CASCADE ON UPDATE CASCADE;
CREATE INDEX IDX_rep_san_nine_liner_report_id ON rep_san_nine_liner (report_id);
INSERT INTO rep_report_type (id, name) VALUES (15, 'MedevacNineLiner');
INSERT INTO rep_report_type (id, name) VALUES (16, 'TreatmentPriority');
INSERT INTO rep_report_type (id, name) VALUES (17, 'TreatmentChain');
-- PDM: Mine Corridor (SVN 52126 from MD)
INSERT INTO pdm.pdm_charge_type (id, name, short_name, properties, dis_entity, charge_legacy_id) VALUES (315, 'Minengassen Dummy', NULL, '{"isDummy":true}', NULL, NULL);
-- ASM: certificate (SVN 52263, 28.10.2020)
ALTER TABLE asm.asm_asset ADD COLUMN certificate bytea;
-- OPM: Sanitation evaluation rights (29.10.2020)
INSERT INTO opm.opm_group (id, name, description, type_id, is_hidden) VALUES (1010, 'San. Evaluation', 'Sanitation evaluation rights', 3, true);
---- Rights (PVSan Auswertung - 1010)
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33620224);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33685504);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33685760);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33686016);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33686272);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33751040);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33816576);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,33882112);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,34013184);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,34078720);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,34144256);
--INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,34209792);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,50397184);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,83951616);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,117506048);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,134283264);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,184614912);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,218169600);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,234946560);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,234946816);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,335609856);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,335610112);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,352387072);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,419495936);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,419627008);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,419496192);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,453115904);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,453443584);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,469827584);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,469893120);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,469958656);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,520159232);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,587268096);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,587268352);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,587268608);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,587268864);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,620822528);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,771817472);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,788594688);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,805371904);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,822149120);
INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,838926336);
--INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,167903232);
--INSERT INTO opm.opm_group_group (group_id, is_member_of_group_id) VALUES (1010,889257984);
-- Translation
INSERT INTO pdm.pdm_translation (iso_code, context, key, disambiguation, translation) VALUES
( 'de_DE', 'Group', 'San. Evaluation', 'name', 'PVSan Auswertung');
--
-- NLDEVCTRL-682, AES: FunctionalAreaTypes, Achtung: Übungsabhängige Änderungen unten dabei! - 03.11.2020
-- Begin
--
-- Create user ets_aes
SELECT create_user_if_not_exists('ets_aes');
GRANT ets_ro TO ets_aes;
GRANT ets_aes TO ets_admin;
-- Schema for Service AreaEffectManagement (AES)
CREATE SCHEMA IF NOT EXISTS aes;
ALTER SCHEMA aes OWNER TO ets_aes;
GRANT ALL ON SCHEMA aes TO ets_admin;
-- Usage for Service AreaEffectManagement (AES)
GRANT USAGE ON SCHEMA aes TO ets_ro;
-- Add Privileges
ALTER DEFAULT PRIVILEGES IN SCHEMA aes
GRANT SELECT,INSERT,UPDATE,DELETE,TRUNCATE ON TABLES TO ets_aes;
ALTER DEFAULT PRIVILEGES IN SCHEMA aes
GRANT SELECT, REFERENCES ON TABLES TO ets_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA aes
GRANT EXECUTE ON FUNCTIONS TO ets_aes;
ALTER DEFAULT PRIVILEGES IN SCHEMA aes
GRANT ALL ON SEQUENCES TO ets_aes;
SET SEARCH_PATH TO aes, PUBLIC;
-- Drop tables/views/sequences/constraints
--ALTER TABLE IF EXISTS aes_functional_area_type DROP CONSTRAINT IF EXISTS PK_aes_functional_area_type_id CASCADE;
--ALTER TABLE IF EXISTS aes_functional_area_type DROP CONSTRAINT IF EXISTS FK_aes_functional_area_type_decon_mode_aes_operating_mode_id CASCADE;
--ALTER TABLE IF EXISTS aes_functional_area_type DROP CONSTRAINT IF EXISTS FK_aes_functional_area_type_maint_mode_aes_operating_mode_id CASCADE;
--ALTER TABLE IF EXISTS aes_functional_area_type DROP CONSTRAINT IF EXISTS FK_aes_functional_area_type_medic_mode_aes_operating_mode_id CASCADE;
--ALTER TABLE IF EXISTS aes_operating_mode DROP CONSTRAINT IF EXISTS PK_aes_operating_mode_id CASCADE;
--DROP TABLE IF EXISTS aes_functional_area_type CASCADE;
--DROP TABLE IF EXISTS aes_operating_mode CASCADE;
-- Create tables
CREATE TABLE IF NOT EXISTS aes_functional_area_type (
id integer,
name text,
point_symbol text,
decon_mode integer,
decon_time integer,
maint_mode integer,
maint_time integer,
medic_mode integer,
medic_time integer
);
CREATE TABLE IF NOT EXISTS aes_operating_mode (
id integer DEFAULT nextval(( 'aes.aes_operating_mode_id_seq'::text)::regclass),
name text
);
-- Create sequence(s)
CREATE SEQUENCE IF NOT EXISTS aes_operating_mode_id_seq INCREMENT 1 START 1 MINVALUE 1;
-- Create primary keys
ALTER TABLE IF EXISTS aes_functional_area_type ADD CONSTRAINT PK_aes_functional_area_type_id PRIMARY KEY (id);
ALTER TABLE IF EXISTS aes_operating_mode ADD CONSTRAINT PK_aes_operating_mode_id PRIMARY KEY (id);
-- Create foreign keys
ALTER TABLE aes_functional_area_type ADD CONSTRAINT FK_aes_functional_area_type_decon_mode_aes_operating_mode_id FOREIGN KEY (decon_mode) REFERENCES aes_operating_mode (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE aes_functional_area_type ADD CONSTRAINT FK_aes_functional_area_type_maint_mode_aes_operating_mode_id FOREIGN KEY (maint_mode) REFERENCES aes_operating_mode (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE aes_functional_area_type ADD CONSTRAINT FK_aes_functional_area_type_medic_mode_aes_operating_mode_id FOREIGN KEY (medic_mode) REFERENCES aes_operating_mode (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- Inserts for static data i.e. enums
INSERT INTO aes_operating_mode (id, name) VALUES (-1, 'OmNotAvailable');
INSERT INTO aes_operating_mode (id, name) VALUES (0, 'OmNotUsed');
INSERT INTO aes_operating_mode (id, name) VALUES (1, 'OmObserver');
INSERT INTO aes_operating_mode (id, name) VALUES (2, 'OmWaitingTime');
INSERT INTO aes.aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(0, 'Functional Area', '', 0, 0, 0, 0, 0, 0);
INSERT INTO aes.aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(1, 'Casualty Collection Point', 'AP6D|CMPL|10012500003205000000', -1, 0, -1, 0, 2, 120); -- Verwundetensammelstelle, APP: 320500
INSERT INTO aes.aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(2, 'Medical Evacuation Pickup Point', 'AP6D|CMPL|10012500003211000000', -1, 0, -1, 0, 2, 90); -- Landezone, App: 321100
INSERT INTO aes.aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(3, 'Medical Treatment Facility, Cat. 1', 'AP6D|CMPL|10011000001614004200', -1, 0, -1, 0, 2, 60); -- Rettungsstation, APP: 161400/42/00
INSERT INTO aes.aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(4, 'Medical Treatment Facility, Cat. 3', 'AP6D|CMPL|10011000001614004400', -1, 0, -1, 0, 2, 30); -- Einsatzlazarett, APP: 161400/44/00
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'FunctionalAreaType', 'Functional Area', 'Generic Functional Area');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'FunctionalAreaType', 'Casualty Collection Point', 'Casualty Collection Point');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'FunctionalAreaType', 'Medical Evacuation Pickup Point', 'Medical Evacuation Pickup Point');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'FunctionalAreaType', 'Medical Treatment Facility, Cat. 1', 'Medical Treatment Facility, Cat. 1');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'FunctionalAreaType', 'Medical Treatment Facility, Cat. 3', 'Medical Treatment Facility, Cat. 3');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('de_DE', 'name', 'FunctionalAreaType', 'Functional Area', 'Allgemeiner Funktionsraum');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('de_DE', 'name', 'FunctionalAreaType', 'Casualty Collection Point', 'Verwundetensammelstelle');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('de_DE', 'name', 'FunctionalAreaType', 'Medical Evacuation Pickup Point', 'MedEvac Landezone');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('de_DE', 'name', 'FunctionalAreaType', 'Medical Treatment Facility, Cat. 1', 'Einsatzlazarett');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('de_DE', 'name', 'FunctionalAreaType', 'Medical Treatment Facility, Cat. 3', 'Rettungsstation');
--
-- FOREACH Exercise BEGIN
--
SET SEARCH_PATH TO ex_NN, PUBLIC;
CREATE TABLE IF NOT EXISTS aes_functional_area_type (
id integer,
name text,
point_symbol text,
decon_mode integer,
decon_time integer,
maint_mode integer,
maint_time integer,
medic_mode integer,
medic_time integer
);
ALTER TABLE IF EXISTS aes_functional_area_type ADD CONSTRAINT PK_aes_functional_area_type_id PRIMARY KEY (id);
ALTER TABLE aes_functional_area_type OWNER TO ets_ex_NN;
ALTER TABLE aes_functional_area ADD COLUMN functional_area_type_id integer DEFAULT 0;
INSERT INTO aes_operating_mode (id, name) VALUES (-1, 'OmNotAvailable');
INSERT INTO aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(0, 'Functional Area', '', 0, 0, 0, 0, 0, 0);
INSERT INTO aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(1, 'Casualty Collection Point', 'AP6D|CMPL|10012500003205000000', -1, 0, -1, 0, 2, 120); -- Verwundetensammelstelle, APP: 320500
INSERT INTO aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(2, 'Medical Evacuation Pickup Point', 'AP6D|CMPL|10012500003211000000', -1, 0, -1, 0, 2, 90); -- Landezone, App: 321100
INSERT INTO aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(3, 'Medical Treatment Facility, Cat. 1', 'AP6D|CMPL|10011000001614004200', -1, 0, -1, 0, 2, 60); -- Rettungsstation, APP: 161400/42/00
INSERT INTO aes_functional_area_type(id, name, point_symbol, decon_mode, decon_time, maint_mode, maint_time, medic_mode, medic_time)
VALUES(4, 'Medical Treatment Facility, Cat. 3', 'AP6D|CMPL|10011000001614004400', -1, 0, -1, 0, 2, 30); -- Einsatzlazarett, APP: 161400/44/00
ALTER TABLE aes_functional_area ADD CONSTRAINT FK_aes_functional_area_functional_area_type_id_aes_functional_a FOREIGN KEY (functional_area_type_id) REFERENCES aes_functional_area_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- NEW
ALTER TABLE aes_functional_area_type OWNER TO ets_ex_NN;
-- /NEW
ALTER TABLE rec_functional_area ADD COLUMN functional_area_type_id integer DEFAULT 0;
DROP VIEW IF EXISTS aes_functional_area_view;
CREATE OR REPLACE VIEW aes_functional_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_functional_area.entity_id AS entity_id, aes_functional_area.point_symbol AS point_symbol, aes_functional_area.position_x AS position_x, aes_functional_area.position_y AS position_y, aes_functional_area.width AS width, aes_functional_area.length AS length, aes_functional_area.functional_area_type_id AS functional_area_type_id, aes_functional_area.decon_mode AS decon_mode, aes_functional_area.decon_time AS decon_time, aes_functional_area.maint_mode AS maint_mode, aes_functional_area.maint_time AS maint_time, aes_functional_area.medic_mode AS medic_mode, aes_functional_area.medic_time AS medic_time, aes_functional_area.id AS aes_functional_area_id
FROM aes_functional_area, aes_entity
WHERE aes_entity.id = aes_functional_area.entity_id;
ALTER VIEW aes_functional_area_view OWNER TO ets_ex_NN;
--
-- FOREACH Exercise END
--
--
-- End of
-- NLDEVCTRL-682, AES: FunctionalAreaTypes, Achtung: Übungsabhängige Änderungen unten dabei! - 03.11.2020
--
--
-- DIE FOLGENDEN ANWEISUNGEN SIND FÜR ÜBUNG 68 UND 70 gemacht worden. Diers, 06.01.2021 (Ja, ein Feiertag in SA)
--
-- PPM: PVSAN recording tables (2020.11.06)
SET SEARCH_PATH to ex_NN;
ALTER TABLE rec_participant_sanitary_material_stock_report ADD COLUMN originator_equipment_number INTEGER;
ALTER TABLE rec_participant_sanitary_material_stock_report ADD COLUMN qualification INTEGER;
ALTER TABLE rec_participant_sanitation ADD COLUMN procedures_taken INTEGER;
ALTER TABLE rec_participant_sanitation ADD COLUMN procedures_needed INTEGER;
ALTER TABLE rec_sanitation ADD COLUMN data_originator_equipment_number INTEGER;
ALTER TABLE rec_sanitation ADD COLUMN data_qualification INTEGER;
ALTER TABLE rec_sanitation ADD COLUMN data_sanitation_procedures_taken INTEGER;
ALTER TABLE rec_sanitation ADD COLUMN data_sanitation_procedures_needed INTEGER;
-- REP: reports PVSAN (2020.11.11)
SET SEARCH_PATH TO ex_NN, PUBLIC;
ALTER TABLE rep_treatment_data ADD COLUMN position_x_m DOUBLE PRECISION;
ALTER TABLE rep_treatment_data ADD COLUMN position_y_m DOUBLE PRECISION;
ALTER TABLE rep_treatment_result ADD COLUMN position_x_m DOUBLE PRECISION;
ALTER TABLE rep_treatment_result ADD COLUMN position_y_m DOUBLE PRECISION;
--
-- DIE VORAUSGEHENDEN ANWEISUNGEN SIND FÜR ÜBUNG 68 UND 70 gemacht worden. Diers, 06.01.2021 (Ja, ein Feiertag in SA)
--
-- EXM: Unique key on exercise name (SVN 52447, 2020.11.11)
ALTER TABLE IF EXISTS exm.exercise DROP CONSTRAINT IF EXISTS UQ_exercise_name CASCADE;
ALTER TABLE exm.exercise ADD CONSTRAINT UQ_exercise_name UNIQUE (name);
-- FOR MBA pg_dump/pg_restore (2020.11.12)
--
-- Only to be done by Iulana or Hanna (!)
-- psql postgres
CREATE DATABASE template2 WITH template template0;
-- psql template2
DROP SCHEMA public;
-- PDM: SanitationMaterial (2020.11.13)
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (1, 'Tourniquet');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (2, 'Mullbinde, imprägniert');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (3, 'Binde, elastisch');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (4, 'Verbandmull, absorbierend');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (5, 'Verband, offene Brustverletzung');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (6, 'Verbandtuch, Baumwolle');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (7, 'Verbandpäckchen, Brandwunde');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (8, 'Kompresse und Binde');
--UPDATE pdm.pdm_sanitation_material SET description = name;
ALTER SEQUENCE pdm.pdm_sanitation_material_id_seq RESTART WITH 9;
-- Sanitation Materials translation
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Tourniquet', 'Tourniquet');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Mullbinde, imprägniert', 'Gauze bandage, impregnated');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Binde, elastisch', 'Bandage, elastic');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Verbandmull, absorbierend', 'Gauze bandage, absorbent');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Verband, offene Brustverletzung', 'Bandage, open chest injury');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Verbandtuch, Baumwolle', 'Bandage cloth, cotton');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Verbandpäckchen, Brandwunde', 'Compression bandage, burn injury');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation)
VALUES ('en_GB', 'name', 'SanitationMaterial', 'Kompresse und Binde', 'Compress and bandage');
-- REP: 2 new columns in rep_charge_administration (SVN 52483 - 2020.11.18)
SET SEARCH_PATH TO ex_68;
ALTER TABLE rep_charge_administration ADD COLUMN charge_planned INTEGER;
ALTER TABLE rep_charge_administration ADD COLUMN charge_available INTEGER;
-- HGR filter IED (only 48, 49, 68, 69, 70 are IEDs - 2020.11.20);
-- DONE in GUEZ on 2021.01.11 by IO
delete from pdm.pdm_event_filter_hgr_mine_search where hgr_mine_search_filter_type_id = 4 and charge_type_id = 52;
-- PDM charge types 35x -> 21x
-- DONE in GUEZ FOR pdm, ex_68, ex_70, ex_71 on 2021.01.11 (IO)
UPDATE pdm.pdm_event_filter_hgr_mine_search SET charge_type_id = charge_type_id - 140 WHERE charge_type_id BETWEEN 350 AND 360;
DELETE FROM pdm.pdm_charge_type WHERE id BETWEEN 350 AND 360;
-- add foreign key for rec_mine_area in ex_NN
SET SEARCH_PATH TO ex_NN;
UPDATE rec_mine_area SET charge_type_id = charge_type_id - 140 WHERE charge_type_id BETWEEN 350 AND 360;
ALTER TABLE IF EXISTS rec_mine_area DROP CONSTRAINT IF EXISTS FK_rec_mine_area_pdm_charge_type CASCADE;
ALTER TABLE IF EXISTS rec_mine_area
ADD CONSTRAINT FK_rec_mine_area_pdm_charge_type
FOREIGN KEY (charge_type_id) REFERENCES pdm.pdm_charge_type (id) ON UPDATE CASCADE ON DELETE CASCADE;
-- PDM duplicate codes (106 = Minenkorridor, jetzt 315, 97 = 120 mm HE, jetzt 3)
-- DONE in GUEZ on 2021.01.11 by IO
DELETE FROM pdm.pdm_charge_type WHERE id = 106;
DELETE FROM pdm.pdm_charge_type WHERE id = 97;
-- PDM: missing records from pdm.pdm_gear_type_charge_type
-- DONE in GUEZ on 2021.01.11 by IO
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (501, 211, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (601, 211, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (501, 212, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (601, 212, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (501, 213, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (601, 213, NULL);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (101, 315, NULL);
-- Nebel charge type renames and recreate for Mrs (04.01.2021)
-- DONE in GUEZ on 2021.01.12 by IO
UPDATE pdm.pdm_charge_type set name='Nebel Art', short_name='Nebel Art' where id = 375;
UPDATE pdm.pdm_translation SET key='Nebel Art', translation='Smoke Art' WHERE id IN (627, 628);
INSERT INTO pdm.pdm_charge_type (id, predefined_name, name, short_name, properties, dis_entity, charge_legacy_id) VALUES (385, NULL, 'Nebel Mrs', 'Nebel Mrs', '{"impactRadius":25, "impactEdgeLength":25, "isSmoke":true}', NULL, 5);
INSERT INTO pdm.pdm_gear_type_charge_type (gear_type_id, charge_type_id, max_range) VALUES (801, 385, NULL);
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation) VALUES ('en_GB', 'name', 'ChargeType', 'Nebel Mrs', 'Smoke Mrt');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation) VALUES ('en_GB', 'short_name', 'ChargeType', 'Nebel Mrs', 'Smoke Mrt');
INSERT INTO pdm.pdm_building_charge_effect (difcue_light, charge_type_id, difcue_pyro, penetration_factor, destructive_factor) VALUES (true, 375, false, 0, 0 );
INSERT INTO pdm.pdm_building_charge_effect (difcue_light, charge_type_id, difcue_pyro, penetration_factor, destructive_factor) VALUES (true, 385, false, 0, 0 );
-- FLM: fix invalid folders in tree structure (which leads to improper deleting of exercise folders when deleting an exercise)
-- DONE in GUEZ on 2021.01.12 by IO
UPDATE flm.flm_file_content SET folder_id = 6 WHERE folder_id = 961;
DELETE FROM flm.flm_folder WHERE cardinality(path) = 1 AND parent_id > 0;
DELETE FROM flm.flm_folder WHERE id = 961;
-- PDM: translations short_name -> shortName, fuze -> Fuze
-- DONE in GUEZ on 2021.01.13 by IO
UPDATE pdm.pdm_translation SET disambiguation = 'shortName' WHERE disambiguation = 'short_name';
-- UPDATE 110
UPDATE pdm.pdm_translation SET translation = 'HE / Impact Fuze' WHERE context = 'ChargeType' AND disambiguation = 'shortName' AND iso_code = 'en_GB' AND key = 'HE / AZ';
-- UPDATE 1
UPDATE pdm.pdm_translation SET translation = 'HE / VT Fuze' WHERE context = 'ChargeType' AND disambiguation = 'shortName' AND iso_code = 'en_GB' AND key = 'HE / Annz';
-- UPDATE 1
UPDATE pdm.pdm_translation SET translation = 'Influence Fuze' WHERE context = 'ChargeType' AND iso_code = 'en_GB' AND key = 'AZ';
-- UPDATE 2
UPDATE pdm.pdm_translation SET translation = 'Proximity Fuze' WHERE context = 'ChargeType' AND iso_code = 'en_GB' AND key = 'Annz';
-- UPDATE 2
-- REP: new unique key on rep_firings_data (if needed, not mandatory)
SET SEARCH_PATH TO ex_NN;
ALTER TABLE IF EXISTS rep_firings_data DROP CONSTRAINT IF EXISTS UQ_rep_firings_data_party_id_event_time_participant_id_particip CASCADE;
ALTER TABLE rep_firings_data ADD CONSTRAINT UQ_rep_firings_data_party_id_event_time_participant_id_particip UNIQUE (party_id, event_time, participant_id, participant_type_id, charge_type_id, vulnerability_state);
-- REP: drop foreign key from firings_data and firings_result on charge_type_id
SET SEARCH_PATH TO ex_NN;
ALTER TABLE IF EXISTS rep_firings_data DROP CONSTRAINT IF EXISTS FK_rep_firings_data_pdm_charge_type CASCADE;
ALTER TABLE IF EXISTS rep_firings_result DROP CONSTRAINT IF EXISTS FK_rep_firings_result_pdm_charge_type CASCADE;
-- ISM: create view to save barcodes as csv AS user POSTGRES (IO 2021.03.23)
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) 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;
-- PDM: update values in pdm_building_charge_effect (IO 2021.03.23) (Excel , CSV needed to be updated too!)
DELETE FROM pdm.pdm_building_charge_effect;
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (1, 1, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (2, 2, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (3, 3, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (4, 4, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (5, 5, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (6, 6, 10, 10, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (7, 7, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (8, 8, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (9, 9, 10, 10, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (10, 10, 5, 5, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (11, 11, 0, 0, 6, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (12, 12, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (13, 13, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (14, 14, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (15, 15, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (16, 16, 150, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (17, 17, 5, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (18, 18, 5, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (19, 19, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (20, 20, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (21, 21, 5, 5, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (22, 22, 5, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (23, 23, 0, 0, 6, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (24, 24, 150, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (25, 25, 10, 50, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (26, 26, 10, 10, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (27, 27, 10, 0, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (28, 28, 10, 1, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (29, 29, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (30, 30, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (31, 31, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (32, 32, 10, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (33, 33, 1, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (34, 34, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (35, 35, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (36, 36, 10, 0, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (37, 37, 5, 5, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (38, 38, 10, 5, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (39, 39, 10, 5, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (40, 40, 5, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (41, 41, 5, 0, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (42, 42, 10, 0, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (43, 43, 1, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (44, 44, 5, 5, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (45, 45, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (46, 48, 10, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (47, 49, 50, 10, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (48, 50, 10, 5000, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (49, 51, 0, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (50, 52, 5000, 5000, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (51, 53, 10, 5, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (52, 54, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (53, 55, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (54, 56, 1, 1, 6, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (55, 57, 1, 1, 6, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (56, 58, 1, 1, 6, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (57, 59, 1, 1, 6, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (58, 60, 10, 150, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (59, 61, 10, 150, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (60, 62, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (61, 63, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (62, 64, 1, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (63, 65, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (64, 66, 5, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (65, 67, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (66, 68, 10, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (67, 69, 50, 10, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (68, 70, 100, 100, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (69, 71, 300, 300, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (70, 72, 1, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (71, 73, 10, 10, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (72, 74, 10, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (73, 75, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (74, 76, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (75, 77, 5, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (76, 78, 0, 0, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (77, 79, 300, 300, NULL, false, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (78, 371, 100, 150, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (79, 372, 50, 100, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (80, 373, 50, 50, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (81, 374, 0, 0, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (82, 375, 0, 0, 4, true, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (83, 381, 100, 150, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (84, 382, 10, 5, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (85, 385, 0, 0, 4, true, false);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (86, 471, 10, 5, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (87, 472, 50, 100, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (88, 474, 50, 100, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (89, 476, 50, 100, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (90, 482, 100, 200, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (91, 2001, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (92, 2002, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (93, 2003, 1, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (94, 2004, 1, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (95, 2005, 1, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (96, 2006, 1, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (97, 2007, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (98, 2008, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (99, 2009, 1, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (100, 2010, 1, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (101, 2011, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (102, 2012, 5, 5, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (103, 2013, 1, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (104, 2014, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (105, 2015, 10, 10, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (106, 2016, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (107, 2017, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (108, 2018, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (109, 2019, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (110, 2020, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (111, 2021, 5, 0, 1, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (112, 2022, 5, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (113, 2023, 5, 1, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (114, 2024, 0, 0, 19, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (115, 2025, 5, 0, 19, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (116, 2026, 10, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (117, 2027, 5, 0, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (118, 2028, 10, 5, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (119, 2029, 10, 5, 2, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (120, 2030, 10, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (121, 2031, 5, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (122, 2032, 25, 25, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (123, 2033, 25, 25, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (124, 2034, 5, 0, 12, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (125, 2035, 15, 15, 12, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (126, 2036, 15, 15, 12, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (127, 2037, 10, 0, 12, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (128, 2038, 10, 5, 12, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (129, 2039, 5, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (130, 2040, 10, 0, 12, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (131, 2041, 10, 5, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (132, 2042, 10, 5, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (133, 2043, 5, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (134, 2044, 10, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (135, 2045, 10, 5, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (136, 2046, 10, 5, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (137, 2047, 10, 5, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (138, 2048, 10, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (139, 2049, 10, 5, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (140, 2050, 10, 0, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (141, 2051, 10, 10, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (142, 2052, 10, 10, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (143, 2053, 25, 25, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (144, 2054, 10, 5, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (145, 2055, 150, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (146, 2056, 150, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (147, 2057, 150, 150, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (148, 2058, 150, 150, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (149, 2059, 150, 300, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (150, 2060, 5, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (151, 2061, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (152, 2062, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (153, 2063, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (154, 2064, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (155, 2065, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (156, 2066, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (157, 2067, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (158, 2068, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (159, 2069, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (160, 2070, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (161, 2071, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (162, 2072, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (163, 2073, 10, 10, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (164, 2074, 10, 10, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (165, 2075, 10, 50, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (166, 2076, 10, 10, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (167, 2077, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (168, 2078, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (169, 2079, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (170, 2080, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (171, 2081, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (172, 2082, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (173, 2083, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (174, 2084, 10, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (175, 2085, 10, 0, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (176, 2086, 10, 0, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (177, 2087, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (178, 2088, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (179, 2089, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (180, 2090, 150, 150, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (181, 2091, 150, 1000, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (182, 2092, 150, 100, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (183, 2093, 150, 300, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (184, 2094, 150, 300, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (185, 2095, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (186, 2096, 10, 10, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (187, 2097, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (188, 2098, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (189, 2099, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (190, 2100, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (191, 2101, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (192, 2102, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (193, 2103, 150, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (194, 2104, 150, 1000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (195, 2105, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (196, 2106, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (197, 2107, 300, 1000, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (198, 2108, 300, 1000, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (199, 2109, 300, 1000, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (200, 2110, 300, 1000, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (201, 2111, 300, 1000, 4, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (202, 2112, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (203, 2113, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (204, 2114, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (205, 2115, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (206, 2116, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (207, 2117, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (208, 2118, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (209, 2119, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (210, 2120, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (211, 2121, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (212, 2122, 10, 10, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (213, 2123, 10, 10, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (214, 2124, 100, 200, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (215, 2125, 300, 1000, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (216, 2126, 300, 1000, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (217, 2127, 300, 1000, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (218, 2128, 300, 1000, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (219, 2129, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (220, 2130, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (221, 2131, 150, 1000, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (222, 2132, 150, 300, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (223, 2133, 150, 300, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (224, 2134, 150, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (225, 2135, 150, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (226, 2136, 300, 300, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (227, 2137, 300, 300, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (228, 2138, 10, 10, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (229, 2139, 150, 300, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (230, 2140, 150, 300, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (231, 2141, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (232, 2142, 10, 150, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (233, 2143, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (234, 2144, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (235, 2145, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (236, 2146, 10, 50, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (237, 2147, 10, 50, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (238, 2148, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (239, 2149, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (240, 2150, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (241, 2151, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (242, 2152, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (243, 2153, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (244, 2154, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (245, 2155, 150, 150, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (246, 2156, 150, 150, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (247, 2157, 150, 150, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (248, 2158, 150, 150, 18, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (249, 2159, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (250, 2160, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (251, 2161, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (252, 2162, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (253, 2163, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (254, 2164, 150, 300, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (255, 2165, 150, 1000, 14, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (256, 2166, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (257, 2167, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (258, 2168, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (259, 2169, 0, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (260, 2170, 10, 0, 3, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (261, 2171, 150, 10, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (262, 2172, 300, 300, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (263, 2173, 5000, 5000, 5, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (264, 2174, 150, 150, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (265, 2175, 5, 0, 17, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (266, 2176, 10, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (267, 2177, 1, 0, 11, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (268, 2178, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (269, 2179, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (270, 2180, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (271, 2181, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (272, 2182, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (273, 2183, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (274, 2184, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (275, 2185, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (276, 2186, 5000, 5000, 10, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (277, 2187, 0, 0, NULL, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (278, 2188, 10, 10, 17, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (279, 2189, 10, 0, 9, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (280, 2190, 10, 0, 9, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (281, 2191, 5, 0, 13, true, true);
INSERT INTO pdm.pdm_building_charge_effect (id, charge_type_id, destructive_factor, penetration_factor, hit_sound, difcue_light, difcue_pyro) VALUES (282, 2192, 5, 0, 13, true, true);
ALTER SEQUENCE pdm.pdm_building_charge_effect_id_seq RESTART WITH 283;
2021.03.29
-- PDM: Newer Sanitation procedures 2021.05.18
DELETE FROM pdm_sanitation_procedures;
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (0, 'None');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (1, 'ApplTourniquet');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (2, 'PressureDress');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (3, 'Hemostyptics');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (4, 'ManCompression');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (5, 'Tamponade');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (6, 'JawThrustMan');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (7, 'WendlTube');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (8, 'RecPosition');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (9, 'HeadOfBedEle');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (10, 'GuedelTube');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (11, 'LarynxTube');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (12, 'EmergencyCric');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (13, 'TrachealTube');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (14, 'ChestSeal');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (15, 'OxygenDelivery');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (16, 'ChestTube');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (17, 'AsVentilation');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (18, 'ShockPosition');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (19, 'IVAccess');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (20, 'IOAccess');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (21, 'FluidSubstitut');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (22, 'AssessmAwaren');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (23, 'DeterminCGS');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (24, 'RecovPosition');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (25, 'Positioning');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (26, 'VitSignsCheck');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (27, 'UniversalRail');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (28, 'BleedingControl');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (29, 'RescueBlanket');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (30, 'Blizzard');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (31, 'TreatmBurnings');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (32, 'GenWoundCare');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (33, 'Analgesics');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (34, 'Antibiotics');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (35, 'TranesamicAcid');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (36, 'Hypnotics');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (37, 'RingersSolution');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (38, 'MuscleRelaxant');
INSERT INTO pdm_sanitation_procedures (id, name) VALUES (99, 'Unknown');
-- PDM: update 1.02 for Guez (NLDEVCTRL-891)
SET SEARCH_PATH TO pdm;
-- resolve duplicate id 459369 -> 459376
UPDATE pdm_vulnerability_kind SET ta_vulnerability_kind = 459376 WHERE player_type_class_id = 3 AND ta_vulnerability_kind = 459369 AND vulnerability_class_id = 5 AND name LIKE 'Sekund%';
-- 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);
-- PDM: New sanitation materials (IO, 2021.05.18)
-- do not delete because of FK
--DELETE FROM pdm.pdm_sanitation_material;
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (1, 'Tourniquet');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (2, 'Notverband');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (3, 'QuikClot-Combatgauze');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (4, 'AMD Verband');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (5, 'Wendl-Tubus');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (6, 'Guedel-Tubus');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (7, 'Larynx-Tubus');
--INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (8, 'Not-Koniotomie-Set');
-- old ids, new names
UPDATE pdm.pdm_sanitation_material SET name = 'Tourniquet' WHERE id = 1;
UPDATE pdm.pdm_sanitation_material SET name = 'Notverband' WHERE id = 2;
UPDATE pdm.pdm_sanitation_material SET name = 'QuikClot-Combatgauze' WHERE id = 3;
UPDATE pdm.pdm_sanitation_material SET name = 'AMD Verband' WHERE id = 4;
UPDATE pdm.pdm_sanitation_material SET name = 'Wendl-Tubus' WHERE id = 5;
UPDATE pdm.pdm_sanitation_material SET name = 'Guedel-Tubus' WHERE id = 6;
UPDATE pdm.pdm_sanitation_material SET name = 'Larynx-Tubus' WHERE id = 7;
UPDATE pdm.pdm_sanitation_material SET name = 'Not-Koniotomie-Set' WHERE id = 8;
-- New material ids
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (9, 'Endotracheal-Tubus');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (10, 'Thoraxpflaster');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (11, 'Dekompressionsnadel');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (12, 'Beutelmaske');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (13, 'i. v. Zugang-Set');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (14, 'i. o. Zugang-Set');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (15, 'Voll-Elektrolytlösung');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (16, 'Dreiecktuch');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (17, 'Universalschiene');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (18, 'Rettungsdecke');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (19, 'Blizzard');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (20, 'Brandwundenverbandpäckchen');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (21, 'Allg. Wundversorgung');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (22, 'Morphin-Autoinjektor');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (23, 'Antibiotikum');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (24, 'Tranexamsäure');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (25, 'Hypnotikum');
INSERT INTO pdm.pdm_sanitation_material (id, name) VALUES (26, 'Muskelrelaxans');
--UPDATE pdm.pdm_sanitation_material SET description = name;
ALTER SEQUENCE pdm.pdm_sanitation_material_id_seq RESTART WITH 27;
-- PDM: update PDM Gear Type for Puma (2021.08.09) - Update 1.19
SET SEARCH_PATH TO pdm;
INSERT INTO pdm.pdm_gear_type (id, tas_code, name, gear_class_id) VALUES (1082, 82, 'MK 30', 10);
INSERT INTO pdm.pdm_gear_type (id, tas_code, name, gear_class_id) VALUES (1084, 84, 'Koax MG', 10);
INSERT INTO pdm.pdm_gear_type (id, tas_code, name, gear_class_id) VALUES (1087, 87, 'MELLS', 10);
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation) VALUES ('en_GB', 'name', 'GearType', 'MK 30', 'MC 30');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation) VALUES ('en_GB', 'name', 'GearType', 'Koax MG', 'Coax MG');
INSERT INTO pdm.pdm_translation (iso_code, disambiguation, context, key, translation) VALUES ('en_GB', 'name', 'GearType', 'MELLS', 'MELLS');
INSERT INTO pdm.pdm_can_component_string (name, bit_mask, can_device_id, sub_device_id) VALUES ('AGDUS aktiv', 0, 31, -1);
-- PDM: Puma VBA changes (2021.08.26) - Update 1.24
SET SEARCH_PATH TO pdm;
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063233, 4, 'Funk defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063234, 4, 'Funkantenne defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063235, 4, 'Funktion defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063236, 4, 'Aufbau defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063237, 4, 'Ladung zerstört');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063238, 4, 'Personal ausgefallen');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063239, 4, 'Turm beschädigt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063240, 4, 'Ausfall MELLS Anbausatz');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063241, 4, 'Kette defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063242, 4, 'Motor defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063243, 4, 'Kettenantrieb defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063244, 4, 'Periskop defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063245, 4, 'Turmantrieb defekt');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063246, 4, 'Hauptwaffe ausgefallen');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063247, 4, 'Keine Wirkung');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063248, 4, 'Reaktiv GÜZ');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063249, 4, 'Reaktiv SR');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063250, 4, 'Totalausfall');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063251, 4, 'Übungspause');
INSERT INTO pdm.pdm_vulnerability_kind (player_type_class_id, ta_vulnerability_kind, vulnerability_class_id, name) VALUES (4, 4063252, 4, 'Übungsunterbrechung');