Update Postman collection
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
-- Activate all employees in the users table so they appear in dropdowns
|
||||
UPDATE users u
|
||||
SET u.active = TRUE
|
||||
WHERE u.role IN ('STAFF', 'ADMIN')
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
-- V17: Normalize legacy appointmentPet data into customer_pet and appointment_customer_pet
|
||||
|
||||
-- Step 1: Ensure a customer_pet exists for every pet linked in appointmentPet
|
||||
-- Note: pet species and breed might be null in pet table, but we copy them over if present
|
||||
INSERT INTO customer_pet (customer_id, pet_name, species, breed)
|
||||
SELECT DISTINCT a.customerId, p.petName, p.petSpecies, p.petBreed
|
||||
FROM appointmentPet ap
|
||||
@@ -12,7 +8,6 @@ WHERE NOT EXISTS (
|
||||
WHERE cp.customer_id = a.customerId AND cp.pet_name = p.petName
|
||||
);
|
||||
|
||||
-- Step 2: Link the appointment to the customer_pet
|
||||
INSERT INTO appointment_customer_pet (appointment_id, customer_pet_id)
|
||||
SELECT ap.appointmentId, cp.customer_pet_id
|
||||
FROM appointmentPet ap
|
||||
@@ -24,5 +19,4 @@ WHERE NOT EXISTS (
|
||||
WHERE acp.appointment_id = ap.appointmentId AND acp.customer_pet_id = cp.customer_pet_id
|
||||
);
|
||||
|
||||
-- Step 3: Remove the old legacy relationships so it strictly uses the new ones
|
||||
DELETE FROM appointmentPet;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
-- V18: Normalize past appointments and resolve initial employee double-bookings
|
||||
|
||||
-- Part 1: Normalize past appointments.
|
||||
-- Any appointment that is still 'Booked' but the date/time has passed should be marked as 'Missed'.
|
||||
UPDATE appointment
|
||||
SET appointmentStatus = 'Missed'
|
||||
WHERE LOWER(appointmentStatus) = 'booked'
|
||||
@@ -10,8 +6,6 @@ WHERE LOWER(appointmentStatus) = 'booked'
|
||||
OR (appointmentDate = CURRENT_DATE AND appointmentTime < CURRENT_TIME)
|
||||
);
|
||||
|
||||
-- Part 2: Resolve potential double-bookings caused by V15's simple backfill.
|
||||
-- MySQL Error 1093 workaround: wrap same-table subqueries in derived tables.
|
||||
UPDATE appointment a1
|
||||
JOIN (
|
||||
SELECT a3.appointmentId
|
||||
|
||||
Reference in New Issue
Block a user