-
Notifications
You must be signed in to change notification settings - Fork 0
/
databaseSchema.txt
executable file
·61 lines (56 loc) · 1.64 KB
/
databaseSchema.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
CREATE TABLE user(
userId INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
city VARCHAR(255) NOT NULL,
contact VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
image VARCHAR(255) NOT NULL
);
CREATE TABLE city(
cityId INTEGER PRIMARY KEY AUTO_INCREMENT,
city VARCHAR(255) NOT NULL,
state VARCHAR(255) NOT NULL,
address VARCHAR(255) NOT NULL,
pincode VARCHAR(6) NOT NULL,
lat DECIMAL(10, 8) NOT NULL,
lng DECIMAL(11, 8) NOT NULL
);
CREATE TABLE parking(
parkingId INTEGER PRIMARY KEY AUTO_INCREMENT,
placeName VARCHAR(255) NOT NULL,
ownerName VARCHAR(255) NOT NULL,
userId INTEGER NOT NULL REFERENCES user(userId),
cityId INTEGER NOT NULL REFERENCES city(cityId),
spots INTEGER NOT NULL,
fare DECIMAL(15, 2) NOT NULL,
contact VARCHAR(12) NOT NULL,
image VARCHAR(10000) NOT NULL
);
CREATE TABLE car(
carId INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
numberPlate VARCHAR(15) NOT NULL,
image VARCHAR(10000) NOT NULL,
userId INTEGER NOT NULL REFERENCES user(userId)
);
CREATE TABLE booking(
bookingId INTEGER PRIMARY KEY AUTO_INCREMENT,
userId INTEGER NOT NULL REFERENCES user(userId),
parkingId INTEGER NOT NULL REFERENCES parking(parkingId),
carId INTEGER NOT NULL REFERENCES car(carId),
datePlaced DATE NOT NULL,
timePlaced TIME NOT NULL,
price DECIMAL(15, 2) NOT NULL,
completion BOOL DEFAULT 0,
payment BOOL DEFAULT 0,
hour INTEGER NOT NULL
);
CREATE TABLE contact(
contactId INTEGER PRIMARY KEY AUTO_INCREMENT,
firstName VARCHAR(255) NOT NULL,
lastName VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
message VARCHAR(1000) NOT NULL,
dateAdded DATE NOT NULL
);