CRITICAL BUG FIX: - case_contact, time_date, is_travel manglede i tmodule_order_lines tabel - Forårsagede SQL fejl ved order creation INSERT - Opdateret migration 031 til at tilføje alle manglende kolonner - Applied direkte på production DB ERROR: column 'case_contact' does not exist → INSERT INTO tmodule_order_lines ... case_contact, time_date, is_travel
31 lines
1.2 KiB
SQL
31 lines
1.2 KiB
SQL
-- ============================================================================
|
|
-- Migration 031: Tilføj manglende kolonner til tmodule_times og tmodule_order_lines
|
|
-- ============================================================================
|
|
-- Retter bug hvor kolonner blev referenced i koden men aldrig tilføjet til DB
|
|
-- ============================================================================
|
|
|
|
-- Tilføj manglende kolonner til tmodule_times
|
|
ALTER TABLE tmodule_times
|
|
ADD COLUMN IF NOT EXISTS is_travel BOOLEAN DEFAULT false;
|
|
|
|
ALTER TABLE tmodule_times
|
|
ADD COLUMN IF NOT EXISTS hourly_rate DECIMAL(10,2);
|
|
|
|
-- Index for hurtig filtrering af rejsetid
|
|
CREATE INDEX IF NOT EXISTS idx_tmodule_times_is_travel ON tmodule_times(is_travel);
|
|
|
|
-- Tilføj manglende kolonner til tmodule_order_lines (bruges ved order creation)
|
|
ALTER TABLE tmodule_order_lines
|
|
ADD COLUMN IF NOT EXISTS case_contact VARCHAR(255);
|
|
|
|
ALTER TABLE tmodule_order_lines
|
|
ADD COLUMN IF NOT EXISTS time_date DATE;
|
|
|
|
ALTER TABLE tmodule_order_lines
|
|
ADD COLUMN IF NOT EXISTS is_travel BOOLEAN DEFAULT false;
|
|
|
|
-- Log migration
|
|
INSERT INTO migration_log (migration_name, applied_at)
|
|
VALUES ('031_add_is_travel_column', CURRENT_TIMESTAMP)
|
|
ON CONFLICT DO NOTHING;
|