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