AdvancedApplicationDesign: V1.1__data_init.sql

File V1.1__data_init.sql, 16.6 KB (added by 216049, 3 months ago)
Line 
1INSERT INTO Korisnik (is_admin, adresa, email, ime, lozinka, telefon) VALUES
2 (true, 'Bulevar Partizanski Odredi 45, Skopje', 'admin@example.com', 'Nikola Stojanovski', 'admin_password', '070123456'),
3 (false, 'Ulica Makedonija 12, Skopje', 'user1@example.com', 'Elena Petrovska', 'user1_password', '071234567'),
4 (false, 'Bulevar Sveti Kliment Ohridski 23, Skopje', 'user2@example.com', 'Marija Trajkovska', 'user2_password', '072345678'),
5 (false, 'Ulica Vasil Glavinov 10, Skopje', 'user3@example.com', 'Ivana Risteska', 'user3_password', '073456789'),
6 (false, 'Bulevar Krste Misirkov 56, Skopje', 'user4@example.com', 'Stefan Dimitrovski', 'user4_password', '074567890');
7INSERT INTO Role (description, name) VALUES
8 ('Administrator with full access rights', 'ROLE_ADMIN'),
9 ('Driver responsible for operating the bus', 'ROLE_DRIVER'),
10 ('Conductor responsible for checking tickets', 'ROLE_CONDUCTOR'),
11 ('Commuter using the public transport services', 'ROLE_PASSENGER');
12-- Nikola Stojanovski (Admin)
13INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
14 (1, 2),
15 (1, 3),
16 (1, 4),
17 (1, 1); -- Admin role
18
19-- Elena Petrovska (Commuter)
20INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
21 (2, 4); -- Commuter role
22
23-- Marija Trajkovska (Driver)
24INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
25 (3, 2); -- Driver role
26
27-- Ivana Risteska (Conductor)
28INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
29 (4, 3); -- Conductor role
30
31-- Stefan Dimitrovski (Commuter)
32INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
33 (5, 4); -- Commuter role
34
35-- Elena Petrovska (Commuter)
36INSERT INTO Patnik (korisnik_id) VALUES
37 (2);
38
39-- Stefan Dimitrovski (Commuter)
40INSERT INTO Patnik (korisnik_id) VALUES
41 (5);
42
43-- Nikola Stojanovski (Admin)
44INSERT INTO Patnik (korisnik_id) VALUES
45 (1); -- Assuming Nikola Stojanovski has vraboten_id 1
46
47-- Nikola Stojanovski (Admin)
48INSERT INTO Vraboten (datum_na_vrabotuvanje, datum_prekin_vrabotuvanje, plata, korisnik_id) VALUES
49 ('2020-01-01', NULL, 60000, 1);
50
51-- Marija Trajkovska (Driver)
52INSERT INTO Vraboten (datum_na_vrabotuvanje, datum_prekin_vrabotuvanje, plata, korisnik_id) VALUES
53 ('2021-05-15', NULL, 35000, 3);
54
55-- Ivana Risteska (Conductor)
56INSERT INTO Vraboten (datum_na_vrabotuvanje, datum_prekin_vrabotuvanje, plata, korisnik_id) VALUES
57 ('2022-03-20', NULL, 30000, 4);
58
59-- Marija Trajkovska (Driver)
60INSERT INTO Vozac (vraboten_id) VALUES
61 (2); -- Assuming Marija Trajkovska has vraboten_id 2
62
63-- Nikola Stojanovski (Admin)
64INSERT INTO Vozac (vraboten_id) VALUES
65 (1); -- Assuming Nikola Stojanovski has vraboten_id 1
66
67-- Insert employees into the Kondukter table
68
69-- Ivana Risteska (Conductor)
70INSERT INTO Kondukter (vraboten_id) VALUES
71 (3); -- Assuming Ivana Risteska has vraboten_id 3
72
73-- Nikola Stojanovski (Admin)
74INSERT INTO Kondukter (vraboten_id) VALUES
75 (1); -- Assuming Nikola Stojanovski has vraboten_id 1
76
77INSERT INTO Avtobus (broj_sedishta, registracija, seriski_broj) VALUES
78 (50, 'SK-1234-AB', 'SN-000001'),
79 (45, 'SK-2345-BC', 'SN-000002'),
80 (50, 'SK-3456-CD', 'SN-000003'),
81 (40, 'SK-4567-DE', 'SN-000004'),
82 (50, 'SK-5678-EF', 'SN-000005'),
83 (55, 'SK-6789-FG', 'SN-000006'),
84 (50, 'SK-7890-GH', 'SN-000007'),
85 (45, 'SK-8901-HI', 'SN-000008'),
86 (50, 'SK-9012-IJ', 'SN-000009'),
87 (40, 'SK-0123-JK', 'SN-000010'),
88 (50, 'SK-1234-KL', 'SN-000011'),
89 (55, 'SK-2345-LM', 'SN-000012'),
90 (50, 'SK-3456-MN', 'SN-000013'),
91 (45, 'SK-4567-NO', 'SN-000014'),
92 (50, 'SK-5678-OP', 'SN-000015'),
93 (40, 'SK-6789-PQ', 'SN-000016'),
94 (50, 'SK-7890-QR', 'SN-000017'),
95 (55, 'SK-8901-RS', 'SN-000018'),
96 (50, 'SK-9012-ST', 'SN-000019'),
97 (45, 'SK-0123-TU', 'SN-000020');
98
99INSERT INTO Linija (ime) VALUES
100 ('Line 1'),
101 ('Line 2'),
102 ('Line 3'),
103 ('Line 4'),
104 ('Line 5'),
105 ('Line 6'),
106 ('Line 7'),
107 ('Line 8'),
108 ('Line 9'),
109 ('Line 10');
110
111INSERT INTO Pravec (pravec, opis) VALUES
112 ('Skopje - Tetovo', 'Skopje to Tetovo'),
113 ('Tetovo - Skopje', 'Tetovo to Skopje'),
114 ('Skopje - Ohrid', 'Skopje to Ohrid'),
115 ('Ohrid - Skopje', 'Ohrid to Skopje'),
116 ('Skopje - Bitola', 'Skopje to Bitola'),
117 ('Bitola - Skopje', 'Bitola to Skopje'),
118 ('Skopje - Kumanovo', 'Skopje to Kumanovo'),
119 ('Kumanovo - Skopje', 'Kumanovo to Skopje'),
120 ('Skopje - Strumica', 'Skopje to Strumica'),
121 ('Strumica - Skopje', 'Strumica to Skopje'),
122 ('Skopje - Veles', 'Skopje to Veles'),
123 ('Veles - Skopje', 'Veles to Skopje'),
124 ('Skopje - Prilep', 'Skopje to Prilep'),
125 ('Prilep - Skopje', 'Prilep to Skopje'),
126 ('Skopje - Gostivar', 'Skopje to Gostivar'),
127 ('Gostivar - Skopje', 'Gostivar to Skopje'),
128 ('Skopje - Stip', 'Skopje to Stip'),
129 ('Stip - Skopje', 'Stip to Skopje'),
130 ('Skopje - Kavadarci', 'Skopje to Kavadarci'),
131 ('Kavadarci - Skopje', 'Kavadarci to Skopje');
132
133-- Line 1: Skopje - Tetovo
134INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
135 (1, 1), -- Skopje to Tetovo
136 (2, 1); -- Tetovo to Skopje
137
138-- Line 2: Skopje - Ohrid
139INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
140 (3, 2), -- Skopje to Ohrid
141 (4, 2); -- Ohrid to Skopje
142
143-- Line 3: Skopje - Bitola
144INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
145 (5, 3), -- Skopje to Bitola
146 (6, 3); -- Bitola to Skopje
147
148-- Line 4: Skopje - Kumanovo
149INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
150 (7, 4), -- Skopje to Kumanovo
151 (8, 4); -- Kumanovo to Skopje
152
153-- Line 5: Skopje - Strumica
154INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
155 (9, 5), -- Skopje to Strumica
156 (10, 5); -- Strumica to Skopje
157
158-- Line 6: Skopje - Veles
159INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
160 (11, 6), -- Skopje to Veles
161 (12, 6); -- Veles to Skopje
162
163-- Line 7: Skopje - Prilep
164INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
165 (13, 7), -- Skopje to Prilep
166 (14, 7); -- Prilep to Skopje
167
168-- Line 8: Skopje - Gostivar
169INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
170 (15, 8), -- Skopje to Gostivar
171 (16, 8); -- Gostivar to Skopje
172
173-- Line 9: Skopje - Stip
174INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
175 (17, 9), -- Skopje to Stip
176 (18, 9); -- Stip to Skopje
177
178-- Line 10: Skopje - Kavadarci
179INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
180 (19, 10), -- Skopje to Kavadarci
181 (20, 10); -- Kavadarci to Skopje
182
183INSERT INTO Instanca_Na_Linija (linija_id, avtobus_id, start_date, end_date, vozac_id)
184VALUES
185-- Line 1: Skopje - Tetovo
186(1, 1, '2024-06-24 08:00:00', '2024-06-24 09:00:00', 1),
187(1, 1, '2024-06-24 09:00:00', '2024-06-24 10:00:00', 1),
188(1, 1, '2024-06-24 10:00:00', '2024-06-24 11:00:00', 1),
189(1, 1, '2024-06-24 11:00:00', '2024-06-24 12:00:00', 1),
190(1, 1, '2024-06-24 12:00:00', '2024-06-24 13:00:00', 1);
191
192
193-- Insert stops from Skopje to Tetovo
194INSERT INTO Postojka (lat, lon, ime, opis) VALUES
195 (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia'),
196 (41.9643, 21.6228, 'Gazi Baba', 'Municipality near Skopje'),
197 (42.0264, 21.5957, 'Tetovo', 'City in western North Macedonia');
198
199-- Insert stops from Tetovo to Skopje
200INSERT INTO Postojka (lat, lon, ime, opis) VALUES
201 (42.0264, 21.5957, 'Tetovo', 'City in western North Macedonia'),
202 (41.9643, 21.6228, 'Gazi Baba', 'Municipality near Skopje'),
203 (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia');
204
205-- Additional stops for Skopje to Tetovo
206INSERT INTO Postojka (lat, lon, ime, opis) VALUES
207 (41.9808, 21.4631, 'Butel', 'Municipality in Skopje'),
208 (42.0035, 21.4701, 'Kisela Voda', 'Municipality in Skopje'),
209 (41.9866, 21.5666, 'Gostivar', 'City in western North Macedonia'),
210 (41.9764, 21.6060, 'Zelino', 'Village near Tetovo'),
211 (41.9939, 21.6481, 'Tetovo Bus Station', 'Central bus station in Tetovo'),
212 (41.9861, 21.5705, 'Gostivar Train Station', 'Train station in Gostivar'),
213 (42.0081, 21.4500, 'Skopje University', 'University campus in Skopje'),
214 (42.0070, 21.4421, 'Kapishtec', 'Neighborhood in Skopje'),
215 (41.9794, 21.4604, 'Skopje City Mall', 'Shopping mall in Skopje');
216
217-- Additional stops for Tetovo to Skopje
218INSERT INTO Postojka (lat, lon, ime, opis) VALUES
219 (41.9839, 21.4647, 'Butel', 'Municipality in Skopje'),
220 (41.9934, 21.4752, 'Kisela Voda', 'Municipality in Skopje'),
221 (41.9901, 21.5804, 'Gostivar', 'City in western North Macedonia'),
222 (41.9798, 21.6093, 'Zelino', 'Village near Tetovo'),
223 (41.9997, 21.6543, 'Tetovo Bus Station', 'Central bus station in Tetovo'),
224 (41.9930, 21.5741, 'Gostivar Train Station', 'Train station in Gostivar'),
225 (42.0132, 21.4578, 'Skopje University', 'University campus in Skopje'),
226 (42.0111, 21.4491, 'Kapishtec', 'Neighborhood in Skopje'),
227 (41.9822, 21.4679, 'Skopje City Mall', 'Shopping mall in Skopje');
228
229-- Insert stops for Line 1 (Skopje - Tetovo)
230INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
231 (1, 1, 1, 1), -- Skopje
232 (1, 2, 2, 1), -- Gazi Baba
233 (1, 8, 3, 1), -- Skopje University
234 (1, 7, 4, 1), -- Kapishtec
235 (1, 3, 5, 1), -- Tetovo
236 (1, 6, 6, 1), -- Gostivar Train Station
237 (1, 5, 7, 1), -- Gostivar
238 (1, 4, 8, 1), -- Zelino
239 (1, 9, 9, 1), -- Tetovo Bus Station
240 (1, 10, 10, 1); -- Butel
241
242-- Insert stops for Line 1 (Tetovo to Skopje)
243INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
244 (1, 10, 1, 2), -- Butel
245 (1, 9, 2, 2), -- Tetovo Bus Station
246 (1, 4, 3, 2), -- Zelino
247 (1, 5, 4, 2), -- Gostivar
248 (1, 6, 5, 2), -- Gostivar Train Station
249 (1, 3, 6, 2), -- Tetovo
250 (1, 7, 7, 2), -- Kapishtec
251 (1, 8, 8, 2), -- Skopje University
252 (1, 2, 9, 2), -- Gazi Baba
253 (1, 1, 10, 2); -- Skopje
254
255
256-- Insert ticket types
257INSERT INTO TipBilet (cena, trajnost, ime) VALUES
258 (50.00, 3600000, 'Hourly'), -- Hourly ticket (1 hour = 3,600,000 milliseconds)
259 (150.00, 86400000, 'Daily'), -- Daily ticket (1 day = 86,400,000 milliseconds)
260 (1000.00, 2592000000, 'Monthly'), -- Monthly ticket (30 days = 2,592,000,000 milliseconds)
261 (10000.00, 31536000000, 'Yearly'); -- Yearly ticket (365 days = 31,536,000,000 milliseconds)
262
263-- Add tickets for commuter with patnik_id 1
264INSERT INTO Bilet (datum_kupuvanje, patnik_id, tip_id, status) VALUES
265 ('2024-06-24 10:00:00', 1, 1, 'INACTIVE'), -- Hourly ticket (ID 1)
266 ('2024-06-23 15:00:00', 1, 2, 'ACTIVE'); -- Daily ticket (ID 2)
267