bmc_hub/migrations/1041_seed_internal_case_customer.sql

23 lines
777 B
MySQL
Raw Permalink Normal View History

feat(planner): add overdue cases handling and improve case rendering - Introduced `overdueCases` state to track overdue cases in the planner. - Enhanced `loadCases` function to fetch and store overdue cases. - Updated `renderCases` to display overdue cases with appropriate labels. - Modified case card rendering to highlight overdue cases. fix(telefoni): ensure WebSocket connection on DOMContentLoaded - Adjusted WebSocket connection logic to handle cases where the script loads after DOMContentLoaded. test(tests): add tests for case creation and internal ticket handling - Added tests to ensure ticket creation commits all optional data. - Implemented tests for internal ticket creation, ensuring correct customer and user assignments. feat(migrations): add new tables for email configuration and case assignments - Created `email_connection_configurations` table for managing email settings. - Introduced `sag_case_assignees` table to handle individual case assignments. - Added `sag_case_details` table for structured case type details. - Updated existing case types to align with new templates and added support for internal tickets. fix(timetracking): allow manual time creation without case customer - Modified manual time creation to support entries without a customer. - Updated settlement options to recommend internal settlement for customerless time. feat(v4): enhance case detail template with new features - Added new features to the case detail template, including compact icons and inline relation creation. - Improved comment actions and time tracking functionalities.
2026-09-20 03:33:10 +02:00
-- Internal tickets have a fixed, canonical customer identity.
-- Never overwrite another customer if an installation already uses ID 8.
DO $$
DECLARE
existing_name TEXT;
BEGIN
SELECT name INTO existing_name FROM customers WHERE id = 8;
IF existing_name IS NULL THEN
INSERT INTO customers (id, name, email, email_domain, country, is_active)
VALUES (8, 'BMC Networks', 'info@bmcnetworks.dk', 'bmcnetworks.dk', 'DK', TRUE);
ELSIF LOWER(TRIM(existing_name)) <> LOWER('BMC Networks') THEN
RAISE EXCEPTION 'Customer ID 8 is already used by %, expected BMC Networks', existing_name;
END IF;
END $$;
SELECT setval(
pg_get_serial_sequence('customers', 'id'),
GREATEST((SELECT COALESCE(MAX(id), 1) FROM customers), 1),
TRUE
);