· 6 years ago · Jan 24, 2020, 07:12 PM
1/*
2SQLyog Community v13.1.1 (64 bit)
3MySQL - 8.0.15 : Database - apartments
4*********************************************************************
5*/
6
7/*!40101 SET NAMES utf8 */;
8
9/*!40101 SET SQL_MODE=''*/;
10
11/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
12/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
13/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
14/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
15CREATE DATABASE /*!32312 IF NOT EXISTS*/`apartments` /*!40100 DEFAULT CHARACTER SET utf8 */;
16
17USE `apartments`;
18
19/*Table structure for table `administrators` */
20
21DROP TABLE IF EXISTS `administrators`;
22
23CREATE TABLE `administrators` (
24 `idAdmin` int(11) NOT NULL AUTO_INCREMENT,
25 `login` varchar(50) NOT NULL DEFAULT '0',
26 `passwd` varchar(255) NOT NULL DEFAULT '0',
27 `privType` tinyint(1) NOT NULL DEFAULT '0',
28 `Name` varchar(100) NOT NULL DEFAULT '0',
29 `isSu` tinyint(1) DEFAULT '0',
30 `isActive` tinyint(1) NOT NULL DEFAULT '1',
31 `attempts` tinyint(1) NOT NULL DEFAULT '0',
32 `created` int(11) NOT NULL DEFAULT '1',
33 `updated` int(11) NOT NULL DEFAULT '1',
34 PRIMARY KEY (`idAdmin`)
35) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
36
37/*Data for the table `administrators` */
38
39insert into `administrators`(`idAdmin`,`login`,`passwd`,`privType`,`Name`,`isSu`,`isActive`,`attempts`,`created`,`updated`) values
40(1,'admin','$2y$10$pbLSn.Kt9VLsHFL6OrxDY.v3RQu0Droz604j655n8GPu.nnxMz086',1,'Super user',1,1,0,123,123);
41
42/*Table structure for table `apartments` */
43
44DROP TABLE IF EXISTS `apartments`;
45
46CREATE TABLE `apartments` (
47 `id` int(11) NOT NULL AUTO_INCREMENT,
48 `idUser` int(11) DEFAULT '0',
49 `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'apartment',
50 `url` varchar(255) DEFAULT NULL,
51 `thumbnail` int(11) DEFAULT '0',
52 `isActive` tinyint(1) DEFAULT '0',
53 `isInRent` tinyint(1) DEFAULT '0',
54 `price` double(16,4) DEFAULT NULL,
55 `created` int(11) DEFAULT '0',
56 `updated` int(11) DEFAULT '0',
57 PRIMARY KEY (`id`)
58) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
59
60/*Data for the table `apartments` */
61
62/*Table structure for table `apartments_availability` */
63
64DROP TABLE IF EXISTS `apartments_availability`;
65
66CREATE TABLE `apartments_availability` (
67 `id` int(11) NOT NULL AUTO_INCREMENT,
68 `idParameter` int(11) DEFAULT NULL,
69 `availableFrom` int(11) DEFAULT '0',
70 `availableUntil` int(11) DEFAULT '0',
71 PRIMARY KEY (`id`),
72 KEY `idParameter` (`idParameter`),
73 CONSTRAINT `apartments_availability_ibfk_1` FOREIGN KEY (`idParameter`) REFERENCES `apartments_parameters` (`id`) ON DELETE CASCADE
74) ENGINE=InnoDB DEFAULT CHARSET=utf8;
75
76/*Data for the table `apartments_availability` */
77
78/*Table structure for table `apartments_descriptions` */
79
80DROP TABLE IF EXISTS `apartments_descriptions`;
81
82CREATE TABLE `apartments_descriptions` (
83 `id` int(11) NOT NULL AUTO_INCREMENT,
84 `idApartment` int(11) NOT NULL,
85 `title` varchar(200) DEFAULT NULL,
86 `description` text,
87 PRIMARY KEY (`id`),
88 KEY `Apartment ID from description` (`idApartment`),
89 CONSTRAINT `Apartment ID from description` FOREIGN KEY (`idApartment`) REFERENCES `apartments` (`id`) ON DELETE CASCADE
90) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
91
92/*Data for the table `apartments_descriptions` */
93
94/*Table structure for table `apartments_gallery` */
95
96DROP TABLE IF EXISTS `apartments_gallery`;
97
98CREATE TABLE `apartments_gallery` (
99 `id` int(11) NOT NULL AUTO_INCREMENT,
100 `idApartment` int(11) DEFAULT '0',
101 `targetFolder` varchar(50) DEFAULT NULL,
102 `hashName` varchar(255) DEFAULT NULL,
103 PRIMARY KEY (`id`)
104) ENGINE=InnoDB DEFAULT CHARSET=utf8;
105
106/*Data for the table `apartments_gallery` */
107
108/*Table structure for table `apartments_groups` */
109
110DROP TABLE IF EXISTS `apartments_groups`;
111
112CREATE TABLE `apartments_groups` (
113 `id` int(11) NOT NULL AUTO_INCREMENT,
114 `sysName` varchar(50) DEFAULT NULL,
115 `humanName` varchar(100) DEFAULT NULL,
116 PRIMARY KEY (`id`)
117) ENGINE=InnoDB DEFAULT CHARSET=utf8;
118
119/*Data for the table `apartments_groups` */
120
121/*Table structure for table `apartments_locations` */
122
123DROP TABLE IF EXISTS `apartments_locations`;
124
125CREATE TABLE `apartments_locations` (
126 `id` int(11) NOT NULL AUTO_INCREMENT,
127 `country` varchar(100) DEFAULT NULL,
128 `city` varchar(100) DEFAULT NULL,
129 `region` varchar(100) DEFAULT NULL,
130 `created` int(11) DEFAULT '0',
131 `updated` int(11) DEFAULT '0',
132 PRIMARY KEY (`id`)
133) ENGINE=InnoDB DEFAULT CHARSET=utf8;
134
135/*Data for the table `apartments_locations` */
136
137/*Table structure for table `apartments_parameters` */
138
139DROP TABLE IF EXISTS `apartments_parameters`;
140
141CREATE TABLE `apartments_parameters` (
142 `id` int(11) NOT NULL AUTO_INCREMENT,
143 `idApartment` int(11) NOT NULL,
144 `idDescription` int(11) DEFAULT NULL,
145 `location` varchar(255) DEFAULT NULL,
146 `children` int(2) DEFAULT '0',
147 `adults` int(2) DEFAULT '0',
148 `beds` int(2) DEFAULT '0',
149 `square` int(3) DEFAULT '0',
150 `additional` text,
151 `created` int(11) DEFAULT '0',
152 `updated` int(11) DEFAULT '0',
153 PRIMARY KEY (`id`),
154 KEY `Apartment description ID` (`idDescription`),
155 KEY `Apartment ID from params` (`idApartment`),
156 CONSTRAINT `Apartment ID from params` FOREIGN KEY (`idApartment`) REFERENCES `apartments` (`id`) ON DELETE CASCADE,
157 CONSTRAINT `Apartment description ID` FOREIGN KEY (`idDescription`) REFERENCES `apartments_descriptions` (`id`) ON DELETE CASCADE
158) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
159
160/*Data for the table `apartments_parameters` */
161
162/*Table structure for table `apartments_requests` */
163
164DROP TABLE IF EXISTS `apartments_requests`;
165
166CREATE TABLE `apartments_requests` (
167 `id` int(11) NOT NULL AUTO_INCREMENT,
168 `idUser` int(11) DEFAULT '0',
169 `idApartment` int(11) DEFAULT '0',
170 `requestNumber` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
171 `message` text,
172 `status` tinyint(1) DEFAULT '0',
173 `created` int(11) DEFAULT '0',
174 PRIMARY KEY (`id`)
175) ENGINE=InnoDB DEFAULT CHARSET=utf8;
176
177/*Data for the table `apartments_requests` */
178
179/*Table structure for table `auth_tokens` */
180
181DROP TABLE IF EXISTS `auth_tokens`;
182
183CREATE TABLE `auth_tokens` (
184 `idToken` int(11) NOT NULL AUTO_INCREMENT,
185 `token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
186 `tokenFor` varchar(200) DEFAULT NULL,
187 `isActive` tinyint(1) DEFAULT '0',
188 `created` int(11) DEFAULT '0',
189 `updated` int(11) DEFAULT '0',
190 PRIMARY KEY (`idToken`)
191) ENGINE=InnoDB DEFAULT CHARSET=utf8;
192
193/*Data for the table `auth_tokens` */
194
195/*Table structure for table `chat_messages` */
196
197DROP TABLE IF EXISTS `chat_messages`;
198
199CREATE TABLE `chat_messages` (
200 `id` int(11) NOT NULL AUTO_INCREMENT,
201 `senderId` int(11) DEFAULT '0',
202 `userId` int(11) DEFAULT NULL,
203 `msg` text,
204 `isReadByAdmin` tinyint(1) DEFAULT '0',
205 `isRead` tinyint(1) DEFAULT '0',
206 `isAdmin` tinyint(1) DEFAULT '0',
207 `created` int(11) DEFAULT '0',
208 PRIMARY KEY (`id`)
209) ENGINE=InnoDB DEFAULT CHARSET=utf8;
210
211/*Data for the table `chat_messages` */
212
213/*Table structure for table `contact` */
214
215DROP TABLE IF EXISTS `contact`;
216
217CREATE TABLE `contact` (
218 `idMsg` int(11) NOT NULL AUTO_INCREMENT,
219 `contactEmail` varchar(150) DEFAULT '0',
220 `contactText` text,
221 `ip` varchar(150) DEFAULT NULL,
222 `answered` tinyint(11) DEFAULT '0',
223 `created` int(11) DEFAULT '0',
224 KEY `idMsg` (`idMsg`)
225) ENGINE=InnoDB DEFAULT CHARSET=utf8;
226
227/*Data for the table `contact` */
228
229/*Table structure for table `currencies` */
230
231DROP TABLE IF EXISTS `currencies`;
232
233CREATE TABLE `currencies` (
234 `id` int(11) NOT NULL AUTO_INCREMENT,
235 `currencyCode` varchar(5) DEFAULT NULL,
236 `currencyName` varchar(35) DEFAULT NULL,
237 `exchangeRate` double(16,5) DEFAULT '0.00000',
238 `created` int(11) DEFAULT NULL,
239 PRIMARY KEY (`id`)
240) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
241
242/*Data for the table `currencies` */
243
244insert into `currencies`(`id`,`currencyCode`,`currencyName`,`exchangeRate`,`created`) values
245(1,'EUR','Евро',18.50000,12313123),
246(2,'USD','Доллар',16.50000,1576895741);
247
248/*Table structure for table `orders_list` */
249
250DROP TABLE IF EXISTS `orders_list`;
251
252CREATE TABLE `orders_list` (
253 `id` int(11) NOT NULL AUTO_INCREMENT,
254 `idUser` int(11) DEFAULT NULL,
255 PRIMARY KEY (`id`)
256) ENGINE=InnoDB DEFAULT CHARSET=utf8;
257
258/*Data for the table `orders_list` */
259
260/*Table structure for table `push_clients` */
261
262DROP TABLE IF EXISTS `push_clients`;
263
264CREATE TABLE `push_clients` (
265 `id` int(11) NOT NULL AUTO_INCREMENT,
266 `pushToken` varchar(255) DEFAULT NULL,
267 `created` int(11) DEFAULT '0',
268 `updated` int(11) DEFAULT '0',
269 PRIMARY KEY (`id`)
270) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
271
272/*Data for the table `push_clients` */
273
274insert into `push_clients`(`id`,`pushToken`,`created`,`updated`) values
275(2,'W',1574466691,1574466691),
276(3,'WEIJFIWEJF293JWFIWENFWENF239WEFFIWIOJFIWQF2',1574545530,1574545530);
277
278/*Table structure for table `push_notifications` */
279
280DROP TABLE IF EXISTS `push_notifications`;
281
282CREATE TABLE `push_notifications` (
283 `int` int(11) NOT NULL AUTO_INCREMENT,
284 `fcmToken` varchar(255) DEFAULT NULL,
285 `userId` int(11) DEFAULT '0',
286 `msgTitle` varchar(100) DEFAULT NULL,
287 `msgContent` text,
288 `created` int(11) DEFAULT '0',
289 `updated` int(11) DEFAULT '0',
290 PRIMARY KEY (`int`)
291) ENGINE=InnoDB DEFAULT CHARSET=utf8;
292
293/*Data for the table `push_notifications` */
294
295/*Table structure for table `registered_users` */
296
297DROP TABLE IF EXISTS `registered_users`;
298
299CREATE TABLE `registered_users` (
300 `id` int(11) NOT NULL AUTO_INCREMENT,
301 `userName` varchar(100) DEFAULT NULL,
302 `userType` enum('guest','registered') DEFAULT NULL,
303 `authToken` varchar(100) DEFAULT NULL,
304 `idPushClient` int(11) DEFAULT '0',
305 `passwd` varchar(100) DEFAULT NULL,
306 `phoneNumber` varchar(70) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
307 `email` varchar(150) DEFAULT NULL,
308 `ipAddr` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
309 `fullName` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
310 `isActive` tinyint(1) DEFAULT '0',
311 `canSell` tinyint(1) DEFAULT '0',
312 `filterName` varchar(255) DEFAULT NULL,
313 `created` int(11) DEFAULT '0',
314 `updated` int(11) DEFAULT '0',
315 PRIMARY KEY (`id`)
316) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
317
318/*Data for the table `registered_users` */
319
320insert into `registered_users`(`id`,`userName`,`userType`,`authToken`,`idPushClient`,`passwd`,`phoneNumber`,`email`,`ipAddr`,`fullName`,`isActive`,`canSell`,`filterName`,`created`,`updated`) values
321(1,'qweqweqweqwe','registered','386b9729aec17ac4dd68',2,'$2y$10$3Ekwkj0Q9Nd9li7kklAh0eY2H2JEGlrG4IoLb94gV9YCNJEB9nqe2','+37377777158','tester@gmail.com','127.0.0.1','test test3QQ',0,1,'tesssstt',1573767136,1573767136),
322(5,'dratuti','guest','a072a59c81e8064cda00',3,NULL,'+37377777151','dratuti@gmail.com','127.0.0.1','дратути',1,0,NULL,1574545943,1574545943),
323(6,'admin',NULL,NULL,0,'$2y$10$Wc7aqUrzVaWiFiS/Aom8OOHbUVoN.JXfMgurfneoAIayt1g5HWto6','+37377747542','adminadmin@gmail.com','127.0.0.1','adminadminwqeq',1,1,NULL,1576897249,1576897249);
324
325/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
326/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
327/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
328/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;