-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathtables.sql
280 lines (237 loc) · 12.3 KB
/
tables.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
SET FOREIGN_KEY_CHECKS = 0;
CREATE TABLE `categories` (
`id` int(11) NOT NULL auto_increment,
`slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`title` varchar(20) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `slug - unique` (`slug`),
UNIQUE KEY `title - unique` (`title`),
KEY `slug - normal` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Product and Supplier Categories';
CREATE TABLE `comments` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`name` varchar(40) collate utf8_unicode_ci NOT NULL,
`email` varchar(40) collate utf8_unicode_ci NOT NULL,
`body` text collate utf8_unicode_ci NOT NULL,
`module` varchar(40) collate utf8_unicode_ci NOT NULL,
`module_id` varchar(255) collate utf8_unicode_ci NOT NULL,
`created_on` varchar(11) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Comments by users or guests';
CREATE TABLE `emails` (
`email` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`registered_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='E-mail addresses for newsletter subscriptions';
CREATE TABLE `galleries` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`description` text collate utf8_unicode_ci NOT NULL,
`parent` int(11) NOT NULL default '0',
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Galleries (like categories) for photos';
CREATE TABLE `navigation_groups` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(50) collate utf8_unicode_ci NOT NULL,
`abbrev` varchar(20) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Navigation groupings. Eg, header, sidebar, footer, etc';
CREATE TABLE `navigation_links` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`page_id` int(11) NOT NULL default '0',
`module_name` varchar(50) collate utf8_unicode_ci NOT NULL default '',
`url` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`uri` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`navigation_group_id` int(5) NOT NULL default '0',
`position` int(5) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `navigation_group_id - normal` (`navigation_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Links for site navigation';
CREATE TABLE `news` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`slug` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`category_id` int(11) NOT NULL,
`attachment` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`intro` text collate utf8_unicode_ci NOT NULL,
`body` text collate utf8_unicode_ci NOT NULL,
`created_on` int(11) NOT NULL,
`updated_on` int(11) NOT NULL,
`status` enum('draft','live') collate utf8_unicode_ci NOT NULL default 'draft',
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`),
KEY `category_id - normal` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='News articles or blog posts.';
CREATE TABLE `newsletters` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`title` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`body` text collate utf8_unicode_ci NOT NULL,
`created_on` int(11) default NULL,
`sent_on` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Newsletter emails stored before being sent then archived her';
CREATE TABLE `packages` (
`title` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`description` text collate utf8_unicode_ci NOT NULL,
`featured` enum('Y','N') collate utf8_unicode_ci NOT NULL default 'N',
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`slug`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Packages contain services and products';
CREATE TABLE `pages` (
`id` int(11) unsigned NOT NULL auto_increment,
`slug` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`title` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`body` text collate utf8_unicode_ci NOT NULL,
`parent` int(11) default '0',
`lang` varchar(2) collate utf8_unicode_ci NOT NULL,
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `Language Unique` (`slug`,`lang`),
KEY `slug` (`slug`),
KEY `parent` (`parent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='User Editable Pages';
CREATE TABLE `permission_roles` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(100) collate utf8_unicode_ci NOT NULL,
`abbrev` varchar(50) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permission roles such as admins, moderators, staff, etc';
CREATE TABLE `permission_rules` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`permission_role_id` int(11) NOT NULL,
`module` varchar(50) collate utf8_unicode_ci NOT NULL,
`controller` varchar(50) collate utf8_unicode_ci NOT NULL,
`method` varchar(50) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permission rules for permission roles';
CREATE TABLE `photos` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`gallery_slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`filename` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`description` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Contains photos...';
CREATE TABLE `products` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`title` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`description` text collate utf8_unicode_ci NOT NULL,
`price` float NOT NULL default '0',
`category_slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`supplier_slug` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`frontpage` enum('Y','N') collate utf8_unicode_ci NOT NULL default 'N',
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
KEY `supplier_slug` (`supplier_slug`),
KEY `category_slug` (`category_slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Product Information';
CREATE TABLE `products_images` (
`image_id` int(15) NOT NULL auto_increment,
`filename` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`product_id` smallint(5) unsigned NOT NULL default '0',
`for_display` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`image_id`),
KEY `product_id` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Product Images';
CREATE TABLE `profiles` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`bio` text collate utf8_unicode_ci NOT NULL,
`dob` int(11) NOT NULL,
`gender` set('m','f','') collate utf8_unicode_ci NOT NULL,
`phone` varchar(20) collate utf8_unicode_ci NOT NULL,
`mobile` varchar(20) collate utf8_unicode_ci NOT NULL,
`address_line1` varchar(255) collate utf8_unicode_ci NOT NULL,
`address_line2` varchar(255) collate utf8_unicode_ci NOT NULL,
`address_line3` varchar(255) collate utf8_unicode_ci NOT NULL,
`postcode` varchar(20) collate utf8_unicode_ci NOT NULL,
`msn_handle` varchar(100) collate utf8_unicode_ci NOT NULL,
`aim_handle` varchar(100) collate utf8_unicode_ci NOT NULL,
`yim_handle` varchar(100) collate utf8_unicode_ci NOT NULL,
`gtalk_handle` varchar(100) collate utf8_unicode_ci NOT NULL,
`gravatar` varchar(100) collate utf8_unicode_ci NOT NULL,
`updated_on` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Extra data for users. Not always enabled';
CREATE TABLE `services` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`description` text collate utf8_unicode_ci NOT NULL,
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
`price` float(11,2) NOT NULL,
`pay_per` varchar(20) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Services are just pages with prices involved';
CREATE TABLE `settings` (
`slug` varchar(30) collate utf8_unicode_ci NOT NULL,
`title` varchar(100) collate utf8_unicode_ci NOT NULL,
`description` text collate utf8_unicode_ci NOT NULL,
`type` set('text','textarea','select','select-multiple','radio','checkbox') collate utf8_unicode_ci NOT NULL,
`default` varchar(255) collate utf8_unicode_ci NOT NULL,
`value` varchar(255) collate utf8_unicode_ci NOT NULL,
`options` varchar(255) collate utf8_unicode_ci NOT NULL,
`is_required` tinyint(1) NOT NULL,
`is_gui` tinyint(1) NOT NULL,
`module` varchar(50) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`slug`),
UNIQUE KEY `unique - slug` (`slug`),
KEY `index - slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Stores all sorts of settings for the admin to change';
CREATE TABLE `staff` (
`id` int(11) NOT NULL auto_increment,
`slug` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`user_id` int(11) NOT NULL,
`name` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`email` varchar(40) collate utf8_unicode_ci NOT NULL,
`position` varchar(40) collate utf8_unicode_ci default NULL,
`body` text collate utf8_unicode_ci NOT NULL,
`fact` text collate utf8_unicode_ci,
`filename` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `slug` (`slug`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Staff Member information (similar to a profile, but independ';
CREATE TABLE `suppliers` (
`id` int(11) NOT NULL auto_increment,
`slug` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`title` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`description` text collate utf8_unicode_ci NOT NULL,
`url` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`image` varchar(40) collate utf8_unicode_ci default NULL,
`updated_on` varchar(11) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Supplier Information';
CREATE TABLE `suppliers_categories` (
`supplier_id` int(11) NOT NULL default '0',
`category_id` int(11) NOT NULL default '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `users` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`email` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`password` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`salt` varchar(5) collate utf8_unicode_ci NOT NULL default '',
`first_name` varchar(40) collate utf8_unicode_ci NOT NULL,
`last_name` varchar(40) collate utf8_unicode_ci NOT NULL default '',
`role` varchar(40) collate utf8_unicode_ci NOT NULL,
`lang` varchar(2) collate utf8_unicode_ci NOT NULL,
`ip` varchar(11) collate utf8_unicode_ci NOT NULL,
`is_active` int(1) NOT NULL,
`activation_code` varchar(8) collate utf8_unicode_ci NOT NULL,
`created_on` int(11) NOT NULL,
`last_login` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registered User Information';