-- Soft Delete Migration
-- Adds deleted_at TIMESTAMP NULL column to all business entity tables
-- Run: mysql -u root vehicleinspectio_vehicledb23 < this_file

ALTER TABLE vehicles ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE drivers ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE users ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE vehicle_assignments ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE vehicle_fuel_entries ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE maintenance_jobs ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE vehicle_licenses ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE vehicle_insurance ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE roadworthiness ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE driver_licenses ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE workshops ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE workshop_quotes ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE workshop_quote_line_items ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE maintenance_rfqs ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE maintenance_approvals ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER approved_at;
ALTER TABLE maintenance_job_line_items ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE fuel_types ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE fuel_companies ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE fuel_filling_stations ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE fuel_price_history ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE fuel_approval_users ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE fuel_vehicle_types ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE vehicle_document_profiles ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE vehicle_document_renewals ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE accounts ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE branches ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE contracts ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE contract_vehicle_types ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE owners ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE vehicle_models ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE vehicle_types ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER updated_at;
ALTER TABLE compliance_issuing_authorities ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE compliance_issuing_offices ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE compliance_vendors_agents ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE notifications ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE vehicle_fuel_config ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE audit_logs ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER created_at;
ALTER TABLE maintenance_job_actions ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL AFTER acted_at;
