· 7 years ago · Nov 20, 2018, 11:14 AM
1-- MySQL dump 10.16 Distrib 10.1.37-MariaDB, for Linux (x86_64)
2--
3-- Host: localhost Database: innohabit
4-- ------------------------------------------------------
5-- Server version 10.1.37-MariaDB
6
7/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10/*!40101 SET NAMES utf8 */;
11/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12/*!40103 SET TIME_ZONE='+00:00' */;
13/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
18--
19-- Table structure for table `battery`
20--
21
22DROP TABLE IF EXISTS `battery`;
23/*!40101 SET @saved_cs_client = @@character_set_client */;
24/*!40101 SET character_set_client = utf8 */;
25CREATE TABLE `battery` (
26 `batteryId` int(50) NOT NULL AUTO_INCREMENT,
27 `batteryBin` varchar(50) NOT NULL,
28 `batteryCapacity` int(1) NOT NULL,
29 `batteryCommissioned` date DEFAULT NULL,
30 `batteryWarranty` int(50) NOT NULL,
31 `batteryCurrent` int(50) NOT NULL,
32 `batteryModel` varchar(10) NOT NULL,
33 `status` int(1) NOT NULL,
34 `createdBy` text,
35 `updatedBy` text,
36 `updatedOn` date DEFAULT NULL,
37 `createdOn` date DEFAULT NULL,
38 PRIMARY KEY (`batteryId`)
39) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;
40/*!40101 SET character_set_client = @saved_cs_client */;
41
42--
43-- Table structure for table `battery_session`
44--
45
46DROP TABLE IF EXISTS `battery_session`;
47/*!40101 SET @saved_cs_client = @@character_set_client */;
48/*!40101 SET character_set_client = utf8 */;
49CREATE TABLE `battery_session` (
50 `batterySessionID` int(50) NOT NULL AUTO_INCREMENT,
51 `batteryLog` varchar(50) NOT NULL,
52 `logID` int(50) NOT NULL,
53 `vehicleID` int(50) DEFAULT NULL,
54 `batteryID` int(11) NOT NULL,
55 `stationID` int(50) DEFAULT NULL,
56 `batterySOC` int(11) DEFAULT NULL,
57 `status` int(11) NOT NULL,
58 PRIMARY KEY (`batterySessionID`),
59 KEY `vehicleID` (`vehicleID`),
60 KEY `batteryID` (`batteryID`),
61 KEY `stationID` (`stationID`),
62 CONSTRAINT `battery_session_ibfk_4` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`vehicleId`) ON DELETE CASCADE,
63 CONSTRAINT `battery_session_ibfk_5` FOREIGN KEY (`batteryID`) REFERENCES `battery` (`batteryId`) ON DELETE CASCADE,
64 CONSTRAINT `battery_session_ibfk_6` FOREIGN KEY (`stationID`) REFERENCES `station` (`stationId`) ON DELETE CASCADE
65) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
66/*!40101 SET character_set_client = @saved_cs_client */;
67
68--
69-- Table structure for table `station`
70--
71
72DROP TABLE IF EXISTS `station`;
73/*!40101 SET @saved_cs_client = @@character_set_client */;
74/*!40101 SET character_set_client = utf8 */;
75CREATE TABLE `station` (
76 `stationId` int(50) NOT NULL AUTO_INCREMENT,
77 `stationName` text NOT NULL,
78 `stationOwner` text NOT NULL,
79 `stationCommissionedOn` date DEFAULT NULL,
80 `stationLat` int(20) NOT NULL,
81 `stationLong` int(20) NOT NULL,
82 `status` int(1) NOT NULL,
83 `createdOn` date DEFAULT NULL,
84 `createdBy` text,
85 `updatedOn` date DEFAULT NULL,
86 `updatedBy` text,
87 PRIMARY KEY (`stationId`)
88) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
89/*!40101 SET character_set_client = @saved_cs_client */;
90
91--
92-- Table structure for table `station_session`
93--
94
95DROP TABLE IF EXISTS `station_session`;
96/*!40101 SET @saved_cs_client = @@character_set_client */;
97/*!40101 SET character_set_client = utf8 */;
98CREATE TABLE `station_session` (
99 `stationLog` int(50) NOT NULL,
100 `stationSessionID` int(50) NOT NULL AUTO_INCREMENT,
101 `oldBatteryID1` int(50) DEFAULT NULL,
102 `oldBatteryID2` int(50) DEFAULT NULL,
103 `userID` int(50) DEFAULT NULL,
104 `vehicleID` int(50) DEFAULT NULL,
105 `acceptedStatus` int(2) NOT NULL,
106 `newBatteryID1` int(50) DEFAULT NULL,
107 `newBatteryID2` int(50) DEFAULT NULL,
108 `swipeStatus` int(2) NOT NULL,
109 `swipeDate` datetime(6) NOT NULL,
110 `initiatePaymentStatus` int(2) NOT NULL,
111 `initiatePaymentDate` datetime(6) NOT NULL,
112 `paymentAmount` int(100) NOT NULL,
113 `paymentModeID` int(50) NOT NULL,
114 `stationID` int(50) DEFAULT NULL,
115 PRIMARY KEY (`stationSessionID`),
116 KEY `oldBatteryID1` (`oldBatteryID1`),
117 KEY `oldBatteryID2` (`oldBatteryID2`),
118 KEY `newBatteryID1` (`newBatteryID1`),
119 KEY `newBatteryID2` (`newBatteryID2`),
120 KEY `vehicleID` (`vehicleID`),
121 KEY `userID` (`userID`),
122 KEY `stationID` (`stationID`),
123 CONSTRAINT `station_session_ibfk_10` FOREIGN KEY (`stationID`) REFERENCES `station` (`stationId`) ON DELETE CASCADE,
124 CONSTRAINT `station_session_ibfk_11` FOREIGN KEY (`oldBatteryID1`) REFERENCES `battery` (`batteryId`) ON DELETE CASCADE,
125 CONSTRAINT `station_session_ibfk_12` FOREIGN KEY (`oldBatteryID2`) REFERENCES `battery` (`batteryId`) ON DELETE CASCADE,
126 CONSTRAINT `station_session_ibfk_13` FOREIGN KEY (`newBatteryID1`) REFERENCES `battery` (`batteryId`) ON DELETE CASCADE,
127 CONSTRAINT `station_session_ibfk_14` FOREIGN KEY (`newBatteryID2`) REFERENCES `battery` (`batteryId`) ON DELETE CASCADE,
128 CONSTRAINT `station_session_ibfk_15` FOREIGN KEY (`vehicleID`) REFERENCES `vehicle` (`vehicleId`) ON DELETE CASCADE,
129 CONSTRAINT `station_session_ibfk_16` FOREIGN KEY (`userID`) REFERENCES `user` (`userId`) ON DELETE CASCADE
130) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
131/*!40101 SET character_set_client = @saved_cs_client */;
132
133--
134-- Table structure for table `user`
135--
136
137DROP TABLE IF EXISTS `user`;
138/*!40101 SET @saved_cs_client = @@character_set_client */;
139/*!40101 SET character_set_client = utf8 */;
140CREATE TABLE `user` (
141 `userId` int(50) NOT NULL AUTO_INCREMENT,
142 `userName` text NOT NULL,
143 `userMobileNumber` varchar(15) NOT NULL,
144 `userRole` int(50) NOT NULL,
145 `userDeviceID` varchar(50) DEFAULT NULL,
146 `userFCMToken` varchar(50) DEFAULT NULL,
147 `userPassword` varchar(50) DEFAULT NULL,
148 `status` int(1) NOT NULL,
149 `createdOn` date DEFAULT NULL,
150 `createdBy` text,
151 `updatedBy` text,
152 `updatedOn` date DEFAULT NULL,
153 PRIMARY KEY (`userId`),
154 KEY `user` (`userRole`),
155 CONSTRAINT `user` FOREIGN KEY (`userRole`) REFERENCES `user_role` (`roleId`) ON DELETE CASCADE
156) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
157/*!40101 SET character_set_client = @saved_cs_client */;
158
159--
160-- Table structure for table `user_role`
161--
162
163DROP TABLE IF EXISTS `user_role`;
164/*!40101 SET @saved_cs_client = @@character_set_client */;
165/*!40101 SET character_set_client = utf8 */;
166CREATE TABLE `user_role` (
167 `roleId` int(50) NOT NULL,
168 `roleName` varchar(50) NOT NULL,
169 `status` int(2) NOT NULL,
170 `createdOn` date DEFAULT NULL,
171 `createdBy` text,
172 `updatedOn` date DEFAULT NULL,
173 `updatedBy` text,
174 PRIMARY KEY (`roleId`)
175) ENGINE=InnoDB DEFAULT CHARSET=latin1;
176/*!40101 SET character_set_client = @saved_cs_client */;
177
178--
179-- Table structure for table `vehicle`
180--
181
182DROP TABLE IF EXISTS `vehicle`;
183/*!40101 SET @saved_cs_client = @@character_set_client */;
184/*!40101 SET character_set_client = utf8 */;
185CREATE TABLE `vehicle` (
186 `vehicleId` int(50) NOT NULL AUTO_INCREMENT,
187 `vehicleVIN` int(50) NOT NULL,
188 `vehicleOwner` text NOT NULL,
189 `vehicleModel` varchar(50) NOT NULL,
190 `vehicleCommissionedOn` date DEFAULT NULL,
191 `status` int(1) NOT NULL,
192 `updatedBy` text,
193 `updatedOn` date DEFAULT NULL,
194 `createdBy` text,
195 `createdOn` date DEFAULT NULL,
196 PRIMARY KEY (`vehicleId`)
197) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1;
198/*!40101 SET character_set_client = @saved_cs_client */;
199/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
200
201/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
202/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
203/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
204/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
205/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
206/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
207/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
208
209-- Dump completed on 2018-11-20 16:25:16