-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaintenance_mode_setup.sql
More file actions
41 lines (39 loc) · 1.71 KB
/
maintenance_mode_setup.sql
File metadata and controls
41 lines (39 loc) · 1.71 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
-- Create maintenance_mode table
CREATE TABLE IF NOT EXISTS maintenance_mode (
id INT AUTO_INCREMENT PRIMARY KEY,
module VARCHAR(50) NOT NULL UNIQUE,
is_active BOOLEAN DEFAULT FALSE,
message TEXT,
start_time DATETIME NULL,
end_time DATETIME NULL,
updated_by INT,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_module (module),
INDEX idx_is_active (is_active),
INDEX idx_updated_at (updated_at)
);
-- Insert default maintenance settings for all modules
INSERT IGNORE INTO maintenance_mode (module, is_active, message) VALUES
('student', FALSE, 'Student portal is temporarily unavailable for maintenance. Please try again later.'),
('faculty', FALSE, 'Faculty portal is temporarily unavailable for maintenance. Please try again later.'),
('hod', FALSE, 'HOD portal is temporarily unavailable for maintenance. Please try again later.'),
('admin', FALSE, 'Admin portal is temporarily unavailable for maintenance. Please contact system administrator.'),
('global', FALSE, 'System is temporarily unavailable for maintenance. Please try again later.');
-- Create maintenance_logs table for tracking maintenance activities
CREATE TABLE IF NOT EXISTS maintenance_logs (
id INT AUTO_INCREMENT PRIMARY KEY,
module VARCHAR(50) NOT NULL,
action ENUM('enabled', 'disabled', 'updated') NOT NULL,
previous_status BOOLEAN,
new_status BOOLEAN,
message TEXT,
admin_id INT,
admin_name VARCHAR(255),
ip_address VARCHAR(45),
user_agent TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_module (module),
INDEX idx_action (action),
INDEX idx_created_at (created_at)
);