forked from calinrada/PhalconUserPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
237 lines (200 loc) · 8.14 KB
/
schema.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
-- Host: localhost
-- Generation Time: Oct 25, 2013 at 09:53 AM
-- Server version: 5.5.32
-- PHP Version: 5.5.5-1+debphp.org~precise+1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Table structure for table `locations`
--
DROP TABLE IF EXISTS `locations`;
CREATE TABLE IF NOT EXISTS `locations` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`language` char(2) COLLATE utf8_bin DEFAULT NULL,
`formatted_address` varchar(160) COLLATE utf8_bin DEFAULT NULL,
`city` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`country` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`latitude` float(10,6) DEFAULT NULL,
`longitude` float(10,6) DEFAULT NULL,
`geo_point` point DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `city` (`city`,`country`,`formatted_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=7 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`email` varchar(48) COLLATE utf8_bin NOT NULL,
`password` varchar(128) COLLATE utf8_bin NOT NULL,
`facebook_id` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`facebook_name` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`facebook_data` text COLLATE utf8_bin,
`linkedin_id` int(11) DEFAULT NULL,
`linkedin_name` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`linkedin_data` text COLLATE utf8_bin,
`gplus_id` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`gplus_name` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`gplus_data` text COLLATE utf8_bin,
`twitter_id` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`twitter_name` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`twitter_data` text COLLATE utf8_bin,
`must_change_password` tinyint(1) DEFAULT NULL,
`profile_id` bigint(20) unsigned DEFAULT NULL,
`group_id` tinyint(3) unsigned NOT NULL,
`banned` tinyint(1) NOT NULL,
`suspended` tinyint(1) NOT NULL,
`active` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `facebook_id` (`facebook_id`,`facebook_name`),
KEY `linkedin_id` (`linkedin_id`,`linkedin_name`),
KEY `gplus_id` (`gplus_id`,`gplus_name`,`twitter_id`,`twitter_name`),
KEY `name` (`name`),
KEY `profile_id` (`profile_id`),
KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=9 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_email_confirmations`
--
DROP TABLE IF EXISTS `user_email_confirmations`;
CREATE TABLE IF NOT EXISTS `user_email_confirmations` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`code` char(32) COLLATE utf8_bin NOT NULL,
`created_at` datetime NOT NULL,
`modified_at` datetime DEFAULT NULL,
`confirmed` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=12 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_failed_logins`
--
DROP TABLE IF EXISTS `user_failed_logins`;
CREATE TABLE IF NOT EXISTS `user_failed_logins` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned DEFAULT NULL,
`ip_address` char(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`attempted` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `usersId` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=37 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_groups`
--
DROP TABLE IF EXISTS `user_groups`;
CREATE TABLE IF NOT EXISTS `user_groups` (
`id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) COLLATE utf8_bin NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `active` (`active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=4 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_notifications`
--
DROP TABLE IF EXISTS `user_notifications`;
CREATE TABLE IF NOT EXISTS `user_notifications` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`object_id` bigint(20) NOT NULL,
`object_source` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'Object source can be a table. For example, articles. Then object_id is the id from article table',
`content` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`is_seen` tinyint(1) DEFAULT '0',
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_password_changes`
--
DROP TABLE IF EXISTS `user_password_changes`;
CREATE TABLE IF NOT EXISTS `user_password_changes` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`ip_address` char(15) COLLATE utf8_bin NOT NULL,
`user_agent` varchar(255) COLLATE utf8_bin NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=13 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_permissions`
--
DROP TABLE IF EXISTS `user_permissions`;
CREATE TABLE IF NOT EXISTS `user_permissions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group_id` tinyint(3) unsigned NOT NULL,
`resource` varchar(16) COLLATE utf8_bin NOT NULL,
`action` varchar(16) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `usersId` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=123 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_profile`
--
DROP TABLE IF EXISTS `user_profile`;
CREATE TABLE IF NOT EXISTS `user_profile` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`picture` varchar(255) DEFAULT NULL,
`birth_date` date DEFAULT NULL,
`gender` tinyint(1) DEFAULT NULL COMMENT '0=male, 1=female',
`home_location_id` bigint(20) unsigned DEFAULT NULL,
`current_location_id` bigint(20) unsigned DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_remember_tokens`
--
DROP TABLE IF EXISTS `user_remember_tokens`;
CREATE TABLE IF NOT EXISTS `user_remember_tokens` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`token` char(32) COLLATE utf8_bin NOT NULL,
`user_agent` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`created_at` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `token` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_reset_passwords`
--
DROP TABLE IF EXISTS `user_reset_passwords`;
CREATE TABLE IF NOT EXISTS `user_reset_passwords` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`code` varchar(48) COLLATE utf8_bin NOT NULL,
`created_at` datetime NOT NULL,
`modified_at` datetime DEFAULT NULL,
`reset` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `usersId` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_success_logins`
--
DROP TABLE IF EXISTS `user_success_logins`;
CREATE TABLE IF NOT EXISTS `user_success_logins` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`ip_address` char(15) COLLATE utf8_bin NOT NULL,
`user_agent` varchar(255) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `usersId` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=238 ;