Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+121
@@ -0,0 +1,121 @@
|
||||
-- $Id: 2.95_guez_pdm_charge_type_pzabwmiv.upd 61535 2024-01-25 08:18:08Z rathje $
|
||||
-- $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Tools/DBUpdate/updates/guez/2.95_guez_pdm_charge_type_pzabwmiv.upd $
|
||||
-- $Author: rathje $
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- INFO: [ETBUAS-77] New Tables ppm_mission_*
|
||||
-- PROJECT: SWP
|
||||
-- DATE: 2025-08-04
|
||||
-- VERSION: 2.124
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
-- GLOBAL: NONE;
|
||||
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
|
||||
-- EXERCISE: ALL;
|
||||
BEGIN;
|
||||
|
||||
-- drop
|
||||
DROP SEQUENCE IF EXISTS ppm_mission_action_id_seq;
|
||||
DROP SEQUENCE IF EXISTS ppm_mission_item_id_seq;
|
||||
DROP SEQUENCE IF EXISTS ppm_mission_plan_id_seq;
|
||||
DROP SEQUENCE IF EXISTS rec_mission_plan_rec_id_seq;
|
||||
|
||||
DROP TABLE IF EXISTS ppm_mission_action CASCADE;
|
||||
DROP TABLE IF EXISTS ppm_mission_action_type CASCADE;
|
||||
DROP TABLE IF EXISTS ppm_mission_item CASCADE;
|
||||
DROP TABLE IF EXISTS ppm_mission_plan CASCADE;
|
||||
DROP TABLE IF EXISTS rec_mission_plan CASCADE;
|
||||
|
||||
-- create tables
|
||||
CREATE TABLE IF NOT EXISTS ppm_mission_action (
|
||||
id integer DEFAULT nextval(( 'ppm_mission_action_id_seq'::text)::regclass),
|
||||
element_number integer, -- Sorting of items that belong to the same MissionItem
|
||||
name text,
|
||||
duration integer,
|
||||
mission_action_type_id integer,
|
||||
properties jsonb,
|
||||
mission_item_id integer,
|
||||
fulfilled bigint -- Timestamp when the action was fulfilled
|
||||
);
|
||||
COMMENT ON COLUMN ppm_mission_action.element_number IS 'Sorting of items that belong to the same MissionItem';
|
||||
COMMENT ON COLUMN ppm_mission_action.fulfilled IS 'Timestamp when the action was fulfilled';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ppm_mission_action_type (
|
||||
id integer,
|
||||
name text
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ppm_mission_item (
|
||||
id integer DEFAULT nextval(( 'ppm_mission_item_id_seq'::text)::regclass),
|
||||
element_number integer, -- Sorting of items within a mission plan
|
||||
name text,
|
||||
location_x double precision,
|
||||
location_y double precision,
|
||||
location_z double precision,
|
||||
time_offset integer,
|
||||
mission_plan_id integer
|
||||
);
|
||||
COMMENT ON COLUMN ppm_mission_item.element_number IS 'Sorting of items within a mission plan';
|
||||
COMMENT ON COLUMN ppm_mission_item.element_number IS 'Sorting of items within a mission plan';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ppm_mission_plan (
|
||||
id integer DEFAULT nextval(( 'ppm_mission_plan_id_seq'::text)::regclass),
|
||||
name text,
|
||||
mission_start bigint,
|
||||
participant_id integer,
|
||||
jump_to_start boolean,
|
||||
repeat boolean,
|
||||
aborted boolean
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rec_mission_plan (
|
||||
fulfilled bigint,
|
||||
id integer,
|
||||
items jsonb,
|
||||
items_fulfilled integer,
|
||||
jump_to_start boolean,
|
||||
mission_start bigint,
|
||||
name text,
|
||||
participant_id integer,
|
||||
properties text,
|
||||
repeat boolean,
|
||||
aborted boolean,
|
||||
sample_time bigint,
|
||||
rec_id bigint DEFAULT nextval(( 'rec_mission_plan_rec_id_seq'::text)::regclass),
|
||||
dds_is_alive boolean DEFAULT true,
|
||||
insert_time bigint DEFAULT (extract(epoch from now()) * 1000)
|
||||
);
|
||||
COMMENT ON TABLE rec_mission_plan IS 'recorded data for topic MissionPlan';
|
||||
|
||||
-- create sequences
|
||||
CREATE SEQUENCE IF NOT EXISTS ppm_mission_action_id_seq INCREMENT 1 START 1 MINVALUE 1;
|
||||
CREATE SEQUENCE IF NOT EXISTS ppm_mission_item_id_seq INCREMENT 1 START 1 MINVALUE 1;
|
||||
CREATE SEQUENCE IF NOT EXISTS ppm_mission_plan_id_seq INCREMENT 1 START 1 MINVALUE 1;
|
||||
CREATE SEQUENCE IF NOT EXISTS rec_mission_plan_rec_id_seq INCREMENT 1 START 1 MINVALUE 1;
|
||||
|
||||
ALTER TABLE IF EXISTS ppm_mission_action ADD CONSTRAINT PK_ppm_mission_action_id PRIMARY KEY (id);
|
||||
ALTER TABLE IF EXISTS ppm_mission_action_type ADD CONSTRAINT PK_ppm_mission_action_type_id PRIMARY KEY (id);
|
||||
ALTER TABLE IF EXISTS ppm_mission_item ADD CONSTRAINT PK_ppm_mission_item_id PRIMARY KEY (id);
|
||||
ALTER TABLE IF EXISTS ppm_mission_plan ADD CONSTRAINT PK_ppm_mission_plan_id PRIMARY KEY (id);
|
||||
ALTER TABLE IF EXISTS rec_mission_plan ADD CONSTRAINT PK_rec_mission_plan_rec_id PRIMARY KEY (rec_id);
|
||||
|
||||
ALTER TABLE ppm_mission_action ADD CONSTRAINT FK_ppm_mission_action_mission_action_type_id_ppm_mission_action
|
||||
FOREIGN KEY (mission_action_type_id) REFERENCES ppm_mission_action_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE ppm_mission_action ADD CONSTRAINT FK_ppm_mission_action_mission_item_id_ppm_mission_item_id
|
||||
FOREIGN KEY (mission_item_id) REFERENCES ppm_mission_item (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE ppm_mission_item ADD CONSTRAINT FK_ppm_mission_item_mission_plan_id_ppm_mission_plan_id
|
||||
FOREIGN KEY (mission_plan_id) REFERENCES ppm_mission_plan (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
INSERT INTO ppm_mission_action_type (id, name) VALUES (0, 'Undefined');
|
||||
INSERT INTO ppm_mission_action_type (id, name) VALUES (1, 'MoveTo');
|
||||
INSERT INTO ppm_mission_action_type (id, name) VALUES (2, 'Loiter');
|
||||
INSERT INTO ppm_mission_action_type (id, name) VALUES (3, 'Attack');
|
||||
|
||||
CREATE INDEX IDX_rec_mission_plan_sample_time ON rec_mission_plan (sample_time);
|
||||
|
||||
|
||||
COMMIT;
|
||||
Reference in new issue
Block a user