-
Notifications
You must be signed in to change notification settings - Fork 0
/
ventum.sql
398 lines (366 loc) · 14.4 KB
/
ventum.sql
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
CREATE DATABASE IF NOT EXISTS `ventum-dev` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `ventum-dev`;
-- MySQL dump 10.13 Distrib 8.0.13, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: eventos-dev
-- ------------------------------------------------------
-- Server version 5.5.5-10.1.37-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
SET NAMES utf8 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `address`
--
DROP TABLE IF EXISTS `address`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`address_name` varchar(255) NOT NULL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`second_last_name` varchar(255) DEFAULT NULL,
`company_name` varchar(255) DEFAULT NULL,
`internal_number` varchar(10) NOT NULL,
`external_number` varchar(10) DEFAULT NULL,
`floor` varchar(10) DEFAULT NULL,
`street_address_1` varchar(255) NOT NULL,
`street_address_2` varchar(255) DEFAULT NULL,
`reference_notes` longtext,
`country_id` int(11) NOT NULL,
`state_id` int(11) NOT NULL,
`municipality_id` int(11) NOT NULL,
`locality_id` int(11) DEFAULT NULL,
`asent_id` int(11) NOT NULL,
`postal_code` varchar(15) NOT NULL,
`phone` varchar(50) NOT NULL,
`payment_address` tinyint(1) NOT NULL,
`default_address` tinyint(1) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `country_id` (`country_id`),
KEY `state_id` (`state_id`),
KEY `municipality_id` (`municipality_id`),
KEY `locality_id` (`locality_id`),
KEY `asent_id` (`asent_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `address_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
CONSTRAINT `address_ibfk_2` FOREIGN KEY (`state_id`) REFERENCES `state` (`id`),
CONSTRAINT `address_ibfk_3` FOREIGN KEY (`municipality_id`) REFERENCES `municipality` (`id`),
CONSTRAINT `address_ibfk_4` FOREIGN KEY (`locality_id`) REFERENCES `locality` (`id`),
CONSTRAINT `address_ibfk_5` FOREIGN KEY (`asent_id`) REFERENCES `asent` (`id`),
CONSTRAINT `address_ibfk_6` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `asent`
--
DROP TABLE IF EXISTS `asent`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `asent` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`postal_code` varchar(10) NOT NULL,
`name` varchar(255) NOT NULL,
`asent_type_id` int(11) NOT NULL,
`zone_type` varchar(15) DEFAULT NULL,
`municipality_id` int(11) NOT NULL,
`locality_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `asent_type_id` (`asent_type_id`),
KEY `municipality_id` (`municipality_id`),
KEY `locality_id` (`locality_id`),
KEY `postal_code` (`postal_code`),
CONSTRAINT `asent_ibfk_1` FOREIGN KEY (`asent_type_id`) REFERENCES `asent_type` (`id`),
CONSTRAINT `asent_ibfk_2` FOREIGN KEY (`municipality_id`) REFERENCES `municipality` (`id`),
CONSTRAINT `asent_ibfk_3` FOREIGN KEY (`locality_id`) REFERENCES `locality` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=145974 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `asent_type`
--
DROP TABLE IF EXISTS `asent_type`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `asent_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country`
--
DROP TABLE IF EXISTS `country`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(4) NOT NULL,
`phone_code` varchar(30) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=241 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `locality`
--
DROP TABLE IF EXISTS `locality`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `locality` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`municipality_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`code` varchar(4) NOT NULL,
`latitude` decimal(10,7) DEFAULT NULL,
`longitude` decimal(10,7) DEFAULT NULL,
`altitude` varchar(15) DEFAULT NULL,
`type` varchar(1) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `municipality_id` (`municipality_id`),
CONSTRAINT `locality_ibfk_1` FOREIGN KEY (`municipality_id`) REFERENCES `municipality` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=304496 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `municipality`
--
DROP TABLE IF EXISTS `municipality`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `municipality` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`state_id` int(11) NOT NULL,
`code` varchar(3) NOT NULL,
`name` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `state_id` (`state_id`),
CONSTRAINT `municipality_ibfk_1` FOREIGN KEY (`state_id`) REFERENCES `state` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2464 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `rol`
--
DROP TABLE IF EXISTS `rol`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `rol` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rol_name` varchar(255) DEFAULT NULL,
`rol_description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `session`
--
DROP TABLE IF EXISTS `session`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `session` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_session_id` int(11) DEFAULT NULL,
`token` varchar(250) NOT NULL,
`ip` varchar(250) DEFAULT NULL,
`setted_at` datetime NOT NULL,
`finished_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `user_session_id` (`user_session_id`),
CONSTRAINT `session_ibfk_1` FOREIGN KEY (`user_session_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `state`
--
DROP TABLE IF EXISTS `state`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `state` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(2) NOT NULL,
`name` varchar(255) NOT NULL,
`name_abbr` varchar(10) DEFAULT NULL,
`country_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `country_id` (`country_id`),
CONSTRAINT `state_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`second_last_name` varchar(255) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`pin` varchar(4) DEFAULT NULL,
`phone` varchar(30) NOT NULL,
`date_of_birth` datetime DEFAULT NULL,
`created_at` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
`rol_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `phone` (`phone`),
KEY `user_ibfk_1` (`rol_id`),
CONSTRAINT `user_ibfk_1` FOREIGN KEY (`rol_id`) REFERENCES `rol` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
CREATE TABLE IF NOT EXISTS user_customer_info (
id INT AUTO_INCREMENT PRIMARY KEY,
user_name VARCHAR(255) NOT NULL,
first_last_name VARCHAR(255) NULL DEFAULT NULL,
second_last_name VARCHAR(255) NULL DEFAULT NULL,
age INT NULL DEFAULT 0,
gender VARCHAR(255) NULL DEFAULT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
weight VARCHAR(255) NULL DEFAULT NULL,
height VARCHAR(255) NULL DEFAULT NULL,
phone_number VARCHAR(255) NULL DEFAULT NULL,
weekly_hours VARCHAR(255) NULL DEFAULT NULL,
city VARCHAR(255) NULL DEFAULT NULL,
created_at DATETIME,
updated_at DATETIME,
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS payment_card (
id INT AUTO_INCREMENT PRIMARY KEY,
payment_token VARCHAR(200) NOT NULL,
payment_type VARCHAR(15) NULL DEFAULT NULL,
payment_card_brand VARCHAR(25) NULL DEFAULT NULL,
payment_card_last4 VARCHAR(10) NULL DEFAULT NULL,
payment_card_exp_month VARCHAR(10) NULL DEFAULT NULL,
payment_card_exp_year VARCHAR(10) NULL DEFAULT NULL,
payment_card_user_name VARCHAR(40) NULL DEFAULT NULL,
customer_id_conekta VARCHAR(250) NULL DEFAULT NULL,
default_payment BOOLEAN DEFAULT TRUE,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS customer_conekta (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_id VARCHAR(255) NULL DEFAULT NULL,
name VARCHAR(255) NULL DEFAULT NULL,
lastname VARCHAR(255) NULL DEFAULT NULL,
email VARCHAR(100) NULL DEFAULT NULL,
phone VARCHAR(40) NULL DEFAULT NULL,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS subscription_conekta (
id INT AUTO_INCREMENT PRIMARY KEY,
subscription_id VARCHAR(70) NULL DEFAULT NULL,
subscription_status VARCHAR(200) NULL DEFAULT NULL,
billing_cicle_start DATETIME NULL DEFAULT NOW(),
billing_cicle_end DATETIME NULL DEFAULT NOW(),
plan_id VARCHAR(255) NULL DEFAULT NULL,
payment_method VARCHAR(255) NULL DEFAULT NULL,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS logs_conekta (
id INT AUTO_INCREMENT PRIMARY KEY,
event_id VARCHAR(255) NULL DEFAULT NULL,
type VARCHAR(255) NULL DEFAULT NULL,
ignored BOOLEAN DEFAULT TRUE,
content TEXT,
raw TEXT,
alarm BOOLEAN DEFAULT FALSE,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS conekta_webhook (
id INT AUTO_INCREMENT PRIMARY KEY,
event_type VARCHAR(255) NULL DEFAULT NULL,
date_received DATETIME NULL DEFAULT NOW(),
date_created DATETIME NULL DEFAULT NOW(),
processed BOOLEAN DEFAULT FALSE,
event_id VARCHAR(255) NULL DEFAULT NULL,
payload TEXT DEFAULT '',
customer_id VARCHAR(255) NULL DEFAULT NULL,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS user_direction (
id INT AUTO_INCREMENT PRIMARY KEY,
shipping_email VARCHAR(255) NULL DEFAULT NULL,
shipping_phone VARCHAR(255) NULL DEFAULT NULL,
shipping_receiver_name VARCHAR(100) NULL DEFAULT NULL,
shipping_address_street VARCHAR(200) NULL DEFAULT NULL,
shipping_address_internal_number VARCHAR(20) NULL DEFAULT NULL,
shipping_address_external_number VARCHAR(20) NULL DEFAULT NULL,
shipping_address_country VARCHAR(100) NULL DEFAULT NULL,
shipping_address_state VARCHAR(180) NULL DEFAULT NULL,
shipping_address_city VARCHAR(180) NULL DEFAULT NULL,
shipping_address_asent VARCHAR(200) NULL DEFAULT NULL,
shipping_address_postalcode VARCHAR(10) NULL DEFAULT NULL,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS permission (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
permission_name VARCHAR(255) NULL DEFAULT NULL,
description TEXT NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS user_permission (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
user_id INT(11) NOT NULL,
permission_id INT(11) NOT NULL,
created_at DATETIME NULL DEFAULT NOW(),
updated_at DATETIME NULL DEFAULT NOW(),
active BOOLEAN DEFAULT FALSE,
KEY `user_id` (`user_id`),
KEY `permission_id` (`permission_id`),
CONSTRAINT FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT FOREIGN KEY (`permission_id`) REFERENCES `permission` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-05-22 2:44:12