-
Notifications
You must be signed in to change notification settings - Fork 0
/
DB-queries.txt
93 lines (86 loc) · 3.04 KB
/
DB-queries.txt
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
CREATE TABLE `setting` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`brand` varchar(255),
`logo` varchar(255),
`favicon` varchar(255),
`email` varchar(255),
`phone` varchar(255),
`social` varchar(255),
`location` varchar(255),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
);
CREATE TABLE `authentication` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255),
`email` varchar(255),
`password` varchar(255),
`role` varchar(255),
`status` int(11),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
)
CREATE TABLE `customers` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255),
`phone` varchar(14),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
);
CREATE TABLE `slot_management` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255),
`start_time` varchar(255),
`end_time` varchar(255),
`status` int(11),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
);
CREATE TABLE `slot_live` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`date` varchar(30),
`slot_id` int(11),
`status` int(11),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
FOREIGN KEY (slot_id) REFERENCES slot_management(id)
);
CREATE TABLE `transaction` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` int(11),
`method` varchar(255),
`advance` int(11),
`due` int(11),
`cash` int(11),
`total` int(11),
`status` int(11),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
FOREIGN KEY (user_id) REFERENCES customers(id)
);
CREATE TABLE `booking` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`date` varchar(255),
`user_id` int(11),
`transaction_id` int(11),
`slot_id` int(11),
`reference_id` int(11),
`status` int(11),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
FOREIGN KEY (user_id) REFERENCES customers(id),
FOREIGN KEY (transaction_id) REFERENCES transaction(id),
FOREIGN KEY (slot_id) REFERENCES slot_management(id),
FOREIGN KEY (reference_id) REFERENCES authentication(id)
);
CREATE TABLE `expense` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`description` varchar(255),
`amount` int(11),
`note` varchar(255),
`reference_id` int(11),
`status` int(11),
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
FOREIGN KEY (reference_id) REFERENCES authentication(id)
);