From 28e53a437977bc85af219c4055cff3851dda247a Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Mon, 6 Apr 2026 15:50:52 -0600 Subject: [PATCH] Seed pets and appointments --- .../db/migration/V20__seed_owned_pets.sql | 5 + .../V21__bulk_seed_pets_and_appointments.sql | 144 ++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 backend/src/main/resources/db/migration/V20__seed_owned_pets.sql create mode 100644 backend/src/main/resources/db/migration/V21__bulk_seed_pets_and_appointments.sql diff --git a/backend/src/main/resources/db/migration/V20__seed_owned_pets.sql b/backend/src/main/resources/db/migration/V20__seed_owned_pets.sql new file mode 100644 index 00000000..50a91e1b --- /dev/null +++ b/backend/src/main/resources/db/migration/V20__seed_owned_pets.sql @@ -0,0 +1,5 @@ +INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice, customerId) +VALUES + ('Pepper', 'Cat', 'Tabby', 3, 'Owned', 0.00, 1), + ('Coco', 'Dog', 'Pomeranian', 2, 'Owned', 0.00, 4), + ('Finn', 'Dog', 'Border Collie', 5, 'Owned', 0.00, 6); diff --git a/backend/src/main/resources/db/migration/V21__bulk_seed_pets_and_appointments.sql b/backend/src/main/resources/db/migration/V21__bulk_seed_pets_and_appointments.sql new file mode 100644 index 00000000..441351ab --- /dev/null +++ b/backend/src/main/resources/db/migration/V21__bulk_seed_pets_and_appointments.sql @@ -0,0 +1,144 @@ +INSERT INTO customer (firstName, lastName, email) VALUES +('Noah', 'Parker', 'noah@gmail.com'), +('Mia', 'Evans', 'mia@gmail.com'), +('Ethan', 'Scott', 'ethan@gmail.com'), +('Chloe', 'Adams', 'chloe@gmail.com'), +('Lucas', 'Baker', 'lucas@gmail.com'), +('Lily', 'Hall', 'lily@gmail.com'), +('Mason', 'Rivera', 'mason@gmail.com'), +('Ella', 'Mitchell', 'ella@gmail.com'), +('James', 'Carter', 'jcarter@gmail.com'), +('Harper', 'Collins', 'harper@gmail.com'); + +INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice, storeId) VALUES +('Rocky', 'Dog', 'German Shepherd', 1, 'Available', 475.00, 1), +('Daisy', 'Dog', 'Poodle', 2, 'Available', 512.00, 1), +('Cooper', 'Dog', 'Bulldog', 3, 'Available', 560.00, 1), +('Ruby', 'Dog', 'Boxer', 4, 'Available', 575.00, 1), +('Tucker', 'Dog', 'Dachshund', 5, 'Available', 634.00, 1), +('Rosie', 'Dog', 'Shih Tzu', 1, 'Available', 660.00, 2), +('Bear', 'Dog', 'Rottweiler', 2, 'Available', 686.00, 2), +('Maggie', 'Dog', 'Corgi', 3, 'Available', 745.00, 2), +('Leo', 'Dog', 'Husky', 4, 'Available', 749.00, 2), +('Zoey', 'Cat', 'Ragdoll', 1, 'Available', 420.00, 1), +('Oliver', 'Cat', 'British Shorthair', 2, 'Available', 395.00, 1), +('Lola', 'Cat', 'Bengal', 3, 'Available', 465.00, 3), +('Buster', 'Dog', 'Beagle', 2, 'Available', 440.00, 3), +('Sadie', 'Dog', 'Golden Retriever', 1, 'Available', 535.00, 3), +('Toby', 'Dog', 'Labrador', 5, 'Available', 490.00, 1), +('Cleo', 'Cat', 'Abyssinian', 2, 'Available', 375.00, 2), +('Harley', 'Dog', 'Dalmatian', 3, 'Available', 520.00, 1), +('Mocha', 'Cat', 'Burmese', 1, 'Available', 345.00, 3), +('Rex', 'Dog', 'Doberman', 4, 'Available', 610.00, 1), +('Willow', 'Cat', 'Scottish Fold', 2, 'Available', 480.00, 2), +('Gizmo', 'Dog', 'Pomeranian', 1, 'Available', 530.00, 1), +('Nala', 'Cat', 'Siamese', 3, 'Available', 360.00, 2), +('Duke', 'Dog', 'Great Dane', 2, 'Available', 720.00, 3), +('Misty', 'Cat', 'Russian Blue', 4, 'Available', 410.00, 1), +('Ace', 'Dog', 'Australian Shepherd', 1, 'Available', 555.00, 1); + +INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice, customerId) VALUES +('Shadow', 'Dog', 'Labrador', 3, 'Adopted', 500.00, 1), +('Kitty', 'Cat', 'Persian', 2, 'Adopted', 320.00, 2), +('Bruno', 'Dog', 'Rottweiler', 4, 'Adopted', 580.00, 3), +('Snowball', 'Cat', 'Turkish Angora', 1, 'Adopted', 390.00, 4), +('Zeus', 'Dog', 'Husky', 3, 'Adopted', 640.00, 5); + +INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice, customerId) VALUES +('Biscuit', 'Dog', 'Beagle', 2, 'Owned', 0.00, 6), +('Patches', 'Cat', 'Calico', 5, 'Owned', 0.00, 7), +('Scout', 'Dog', 'Border Collie', 3, 'Owned', 0.00, 8), +('Mittens', 'Cat', 'Domestic Short', 4, 'Owned', 0.00, 9), +('Thor', 'Dog', 'German Shepherd', 2, 'Owned', 0.00, 10); + +INSERT INTO adoption (petId, customerId, employeeId, adoptionDate, adoptionStatus) +SELECT p.petId, p.customerId, + (SELECT e.employeeId FROM employee e JOIN users u ON u.id = e.user_id + WHERE e.isActive = TRUE AND u.role = 'STAFF' ORDER BY e.employeeId LIMIT 1), + '2026-01-10', 'Completed' +FROM pet p WHERE p.petName = 'Shadow' AND p.petStatus = 'Adopted'; + +INSERT INTO adoption (petId, customerId, employeeId, adoptionDate, adoptionStatus) +SELECT p.petId, p.customerId, + (SELECT e.employeeId FROM employee e JOIN users u ON u.id = e.user_id + WHERE e.isActive = TRUE AND u.role = 'STAFF' ORDER BY e.employeeId LIMIT 1), + '2026-01-18', 'Completed' +FROM pet p WHERE p.petName = 'Kitty' AND p.petStatus = 'Adopted'; + +INSERT INTO adoption (petId, customerId, employeeId, adoptionDate, adoptionStatus) +SELECT p.petId, p.customerId, + (SELECT e.employeeId FROM employee e JOIN users u ON u.id = e.user_id + WHERE e.isActive = TRUE AND u.role = 'STAFF' ORDER BY e.employeeId LIMIT 1), + '2026-02-03', 'Completed' +FROM pet p WHERE p.petName = 'Bruno' AND p.petStatus = 'Adopted'; + +INSERT INTO adoption (petId, customerId, employeeId, adoptionDate, adoptionStatus) +SELECT p.petId, p.customerId, + (SELECT e.employeeId FROM employee e JOIN users u ON u.id = e.user_id + WHERE e.isActive = TRUE AND u.role = 'STAFF' ORDER BY e.employeeId LIMIT 1), + '2026-02-14', 'Completed' +FROM pet p WHERE p.petName = 'Snowball' AND p.petStatus = 'Adopted'; + +INSERT INTO adoption (petId, customerId, employeeId, adoptionDate, adoptionStatus) +SELECT p.petId, p.customerId, + (SELECT e.employeeId FROM employee e JOIN users u ON u.id = e.user_id + WHERE e.isActive = TRUE AND u.role = 'STAFF' ORDER BY e.employeeId LIMIT 1), + '2026-02-21', 'Completed' +FROM pet p WHERE p.petName = 'Zeus' AND p.petStatus = 'Adopted'; + +INSERT INTO customer_pet (customer_id, pet_name, species, breed) VALUES +(1, 'Rex', 'Dog', 'German Shepherd'), +(2, 'Whiskers', 'Cat', 'Tabby'), +(3, 'Goldie', 'Dog', 'Golden Retriever'), +(4, 'Midnight', 'Cat', 'Black'), +(5, 'Storm', 'Dog', 'Husky'), +(6, 'Peanut', 'Dog', 'Poodle'), +(7, 'Snowball', 'Cat', 'Persian'), +(8, 'Duke', 'Dog', 'Labrador'), +(9, 'Luna', 'Cat', 'Siamese'), +(10, 'Buster', 'Dog', 'Beagle'), +(11, 'Daisy', 'Dog', 'Corgi'), +(12, 'Cleo', 'Cat', 'Ragdoll'); + +INSERT INTO appointment (serviceId, customerId, appointmentDate, appointmentTime, appointmentStatus, storeId, employeeId) VALUES +(1, 1, '2026-01-10', '09:00:00', 'Completed', 1, 1), +(2, 2, '2026-01-10', '11:00:00', 'Completed', 1, 1), +(3, 3, '2026-01-17', '09:00:00', 'Missed', 1, 1), +(4, 4, '2026-01-17', '14:00:00', 'Completed', 1, 1), +(5, 5, '2026-01-24', '10:00:00', 'Completed', 1, 1), +(1, 6, '2026-01-24', '13:00:00', 'Missed', 1, 1), +(2, 7, '2026-02-07', '09:00:00', 'Completed', 1, 1), +(3, 8, '2026-02-07', '11:00:00', 'Completed', 1, 1), +(1, 9, '2026-01-11', '09:00:00', 'Completed', 1, 2), +(2, 10, '2026-01-11', '11:00:00', 'Missed', 1, 2), +(3, 11, '2026-01-18', '10:00:00', 'Completed', 1, 2), +(4, 12, '2026-01-18', '13:00:00', 'Completed', 1, 2), +(5, 1, '2026-02-01', '09:00:00', 'Completed', 1, 2), +(1, 2, '2026-02-01', '14:00:00', 'Missed', 1, 2), +(2, 3, '2026-02-08', '10:00:00', 'Completed', 1, 2), +(3, 4, '2026-02-08', '13:00:00', 'Completed', 1, 2), +(4, 5, '2026-01-12', '09:00:00', 'Completed', 1, 5), +(5, 6, '2026-01-12', '11:00:00', 'Completed', 1, 5), +(1, 7, '2026-01-19', '09:00:00', 'Missed', 1, 5), +(2, 8, '2026-01-19', '14:00:00', 'Completed', 1, 5), +(3, 9, '2026-02-09', '10:00:00', 'Completed', 1, 5), +(4, 10, '2026-02-09', '13:00:00', 'Completed', 1, 5), +(1, 11, '2026-01-13', '09:00:00', 'Completed', 2, 3), +(2, 12, '2026-01-13', '11:00:00', 'Completed', 2, 3), +(3, 1, '2026-02-10', '09:00:00', 'Missed', 2, 3), +(4, 2, '2026-02-10', '13:00:00', 'Completed', 2, 3), +(1, 3, '2026-01-14', '10:00:00', 'Completed', 3, 4), +(2, 4, '2026-01-14', '13:00:00', 'Completed', 3, 4), +(3, 5, '2026-02-11', '10:00:00', 'Missed', 3, 4), +(4, 6, '2026-02-11', '14:00:00', 'Completed', 3, 4), +(1, 7, '2026-04-15', '09:00:00', 'Booked', 1, 1), +(2, 8, '2026-04-15', '11:00:00', 'Booked', 1, 2), +(3, 9, '2026-04-16', '10:00:00', 'Booked', 1, 5), +(4, 10, '2026-04-17', '09:00:00', 'Booked', 2, 3), +(5, 11, '2026-04-18', '14:00:00', 'Booked', 3, 4); + +INSERT INTO appointment_customer_pet (appointment_id, customer_pet_id) +SELECT a.appointmentId, + (((a.appointmentId - 6) % 12) + 1) +FROM appointment a +WHERE a.appointmentId BETWEEN 6 AND 40;