-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sql
More file actions
31 lines (28 loc) · 1.01 KB
/
Copy pathsetup.sql
File metadata and controls
31 lines (28 loc) · 1.01 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
-- MedQueue basic setup: run this in MySQL to create database and tables
CREATE DATABASE IF NOT EXISTS hospital_queue;
USE hospital_queue;
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100) NOT NULL UNIQUE,
full_name VARCHAR(200) NOT NULL,
email VARCHAR(200) NOT NULL,
password VARCHAR(255) NOT NULL,
role ENUM('user','admin') NOT NULL DEFAULT 'user',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS appointments (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
doctor_name VARCHAR(200) NOT NULL,
department VARCHAR(100) NOT NULL,
appointment_date DATE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS queue (
id INT AUTO_INCREMENT PRIMARY KEY,
appointment_id INT NOT NULL,
token_number INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (appointment_id) REFERENCES appointments(id) ON DELETE CASCADE
);