-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcitysafe_latest_old.sql
More file actions
251 lines (230 loc) · 19.2 KB
/
Copy pathcitysafe_latest_old.sql
File metadata and controls
251 lines (230 loc) · 19.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
-- CitySafe Database Reconstruction Script
-- Generated to restore dropped tables in XAMPP
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
-- --------------------------------------------------------
-- Table structure for table `stations`
-- --------------------------------------------------------
CREATE TABLE `stations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` enum('PNP','BFP') NOT NULL,
`address` varchar(255) NOT NULL,
`latitude` double NOT NULL,
`longitude` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `stations` (`id`, `name`, `type`, `address`, `latitude`, `longitude`) VALUES
(1, 'Molo District Police Station', 'PNP', 'Molo, Iloilo City', 10.702577704829702, 122.54524721212897),
(2, 'Arevalo Police Station', 'PNP', 'Villa Arevalo, Iloilo City', 10.68935915151069, 122.51657110973035),
(3, 'PNP Station 5', 'PNP', 'Mandurriao, Iloilo City', 10.718606349123561, 122.53707085605258),
(4, 'Iloilo City Police Station 10', 'PNP', 'Mandurriao, Iloilo City', 10.705703842025798, 122.5541731091961),
(5, 'Iloilo City Police Office', 'PNP', 'Mandurriao, Iloilo City', 10.702239047821504, 122.56352819973596),
(6, 'POLICE STATION 3', 'PNP', 'Luna St. Jaro, Iloilo City', 10.71637147858059, 122.56250731158228),
(7, 'Iloilo City Police Station 3', 'PNP', 'Jaro, Iloilo City', 10.727275249070377, 122.55753827685025),
(8, 'Iloilo City Police Station 8', 'PNP', 'Sampaguita St, Lapuz, Iloilo City, Iloilo', 10.697309491012305, 122.58514996232637),
(9, 'Philippine National Police Western Visayas Regional Headquarters', 'PNP', 'Iloilo City Proper, Iloilo City, 5000 Iloilo', 10.69145157414182, 122.58088533707652),
(10, 'Philipine National Police - RD PRO 6', 'PNP', 'Camp Martin Delgado, Fort San Pedro Drive, Iloilo City, 5000, Iloilo', 10.691463432743692, 122.58048708982415),
(11, 'Arevalo Fire Sub-Station', 'BFP', 'Villa Arevalo District, Iloilo City, 5000 Iloilo', 10.68803077326833, 122.51673847140576),
(12, '(OLD)Molo Fire Station', 'BFP', 'Locsin St, Molo, Iloilo City, 5000 Iloilo', 10.697476892069218, 122.54420429175273),
(13, 'Molo Fire Sub Station, BFP Iloilo City', 'BFP', 'Brgy Taal, Molo, Iloilo City, Iloilo', 10.696923185712782, 122.54797465357223),
(14, 'Bureau of Fire Protection', 'BFP', 'Macario Peralta Street, Iloilo City Proper, Iloilo City, Iloilo', 10.694069105333908, 122.57255837802192),
(15, 'NEW BFP BLDG.', 'BFP', 'Fort San Pedro Dr, Iloilo City Proper, Iloilo City, Iloilo', 10.689374358960329, 122.58151053465244),
(16, 'Iloilo City Fire Station', 'BFP', 'Fort San Pedro Dr, Iloilo City Proper, Iloilo City, Iloilo', 10.690353933763825, 122.58221564132928),
(17, 'BO.OBRERO FIRE SUB-STATION', 'BFP', 'Dahlia St, Lapuz, Iloilo City, Iloilo', 10.699540066181463, 122.58756406938278),
(18, 'La Paz Fire Sub-Station', 'BFP', 'La Paz, Iloilo City, Iloilo', 10.710991846100452, 122.56986447036857),
(19, 'BUREAU OF FIRE PROTECTION JARO FIRE SUB STATION', 'BFP', 'Plaza Rizal St, Jaro, Iloilo City, Iloilo, Iloilo', 10.725320702555917, 122.55750782376005),
(20, 'Bureau of Fire Protection RHQ 6', 'BFP', '4th Main Ave, Jaro, Iloilo City, Iloilo', 10.73970031909681, 122.56651567896992),
(21, 'Iloilo City Ungka Fire Sub-Station', 'BFP', 'Jaro, Iloilo City, Iloilo', 10.746821847269024, 122.53897978786522);
-- --------------------------------------------------------
-- Table structure for table `users`
-- --------------------------------------------------------
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(150) DEFAULT NULL,
`lastname` varchar(150) DEFAULT NULL,
`street_address` varchar(255) DEFAULT NULL,
`barangay` varchar(100) DEFAULT NULL,
`city` varchar(100) DEFAULT NULL,
`province` varchar(100) DEFAULT NULL,
`postal_code` varchar(20) DEFAULT NULL,
`country` varchar(100) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`contact_number` varchar(25) DEFAULT NULL,
`landmark` varchar(255) DEFAULT NULL,
`address_type` varchar(50) DEFAULT NULL,
`additional_instructions` text DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`role` enum('user','admin','responder') NOT NULL DEFAULT 'user',
`latitude` double DEFAULT NULL,
`longitude` double DEFAULT NULL,
`status` enum('active','busy','deployed','offline') DEFAULT 'offline',
`station_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `contact_number` (`contact_number`),
KEY `fk_station` (`station_id`),
CONSTRAINT `fk_station` FOREIGN KEY (`station_id`) REFERENCES `stations` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `users` (`id`, `firstname`, `lastname`, `street_address`, `barangay`, `city`, `province`, `postal_code`, `country`, `email`, `contact_number`, `landmark`, `address_type`, `additional_instructions`, `password`, `created_at`, `role`, `latitude`, `longitude`, `status`, `station_id`) VALUES
(1, 'Jayrold', 'Tabalina', '124 R. Mapa Street', 'Tabucan', 'Iloilo city', 'Iloilo', '5000', 'Philippines', 'jayroldtabalina@gmail.com', '09499619011', 'near Patahan sa Tabucan1', 'Home', 'none', '123', '2025-04-11 12:54:46', 'admin', NULL, NULL, 'offline', NULL),
(2, 'Yasmine', 'Talaman', 'Blk 15, Lot 6 ', 'Housing', 'Iloilo city', 'Iloilo', '5000', 'Philippines', 'yasminetalaman@gmail.com', '09876543210', 'near Garzon appartment', 'home', 'mandurriao housing1', '123', '2025-04-11 14:47:41', 'user', NULL, NULL, 'offline', NULL),
(3, 'John', 'Doe', '123 Main St', 'Barangay 1', 'Cityville', 'Province A', '12345', 'Country X', 'john.doe@example.com', '09123456789', 'Near park', 'Home', 'Leave at the door', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(4, 'Jane', 'Smith', '456 Oak Ave', 'Barangay 2', 'Townsville', 'Province B', '67890', 'Country Y', 'jane.smith@example.com', '09234567890', 'Near school', 'Home', 'Ring the bell', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(5, 'Michael', 'Johnson', '789 Pine Rd', 'Barangay 3', 'Villagetown', 'Province C', '11223', 'Country Z', 'michael.johnson@example.com', '09345678901', 'Next to hospital', 'Home', 'Call first', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(6, 'Emily', 'Davis', '101 Maple Blvd', 'Barangay 4', 'Metropolis', 'Province D', '44556', 'Country W', 'emily.davis@example.com', '09456789012', 'Behind mall', 'Home', 'Do not disturb', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(7, 'William', 'Martinez', '202 Cedar Ln', 'Barangay 5', 'Bigcity', 'Province E', '77889', 'Country V', 'william.martinez@example.com', '09567890123', 'Near restaurant', 'Office', 'Leave on doorstep', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(8, 'Olivia', 'Brown', '303 Birch Dr', 'Barangay 6', 'Smalltown', 'Province F', '33445', 'Country U', 'olivia.brown@example.com', '09678901234', 'Beside bank', 'Home', 'Ring bell', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(9, 'James', 'Garcia', '404 Elm St', 'Barangay 7', 'Largetown', 'Province G', '55667', 'Country T', 'james.garcia@example.com', '09789012345', 'In front of library', 'Office', 'Knock on door', 'password123', '2025-04-11 16:30:52', 'user', NULL, NULL, 'offline', NULL),
(13, 'test', 'test', '', '', '', '', '5000', 'Philippines', '', '091234567890', '', '', '', '123', '2025-04-13 04:42:49', 'user', NULL, NULL, 'offline', NULL),
(15, 'admin', 'admin', '', '', '', '', '', '', 'admin@gmail.com', '', '', '', '', '123', '2025-04-13 12:33:33', 'admin', NULL, NULL, 'offline', NULL),
(16, 'user', 'user', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '09111111111', NULL, NULL, NULL, '123', '2025-04-28 11:10:48', 'user', NULL, NULL, 'offline', NULL),
(17, 'Mark', 'Jabao', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '09630426657', NULL, NULL, NULL, 'Mark12345', '2025-08-15 01:36:23', 'user', NULL, NULL, 'offline', NULL),
(20, 'sample', 'user', '', '', '', '', '', '', 'sampleuser@gmail.com', '0954321789', '', '', '', '123', '2025-08-21 14:02:12', 'user', NULL, NULL, 'offline', NULL),
(22, 'Responder1', 'responder', '124', 'Tabucan', 'Iloilo city', 'Iloilo', '5000', 'Philippines', 'jayr.tabalina.ui@gmail.com', '095367183362', 'DTI', 'Police station', 'Responder PNP', '123', '2025-12-15 02:33:07', 'responder', NULL, NULL, 'offline', NULL),
(24, 'responder jayrold', 'tabalina', 'Station Assigned', 'N/A', 'Iloilo City', 'Iloilo', '5000', 'Philippines', 'responder1@gmail.com', '09836452822', 'N/A', 'Work', 'N/A', '123', '2025-12-15 02:58:47', 'responder', 10.7301854, 122.5591148, 'active', 1),
(25, 'responder 2', 'tabalina', 'Station Assigned', 'N/A', 'Iloilo City', 'Iloilo', '5000', 'Philippines', 'num2@gmail.com', '0966452432', 'N/A', 'Work', 'N/A', '123', '2025-12-15 06:55:39', 'responder', NULL, NULL, 'offline', 16);
-- --------------------------------------------------------
-- Table structure for table `disaster_reports`
-- --------------------------------------------------------
CREATE TABLE `disaster_reports` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`disaster_type` varchar(255) NOT NULL,
`reported_at` timestamp NOT NULL DEFAULT current_timestamp(),
`location` text DEFAULT NULL,
`status` enum('pending','responding','resolved','cancelled by user','cancelled by admin') DEFAULT 'pending',
`responder_id` int(11) DEFAULT NULL,
`latitude` decimal(10,8) DEFAULT NULL,
`longitude` decimal(11,8) DEFAULT NULL,
`responder_confirmed_at` timestamp NULL DEFAULT NULL,
`user_confirmed_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `fk_responder` (`responder_id`),
CONSTRAINT `disaster_reports_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_responder` FOREIGN KEY (`responder_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `disaster_reports` (`id`, `user_id`, `disaster_type`, `reported_at`, `location`, `status`, `responder_id`, `latitude`, `longitude`) VALUES
(1, 2, 'Fire', '2025-04-22 17:09:51', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(2, 2, 'Landslide', '2025-04-22 17:13:56', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(3, 13, 'Earthquake', '2025-04-22 17:33:00', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(4, 13, 'Fire', '2025-04-22 17:35:22', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(5, 13, 'Landslide', '2025-04-22 17:44:12', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(6, 3, 'Flood', '2025-04-22 17:48:12', 'Commission Civil Street, Jereos, San Pedro, Jaro, Calubihan, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(7, 3, 'Flood', '2025-04-22 17:53:10', 'Commission Civil Street, Jereos, San Pedro, Jaro, Calubihan, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(8, 8, 'Fire', '2025-04-23 07:16:23', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(9, 8, 'Earthquake', '2025-04-23 07:22:26', 'Commission Civil Street, Jereos, San Pedro, Jaro, Calubihan, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(10, 2, 'Fire', '2025-04-28 01:52:48', 'Tayud, Cebu, Central Visayas, 6002, Philippines', 'pending', NULL, NULL, NULL),
(11, 2, 'Flood', '2025-04-28 01:59:50', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(12, 9, 'Fire', '2025-04-28 02:04:06', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(13, 2, 'Fire', '2025-05-12 18:11:12', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(14, 2, 'Flood', '2025-05-12 18:28:18', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(15, 2, 'Fire', '2025-08-14 09:02:34', 'Iloilo City Hall, I. de la Rama Street, City Proper, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(16, 2, 'Fire', '2025-08-15 08:00:19', 'University of Iloilo, Rizal Street, City Proper, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(17, 13, 'Fire', '2025-08-18 13:50:48', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'pending', NULL, NULL, NULL),
(18, 13, 'Fire', '2025-08-19 21:21:18', 'Alviola Street, Tejero, Cebu City, Central Visayas, 6666, Philippines', 'pending', NULL, NULL, NULL),
(19, 13, 'Flood', '2025-08-19 21:27:16', 'Alviola Street, Tejero, Cebu City, Central Visayas, 6666, Philippines', 'pending', NULL, NULL, NULL),
(20, 20, 'Landslide', '2025-08-21 15:05:11', 'Alviola Street, Tejero, Cebu City, Central Visayas, 6666, Philippines', 'pending', NULL, NULL, NULL);
-- --------------------------------------------------------
-- Table structure for table `requests`
-- --------------------------------------------------------
CREATE TABLE `requests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`location` varchar(255) NOT NULL,
`needs` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`help_count` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `requests_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `requests` (`id`, `user_id`, `name`, `location`, `needs`, `created_at`, `help_count`) VALUES
(1, 2, 'Yasmine Talaman', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'need clothing fire', '2025-04-13 06:46:48', 2),
(2, 2, 'Yasmine Talaman', 'Western Visayas Medical Center, Q. Abeto Street, Iloilo Business Park, Mandurriao, Pale Benidicto Rizal, Iloilo City, Western Visayas, 5000, Philippines', 'water', '2025-04-13 07:35:56', 1),
(3, 13, 'test test1', 'Tayud, Cebu, Central Visayas, 6002, Philippines', 'foods', '2025-04-13 07:39:01', 0),
(4, 2, 'Yasmine Talaman', 'Western Visayas Medical Center, Q. Abeto Street, Iloilo Business Park, Mandurriao, Pale Benidicto Rizal, Iloilo City, Western Visayas, 5000, Philippines', 'Clothes\r\n', '2025-04-13 07:57:42', 0),
(5, 3, 'John Doe', 'Tayud, Cebu, Central Visayas, 6002, Philippines', 'need food please', '2025-04-13 11:32:26', 0),
(6, 4, 'Jane Smith', 'Western Visayas Medical Center, Q. Abeto Street, Iloilo Business Park, Mandurriao, Pale Benidicto Rizal, Iloilo City, Western Visayas, 5000, Philippines', 'Whiskey', '2025-04-13 14:13:27', 0),
(7, 9, 'James Garcia', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'shelter, clothing\r\n', '2025-04-14 09:33:15', 0),
(8, 9, 'James Garcia', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'Foods', '2025-04-14 09:40:54', 1),
(9, 13, 'test test1', 'San Juan, Molo, Iloilo City, Western Visayas, 5000, Philippines', 'food\r\n', '2025-04-14 13:49:55', 0),
(10, 8, 'Olivia Brown', 'Commission Civil Street, Jereos, San Pedro, Jaro, Calubihan, Iloilo City, Western Visayas, 5000, Philippines', 'i need clothes \r\n', '2025-04-23 07:17:37', 1),
(11, 2, 'Yasmine Talaman', 'Iloilo City Hall, I. de la Rama Street, City Proper, Iloilo City, Western Visayas, 5000, Philippines', 'relief, clothes', '2025-08-14 09:08:06', 0);
-- --------------------------------------------------------
-- Table structure for table `risk_assessments`
-- --------------------------------------------------------
CREATE TABLE `risk_assessments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`near_river` tinyint(1) NOT NULL,
`near_fault` tinyint(1) NOT NULL,
`has_emergency_kit` tinyint(1) NOT NULL,
`has_evacuation_plan` tinyint(1) NOT NULL,
`risk_score` int(11) NOT NULL,
`risk_level` varchar(20) NOT NULL,
`assessed_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `risk_assessments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `risk_assessments` (`id`, `user_id`, `near_river`, `near_fault`, `has_emergency_kit`, `has_evacuation_plan`, `risk_score`, `risk_level`, `assessed_at`) VALUES
(2, 13, 1, 0, 0, 1, 5, 'Moderate', '2025-04-13 18:19:08'),
(3, 13, 1, 1, 1, 1, 6, 'Moderate', '2025-04-13 19:14:29'),
(4, 3, 1, 0, 1, 1, 3, 'Low', '2025-04-13 19:31:38'),
(5, 2, 0, 0, 0, 1, 2, 'Low', '2025-04-13 20:22:50'),
(6, 4, 1, 1, 0, 0, 10, 'High', '2025-04-13 22:12:58'),
(7, 2, 1, 1, 1, 1, 6, 'Moderate', '2025-04-14 03:24:47'),
(8, 9, 1, 1, 0, 1, 8, 'High', '2025-04-14 17:44:52'),
(9, 8, 1, 1, 0, 0, 10, 'High', '2025-04-23 15:20:48'),
(10, 9, 0, 0, 1, 1, 0, 'Low', '2025-04-23 15:32:52'),
(11, 16, 1, 1, 1, 1, 6, 'Moderate', '2025-04-28 19:28:27'),
(12, 2, 1, 0, 0, 0, 7, 'Moderate', '2025-08-14 17:07:38');
-- --------------------------------------------------------
-- Table structure for table `responders`
-- --------------------------------------------------------
CREATE TABLE `responders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(255) DEFAULT NULL,
`lastname` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`contact_number` varchar(50) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`station_id` int(11) DEFAULT NULL,
`latitude` decimal(10, 8) DEFAULT NULL,
`longitude` decimal(11, 8) DEFAULT NULL,
`status` enum('active', 'inactive', 'deployed', 'offline') DEFAULT 'offline',
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `station_id` (`station_id`),
CONSTRAINT `responders_ibfk_1` FOREIGN KEY (`station_id`) REFERENCES `stations` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
-- Table structure for table `deploys`
-- --------------------------------------------------------
CREATE TABLE `deploys` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`responder_id` int(11) DEFAULT NULL,
`station_id` int(11) DEFAULT NULL,
`incident_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`status` enum('pending', 'resolved', 'cancelled by user', 'cancelled by admin') DEFAULT 'pending',
`deployed_at` timestamp NOT NULL DEFAULT current_timestamp(),
`resolved_at` timestamp NULL DEFAULT NULL,
`remarks` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `responder_id` (`responder_id`),
KEY `station_id` (`station_id`),
KEY `incident_id` (`incident_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `deploys_ibfk_1` FOREIGN KEY (`responder_id`) REFERENCES `responders` (`id`) ON DELETE SET NULL,
CONSTRAINT `deploys_ibfk_2` FOREIGN KEY (`station_id`) REFERENCES `stations` (`id`) ON DELETE SET NULL,
CONSTRAINT `deploys_ibfk_3` FOREIGN KEY (`incident_id`) REFERENCES `disaster_reports` (`id`) ON DELETE SET NULL,
CONSTRAINT `deploys_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
COMMIT;