forked from symonssawo-cpu/ComplaintHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
32 lines (24 loc) · 1.15 KB
/
Copy pathdatabase.sql
File metadata and controls
32 lines (24 loc) · 1.15 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
CREATE DATABASE IF NOT EXISTS complainthub;
USE complainthub;
CREATE TABLE IF NOT EXISTS companies (
id INT AUTO_INCREMENT PRIMARY KEY,
company_name VARCHAR(150) NOT NULL,
email VARCHAR(150) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL
);
CREATE TABLE IF NOT EXISTS complaints (
id INT AUTO_INCREMENT PRIMARY KEY,
company_id INT NOT NULL,
user_name VARCHAR(100) NOT NULL,
user_email VARCHAR(150) NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE CASCADE
);
INSERT INTO companies (company_name, email, password) VALUES
('Safaricom PLC', 'safaricom@demo.com', MD5('demo1234')),
('KCB Bank', 'kcb@demo.com', MD5('demo1234'));
INSERT INTO complaints (company_id, user_name, user_email, message) VALUES
(1, 'John Kamau', 'john@example.com', 'My internet has been down for three days with no response from support.'),
(1, 'Aisha Mwangi', 'aisha@example.com', 'I was overcharged on my last bill and cannot get a refund.'),
(2, 'Peter Omondi', 'peter@example.com', 'My loan application has been pending for over a month with no update.');