Files
qt-migration-legatus/qt5-before/dlbo/Lts/Tests/DatabaseInitialisation/salchau_db_update.sql
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

63 lines
5.6 KiB
SQL

-- update cascade
SET SEARCH_PATH TO ism;
-- Drop tables/views/sequences/constraints
ALTER TABLE IF EXISTS ism_asset DROP CONSTRAINT IF EXISTS FK_ism_asset_mounting_point_type_id_ism_mounting_point_type_id CASCADE;
ALTER TABLE IF EXISTS ism_asset DROP CONSTRAINT IF EXISTS FK_ism_asset_asset_state_id_ism_asset_state_id CASCADE;
ALTER TABLE IF EXISTS ism_mounting_point_asset DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_asset_asset_id_ism_asset_id CASCADE;
ALTER TABLE IF EXISTS ism_mounting_point_asset DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_asset_structure_element_id_ism_structure_ CASCADE;
ALTER TABLE IF EXISTS ism_mounting_point_plan DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_plan_structure_element_id_ism_structure_e CASCADE;
ALTER TABLE IF EXISTS ism_mounting_point_plan DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_plan_mounting_point_schedule_id_ism_mount CASCADE;
ALTER TABLE IF EXISTS ism_mounting_point_schedule DROP CONSTRAINT IF EXISTS FK_ism_mounting_point_schedule_exercise_id_exercise_id CASCADE;
ALTER TABLE IF EXISTS ism_structure_element DROP CONSTRAINT IF EXISTS FK_ism_structure_element_structure_element_type_id_ism_structur CASCADE;
ALTER TABLE IF EXISTS ism_structure_element DROP CONSTRAINT IF EXISTS FK_ism_structure_element_mounting_point_type_id_ism_mounting_po CASCADE;
ALTER TABLE IF EXISTS ism_structure_element DROP CONSTRAINT IF EXISTS FK_ism_structure_element_main_structure_element_id_ism_main_str CASCADE;
ALTER TABLE IF EXISTS ism_structure_element_footprint DROP CONSTRAINT IF EXISTS FK_ism_structure_element_footprint_structure_element_id_ism_str CASCADE;
-- Create foreign keys
ALTER TABLE ism_asset ADD CONSTRAINT FK_ism_asset_mounting_point_type_id_ism_mounting_point_type_id FOREIGN KEY (mounting_point_type_id) REFERENCES ism_mounting_point_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_asset ADD CONSTRAINT FK_ism_asset_asset_state_id_ism_asset_state_id FOREIGN KEY (asset_state_id) REFERENCES ism_asset_state (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_mounting_point_asset ADD CONSTRAINT FK_ism_mounting_point_asset_asset_id_ism_asset_id FOREIGN KEY (asset_id) REFERENCES ism_asset (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_mounting_point_asset ADD CONSTRAINT FK_ism_mounting_point_asset_structure_element_id_ism_structure_ FOREIGN KEY (structure_element_id) REFERENCES ism_structure_element (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_mounting_point_plan ADD CONSTRAINT FK_ism_mounting_point_plan_structure_element_id_ism_structure_e FOREIGN KEY (structure_element_id) REFERENCES ism_structure_element (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_mounting_point_plan ADD CONSTRAINT FK_ism_mounting_point_plan_mounting_point_schedule_id_ism_mount FOREIGN KEY (mounting_point_schedule_id) REFERENCES ism_mounting_point_schedule (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_mounting_point_schedule ADD CONSTRAINT FK_ism_mounting_point_schedule_exercise_id_exercise_id FOREIGN KEY (exercise_id) REFERENCES exm.exercise (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_structure_element ADD CONSTRAINT FK_ism_structure_element_structure_element_type_id_ism_structur FOREIGN KEY (structure_element_type_id) REFERENCES ism_structure_element_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_structure_element ADD CONSTRAINT FK_ism_structure_element_mounting_point_type_id_ism_mounting_po FOREIGN KEY (mounting_point_type_id) REFERENCES ism_mounting_point_type (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_structure_element ADD CONSTRAINT FK_ism_structure_element_main_structure_element_id_ism_main_str FOREIGN KEY (main_structure_element_id) REFERENCES ism_main_structure_element (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE ism_structure_element_footprint ADD CONSTRAINT FK_ism_structure_element_footprint_structure_element_id_ism_str FOREIGN KEY (structure_element_id) REFERENCES ism_structure_element (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- update ids
UPDATE ism.ism_structure_element SET id = id + 60000;
UPDATE ism.ism_asset SET id = id + 3000;
UPDATE ism.ism_mounting_point_asset SET id = id + 3000;
UPDATE ism.ism_mounting_point_plan SET id = id + 40000;
UPDATE ism.ism_structure_element_footprint SET id = id + 4000;
-- delete unnecessary buildings and assets
DELETE FROM ism.ism_asset where id IN (SELECT asset_id FROM ism.ism_mounting_point_asset WHERE structure_element_id IN (SELECT id FROM ism.ism_structure_element WHERE main_structure_element_id < 300));
DELETE FROM ism.ism_main_structure_element WHERE id < 300;
-- pg_dump Salchau
pg_dump salchau -t ism.ism_main_structure_element -t ism.ism_structure_element -t ism.ism_asset -t ism.ism_mounting_point_asset -t ism.ism_mounting_point_plan -t ism.ism_structure_element_footprint --column-inserts --data-only > salchau.sql
-- delete old Salchau Gebaude und assets (Guez dump)
DELETE FROM ism.ism_asset where id IN (SELECT asset_id FROM ism.ism_mounting_point_asset WHERE structure_element_id IN (SELECT id FROM ism.ism_structure_element WHERE main_structure_element_id IN (724, 725, 726, 1121)));
DELETE FROM ism.ism_main_structure_element WHERE ID in (724, 725, 726, 1121);
-- re-import salchau buildings
psql guez -f salchau.sql
-- update sequences
ALTER SEQUENCE ism.ism_structure_element_id_seq RESTART WITH 62000;
ALTER SEQUENCE ism.ism_asset_id_seq RESTART WITH 5100;
ALTER SEQUENCE ism.ism_mounting_point_asset_id_seq RESTART WITH 3100;
ALTER SEQUENCE ism.ism_mounting_point_plan_id_seq RESTART WITH 41000;
ALTER SEQUENCE ism.ism_structure_element_footprint_id_seq RESTART WITH 4200;
ALTER SEQUENCE ism.ism_main_structure_element_id_seq RESTART WITH 20001;