| 1 | BEGIN;
|
|---|
| 2 |
|
|---|
| 3 | INSERT INTO users (username, email, name, surname, password_hash, created_at) VALUES
|
|---|
| 4 | ('client.viktor', 'viktor.client@petify.com', 'Viktor', 'Kostov', 'hash_test_123', NOW() - INTERVAL '289 days'),
|
|---|
| 5 | ('admin.ana', 'ana.admin@petify.com', 'Ana', 'Adminova', 'hash_test_123', NOW() - INTERVAL '40 days'),
|
|---|
| 6 | ('client.mila', 'mila.client@petify.com', 'Mila', 'Ivanova', 'hash_test_123', NOW() - INTERVAL '30 days'),
|
|---|
| 7 | ('client.igor', 'igor.client@petify.com', 'Igor', 'Petrov', 'hash_test_123', NOW() - INTERVAL '25 days'),
|
|---|
| 8 | ('client.sara', 'sara.client@petify.com', 'Sara', 'Jovanova', 'hash_test_123', NOW() - INTERVAL '20 days'),
|
|---|
| 9 | ('clinic.happypaws', 'clinic.happypaws@petify.com', 'Happy Paws', 'Clinic', 'hash_test_123', NOW() - INTERVAL '41 days'),
|
|---|
| 10 | ('clinic.vetcare', 'clinic.vetcare@petify.com', 'VetCare', 'Center', 'hash_test_123', NOW() - INTERVAL '39 days');
|
|---|
| 11 |
|
|---|
| 12 | INSERT INTO admins (user_id)
|
|---|
| 13 | SELECT user_id FROM users WHERE username = 'admin.ana';
|
|---|
| 14 |
|
|---|
| 15 | INSERT INTO clients (user_id)
|
|---|
| 16 | SELECT user_id
|
|---|
| 17 | FROM users
|
|---|
| 18 | WHERE username IN ('client.viktor','client.mila','client.igor','client.sara');
|
|---|
| 19 |
|
|---|
| 20 | INSERT INTO owners (user_id)
|
|---|
| 21 | SELECT user_id FROM users WHERE username IN ('client.mila','client.igor');
|
|---|
| 22 |
|
|---|
| 23 | INSERT INTO vet_clinic_applications
|
|---|
| 24 | (name, email, phone, city, address, submitted_at, status, reviewed_at, reviewed_by, denial_reason)
|
|---|
| 25 | VALUES
|
|---|
| 26 | (
|
|---|
| 27 | 'Happy Paws Clinic', 'contact@happypaws.vet', '+389 70 111 222',
|
|---|
| 28 | 'Skopje', 'Partizanska 10',
|
|---|
| 29 | NOW() - INTERVAL '41 days',
|
|---|
| 30 | 'APPROVED',
|
|---|
| 31 | NOW() - INTERVAL '40 days',
|
|---|
| 32 | (SELECT user_id FROM users WHERE username='admin.ana'),
|
|---|
| 33 | NULL
|
|---|
| 34 | ),
|
|---|
| 35 | (
|
|---|
| 36 | 'VetCare Center', 'info@vetcare.vet', '+389 70 333 444',
|
|---|
| 37 | 'Bitola', 'Shirok Sokak 55',
|
|---|
| 38 | NOW() - INTERVAL '39 days',
|
|---|
| 39 | 'APPROVED',
|
|---|
| 40 | NOW() - INTERVAL '38 days',
|
|---|
| 41 | (SELECT user_id FROM users WHERE username='admin.ana'),
|
|---|
| 42 | NULL
|
|---|
| 43 | );
|
|---|
| 44 |
|
|---|
| 45 | INSERT INTO vet_clinics
|
|---|
| 46 | (user_id, application_id, name, email, phone, location, city, address, work_days, start_time, end_time)
|
|---|
| 47 | VALUES
|
|---|
| 48 | ((SELECT user_id FROM users WHERE username='clinic.happypaws'),
|
|---|
| 49 | (SELECT application_id FROM vet_clinic_applications WHERE name='Happy Paws Clinic'),
|
|---|
| 50 | 'Happy Paws Clinic', 'contact@happypaws.vet', '+389 70 111 222', 'Center', 'Skopje', 'Partizanska 10',
|
|---|
| 51 | 'MON-FRI', '08:00', '16:00'),
|
|---|
| 52 | ((SELECT user_id FROM users WHERE username='clinic.vetcare'),
|
|---|
| 53 | (SELECT application_id FROM vet_clinic_applications WHERE name='VetCare Center'),
|
|---|
| 54 | 'VetCare Center', 'info@vetcare.vet', '+389 70 333 444', 'Downtown', 'Bitola', 'Shirok Sokak 55',
|
|---|
| 55 | 'MON-SAT', '09:00', '17:00');
|
|---|
| 56 |
|
|---|
| 57 | INSERT INTO animals (owner_id, name, sex, date_of_birth, photo_url, type, species, breed, located_name) VALUES
|
|---|
| 58 | ((SELECT user_id FROM users WHERE username='client.mila'), 'Luna', 'FEMALE', '2021-05-10', NULL, 'PET', 'Dog', 'Labrador', 'Skopje'),
|
|---|
| 59 | ((SELECT user_id FROM users WHERE username='client.mila'), 'Max', 'MALE', '2020-11-02', NULL, 'PET', 'Cat', 'British Shorthair', 'Skopje'),
|
|---|
| 60 | ((SELECT user_id FROM users WHERE username='client.igor'), 'Rex', 'MALE', '2019-02-18', NULL, 'PET', 'Dog', 'German Shepherd', 'Bitola');
|
|---|
| 61 |
|
|---|
| 62 | INSERT INTO listings (owner_id, animal_id, status, price, description, created_at) VALUES
|
|---|
| 63 | ((SELECT user_id FROM users WHERE username='client.mila'),
|
|---|
| 64 | (SELECT animal_id FROM animals WHERE name='Luna'),
|
|---|
| 65 | 'ACTIVE', 50.00, 'Friendly dog available for weekend sitting.', NOW() - INTERVAL '10 days'),
|
|---|
| 66 | ((SELECT user_id FROM users WHERE username='client.igor'),
|
|---|
| 67 | (SELECT animal_id FROM animals WHERE name='Rex'),
|
|---|
| 68 | 'ARCHIVED', 35.00, 'Guard dog training sessions (experienced handler).', NOW() - INTERVAL '7 days');
|
|---|
| 69 |
|
|---|
| 70 | INSERT INTO favorite_listings (user_id, listing_id) VALUES
|
|---|
| 71 | ((SELECT user_id FROM users WHERE username='client.viktor'),
|
|---|
| 72 | (SELECT listing_id FROM listings l
|
|---|
| 73 | JOIN animals an ON an.animal_id = l.animal_id
|
|---|
| 74 | WHERE an.name='Luna')),
|
|---|
| 75 | ((SELECT user_id FROM users WHERE username='client.sara'),
|
|---|
| 76 | (SELECT listing_id FROM listings l
|
|---|
| 77 | JOIN animals an ON an.animal_id = l.animal_id
|
|---|
| 78 | WHERE an.name='Rex'));
|
|---|
| 79 |
|
|---|
| 80 | INSERT INTO appointments (clinic_id, animal_id, responsible_owner_id, status, date_time, notes) VALUES
|
|---|
| 81 | ((SELECT clinic_id FROM vet_clinics WHERE name='Happy Paws Clinic'),
|
|---|
| 82 | (SELECT animal_id FROM animals WHERE name='Luna'),
|
|---|
| 83 | (SELECT user_id FROM users WHERE username='client.mila'),
|
|---|
| 84 | 'DONE', NOW() - INTERVAL '5 days', 'Vaccination'),
|
|---|
| 85 | ((SELECT clinic_id FROM vet_clinics WHERE name='Happy Paws Clinic'),
|
|---|
| 86 | (SELECT animal_id FROM animals WHERE name='Max'),
|
|---|
| 87 | (SELECT user_id FROM users WHERE username='client.mila'),
|
|---|
| 88 | 'CONFIRMED', NOW() + INTERVAL '2 days', 'Check-up'),
|
|---|
| 89 | ((SELECT clinic_id FROM vet_clinics WHERE name='VetCare Center'),
|
|---|
| 90 | (SELECT animal_id FROM animals WHERE name='Rex'),
|
|---|
| 91 | (SELECT user_id FROM users WHERE username='client.igor'),
|
|---|
| 92 | 'DONE', NOW() - INTERVAL '12 days', 'Minor injury treatment');
|
|---|
| 93 |
|
|---|
| 94 | INSERT INTO reviews (review_id, reviewer_id, rating, comment, created_at) VALUES
|
|---|
| 95 | (1, (SELECT user_id FROM users WHERE username='client.mila'),
|
|---|
| 96 | 5, 'Great service and friendly staff!', NOW() - INTERVAL '4 days'),
|
|---|
| 97 | (2, (SELECT user_id FROM users WHERE username='client.sara'),
|
|---|
| 98 | 4, 'Smooth communication and on time.', NOW() - INTERVAL '3 days'),
|
|---|
| 99 | (3, (SELECT user_id FROM users WHERE username='client.viktor'),
|
|---|
| 100 | 4, 'Very reliable and polite communication.', NOW() - INTERVAL '2 days');
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | INSERT INTO clinic_reviews (review_id, target_clinic_id, appointment_id)
|
|---|
| 104 | VALUES (
|
|---|
| 105 | 1,
|
|---|
| 106 | (SELECT clinic_id FROM vet_clinics WHERE name='Happy Paws Clinic'),
|
|---|
| 107 | (SELECT appointment_id FROM appointments a
|
|---|
| 108 | JOIN animals an ON an.animal_id = a.animal_id
|
|---|
| 109 | WHERE an.name='Luna'
|
|---|
| 110 | AND a.status='DONE'
|
|---|
| 111 | AND a.clinic_id = (SELECT clinic_id FROM vet_clinics WHERE name='Happy Paws Clinic')
|
|---|
| 112 | ORDER BY a.appointment_id DESC LIMIT 1)
|
|---|
| 113 | );
|
|---|
| 114 |
|
|---|
| 115 | INSERT INTO client_interactions (source_client_id, target_client_id) VALUES
|
|---|
| 116 | ((SELECT user_id FROM users WHERE username='client.sara'),
|
|---|
| 117 | (SELECT user_id FROM users WHERE username='client.igor')),
|
|---|
| 118 | ((SELECT user_id FROM users WHERE username='client.viktor'),
|
|---|
| 119 | (SELECT user_id FROM users WHERE username='client.mila'));
|
|---|
| 120 |
|
|---|
| 121 | INSERT INTO user_reviews (review_id, target_user_id, interaction_type) VALUES
|
|---|
| 122 | (2, (SELECT user_id FROM users WHERE username='client.igor'), 'PERSONAL_INTERACTION'),
|
|---|
| 123 | (3, (SELECT user_id FROM users WHERE username='client.mila'), 'ONLINE');
|
|---|
| 124 |
|
|---|
| 125 | INSERT INTO health_records (animal_id, appointment_id, type, description, date) VALUES
|
|---|
| 126 | ((SELECT animal_id FROM animals WHERE name='Luna'),
|
|---|
| 127 | (SELECT appointment_id FROM appointments a
|
|---|
| 128 | JOIN animals an ON an.animal_id = a.animal_id
|
|---|
| 129 | WHERE an.name='Luna' AND a.status='DONE'
|
|---|
| 130 | ORDER BY a.appointment_id DESC LIMIT 1),
|
|---|
| 131 | 'VACCINATION', 'Rabies vaccine administered. No adverse reaction.', CURRENT_DATE - 5),
|
|---|
| 132 | ((SELECT animal_id FROM animals WHERE name='Rex'),
|
|---|
| 133 | (SELECT appointment_id FROM appointments a
|
|---|
| 134 | JOIN animals an ON an.animal_id = a.animal_id
|
|---|
| 135 | WHERE an.name='Rex' AND a.status='DONE'
|
|---|
| 136 | ORDER BY a.appointment_id DESC LIMIT 1),
|
|---|
| 137 | 'TREATMENT', 'Wound cleaned and bandaged. Antibiotics prescribed.', CURRENT_DATE - 12);
|
|---|
| 138 |
|
|---|
| 139 | INSERT INTO notifications (user_id, type, message, is_read, created_at) VALUES
|
|---|
| 140 | ((SELECT user_id FROM users WHERE username='client.mila'), 'APPOINTMENT_REMINDER', 'Your appointment is confirmed for Max.', FALSE, NOW() - INTERVAL '1 day'),
|
|---|
| 141 | ((SELECT user_id FROM users WHERE username='client.igor'), 'LISTING_STATUS', 'Your listing status is ARCHIVED.', TRUE, NOW() - INTERVAL '6 days');
|
|---|
| 142 |
|
|---|
| 143 | INSERT INTO clinic_unavailable_slots (clinic_id, date_time, reason, created_at) VALUES
|
|---|
| 144 | ((SELECT clinic_id FROM vet_clinics WHERE name='Happy Paws Clinic'),
|
|---|
| 145 | NOW() + INTERVAL '3 days', 'Staff training', NOW() - INTERVAL '1 day'),
|
|---|
| 146 | ((SELECT clinic_id FROM vet_clinics WHERE name='VetCare Center'),
|
|---|
| 147 | NOW() + INTERVAL '5 days', 'Equipment maintenance', NOW() - INTERVAL '2 days');
|
|---|
| 148 |
|
|---|
| 149 | COMMIT;
|
|---|