source: trunk/install/piwigo_structure-mysql.sql @ 28532

Last change on this file since 28532 was 28532, checked in by mistic100, 10 years ago

feature 3077 : improve cache invalidation

  • add "lastmodified" automatic field for categories, groups, users, tags and images tables
  • provide a "server key" to the client cache manager
  • Property svn:eol-style set to LF
File size: 14.3 KB
Line 
1-- MySQL dump 9.11
2--
3-- Host: localhost    Database: pwg-bsf
4-- ------------------------------------------------------
5-- Server version       4.0.24_Debian-10-log
6
7--
8-- Table structure for table `piwigo_caddie`
9--
10
11DROP TABLE IF EXISTS `piwigo_caddie`;
12CREATE TABLE `piwigo_caddie` (
13  `user_id` smallint(5) NOT NULL default '0',
14  `element_id` mediumint(8) NOT NULL default '0',
15  PRIMARY KEY  (`user_id`,`element_id`)
16) ENGINE=MyISAM;
17
18--
19-- Table structure for table `piwigo_categories`
20--
21
22DROP TABLE IF EXISTS `piwigo_categories`;
23CREATE TABLE `piwigo_categories` (
24  `id` smallint(5) unsigned NOT NULL auto_increment,
25  `name` varchar(255) NOT NULL default '',
26  `id_uppercat` smallint(5) unsigned default NULL,
27  `comment` text,
28  `dir` varchar(255) default NULL,
29  `rank` smallint(5) unsigned default NULL,
30  `status` enum('public','private') NOT NULL default 'public',
31  `site_id` tinyint(4) unsigned default NULL,
32  `visible` enum('true','false') NOT NULL default 'true',
33  `representative_picture_id` mediumint(8) unsigned default NULL,
34  `uppercats` varchar(255) NOT NULL default '',
35  `commentable` enum('true','false') NOT NULL default 'true',
36  `global_rank` varchar(255) default NULL,
37  `image_order` varchar(128) default NULL,
38  `permalink` varchar(64) binary default NULL,
39  `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
40  PRIMARY KEY  (`id`),
41  UNIQUE KEY `categories_i3` (`permalink`),
42  KEY `categories_i2` (`id_uppercat`),
43  KEY `lastmodified` (`lastmodified`)
44) ENGINE=MyISAM;
45
46--
47-- Table structure for table `piwigo_comments`
48--
49
50DROP TABLE IF EXISTS `piwigo_comments`;
51CREATE TABLE `piwigo_comments` (
52  `id` int(11) unsigned NOT NULL auto_increment,
53  `image_id` mediumint(8) unsigned NOT NULL default '0',
54  `date` datetime NOT NULL default '0000-00-00 00:00:00',
55  `author` varchar(255) default NULL,
56  `email` varchar(255) default NULL,
57  `author_id` smallint(5) DEFAULT NULL,
58  `anonymous_id` varchar(45) NOT NULL,
59  `website_url` varchar(255) DEFAULT NULL,
60  `content` longtext,
61  `validated` enum('true','false') NOT NULL default 'false',
62  `validation_date` datetime default NULL,
63  PRIMARY KEY  (`id`),
64  KEY `comments_i2` (`validation_date`),
65  KEY `comments_i1` (`image_id`)
66) ENGINE=MyISAM;
67
68--
69-- Table structure for table `piwigo_config`
70--
71
72DROP TABLE IF EXISTS `piwigo_config`;
73CREATE TABLE `piwigo_config` (
74  `param` varchar(40) NOT NULL default '',
75  `value` text,
76  `comment` varchar(255) default NULL,
77  PRIMARY KEY  (`param`)
78) ENGINE=MyISAM COMMENT='configuration table';
79
80--
81-- Table structure for table `piwigo_favorites`
82--
83
84DROP TABLE IF EXISTS `piwigo_favorites`;
85CREATE TABLE `piwigo_favorites` (
86  `user_id` smallint(5) NOT NULL default '0',
87  `image_id` mediumint(8) unsigned NOT NULL default '0',
88  PRIMARY KEY  (`user_id`,`image_id`)
89) ENGINE=MyISAM;
90
91--
92-- Table structure for table `piwigo_group_access`
93--
94
95DROP TABLE IF EXISTS `piwigo_group_access`;
96CREATE TABLE `piwigo_group_access` (
97  `group_id` smallint(5) unsigned NOT NULL default '0',
98  `cat_id` smallint(5) unsigned NOT NULL default '0',
99  PRIMARY KEY  (`group_id`,`cat_id`)
100) ENGINE=MyISAM;
101
102--
103-- Table structure for table `piwigo_groups`
104--
105
106DROP TABLE IF EXISTS `piwigo_groups`;
107CREATE TABLE `piwigo_groups` (
108  `id` smallint(5) unsigned NOT NULL auto_increment,
109  `name` varchar(255) NOT NULL default '',
110  `is_default` enum('true','false') NOT NULL default 'false',
111  `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
112  PRIMARY KEY  (`id`),
113  UNIQUE KEY `groups_ui1` (`name`),
114  KEY `lastmodified` (`lastmodified`)
115) ENGINE=MyISAM;
116
117--
118-- Table structure for table `piwigo_history`
119--
120
121DROP TABLE IF EXISTS `piwigo_history`;
122CREATE TABLE `piwigo_history` (
123  `id` int(10) unsigned NOT NULL auto_increment,
124  `date` date NOT NULL default '0000-00-00',
125  `time` time NOT NULL default '00:00:00',
126  `user_id` smallint(5) NOT NULL default '0',
127  `IP` varchar(15) NOT NULL default '',
128  `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL,
129  `category_id` smallint(5) default NULL,
130  `tag_ids` varchar(50) default NULL,
131  `image_id` mediumint(8) default NULL,
132  `summarized` enum('true','false') default 'false',
133  `image_type` enum('picture','high','other') default NULL,
134  PRIMARY KEY  (`id`),
135  KEY `history_i1` (`summarized`)
136) ENGINE=MyISAM;
137
138--
139-- Table structure for table `piwigo_history_summary`
140--
141
142DROP TABLE IF EXISTS `piwigo_history_summary`;
143CREATE TABLE `piwigo_history_summary` (
144  `year` smallint(4) NOT NULL default '0',
145  `month` tinyint(2) default NULL,
146  `day` tinyint(2) default NULL,
147  `hour` tinyint(2) default NULL,
148  `nb_pages` int(11) default NULL,
149  UNIQUE KEY history_summary_ymdh (`year`,`month`,`day`,`hour`)
150) ENGINE=MyISAM;
151
152--
153-- Table structure for table `piwigo_image_category`
154--
155
156DROP TABLE IF EXISTS `piwigo_image_category`;
157CREATE TABLE `piwigo_image_category` (
158  `image_id` mediumint(8) unsigned NOT NULL default '0',
159  `category_id` smallint(5) unsigned NOT NULL default '0',
160  `rank` mediumint(8) unsigned default NULL,
161  PRIMARY KEY  (`image_id`,`category_id`),
162  KEY `image_category_i1` (`category_id`)
163) ENGINE=MyISAM;
164
165--
166-- Table structure for table `piwigo_image_tag`
167--
168
169DROP TABLE IF EXISTS `piwigo_image_tag`;
170CREATE TABLE `piwigo_image_tag` (
171  `image_id` mediumint(8) unsigned NOT NULL default '0',
172  `tag_id` smallint(5) unsigned NOT NULL default '0',
173  PRIMARY KEY  (`image_id`,`tag_id`),
174  KEY `image_tag_i1` (`tag_id`)
175) ENGINE=MyISAM;
176
177--
178-- Table structure for table `piwigo_images`
179--
180
181DROP TABLE IF EXISTS `piwigo_images`;
182CREATE TABLE `piwigo_images` (
183  `id` mediumint(8) unsigned NOT NULL auto_increment,
184  `file` varchar(255) binary NOT NULL default '',
185  `date_available` datetime NOT NULL default '0000-00-00 00:00:00',
186  `date_creation` datetime default NULL,
187  `name` varchar(255) default NULL,
188  `comment` text,
189  `author` varchar(255) default NULL,
190  `hit` int(10) unsigned NOT NULL default '0',
191  `filesize` mediumint(9) unsigned default NULL,
192  `width` smallint(9) unsigned default NULL,
193  `height` smallint(9) unsigned default NULL,
194  `coi` char(4) default NULL COMMENT 'center of interest',
195  `representative_ext` varchar(4) default NULL,
196  `date_metadata_update` date default NULL,
197  `rating_score` float(5,2) unsigned default NULL,
198  `path` varchar(255) NOT NULL default '',
199  `storage_category_id` smallint(5) unsigned default NULL,
200  `level` tinyint unsigned NOT NULL default '0',
201  `md5sum` char(32) default NULL,
202  `added_by` smallint(5) NOT NULL default '0',
203  `rotation` tinyint unsigned default NULL,
204  `latitude` double(8, 6) default NULL,
205  `longitude` double(9, 6) default NULL,
206  `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
207  PRIMARY KEY  (`id`),
208  KEY `images_i2` (`date_available`),
209  KEY `images_i3` (`rating_score`),
210  KEY `images_i4` (`hit`),
211  KEY `images_i5` (`date_creation`),
212  KEY `images_i1` (`storage_category_id`),
213  KEY `images_i6` (`latitude`),
214  KEY `lastmodified` (`lastmodified`)
215) ENGINE=MyISAM;
216
217--
218-- Table structure for table `piwigo_languages`
219--
220
221DROP TABLE IF EXISTS `piwigo_languages`;
222CREATE TABLE `piwigo_languages` (
223  `id` varchar(64) NOT NULL default '',
224  `version` varchar(64) NOT NULL default '0',
225  `name` varchar(64) default NULL,
226  PRIMARY KEY  (`id`)
227) ENGINE=MyISAM;
228
229--
230-- Table structure for table `piwigo_old_permalinks`
231--
232
233DROP TABLE IF EXISTS `piwigo_old_permalinks`;
234CREATE TABLE `piwigo_old_permalinks` (
235  `cat_id` smallint(5) unsigned NOT NULL default '0',
236  `permalink` varchar(64) binary NOT NULL default '',
237  `date_deleted` datetime NOT NULL default '0000-00-00 00:00:00',
238  `last_hit` datetime default NULL,
239  `hit` int(10) unsigned NOT NULL default '0',
240  PRIMARY KEY  (`permalink`)
241) ENGINE=MyISAM;
242
243--
244-- Table structure for table `piwigo_plugins`
245--
246
247DROP TABLE IF EXISTS `piwigo_plugins`;
248CREATE TABLE `piwigo_plugins` (
249  `id` varchar(64) binary NOT NULL default '',
250  `state` enum('inactive','active') NOT NULL default 'inactive',
251  `version` varchar(64) NOT NULL default '0',
252  PRIMARY KEY  (`id`)
253) ENGINE=MyISAM;
254
255--
256-- Table structure for table `piwigo_rate`
257--
258
259DROP TABLE IF EXISTS `piwigo_rate`;
260CREATE TABLE `piwigo_rate` (
261  `user_id` smallint(5) NOT NULL default '0',
262  `element_id` mediumint(8) unsigned NOT NULL default '0',
263  `anonymous_id` varchar(45) NOT NULL default '',
264  `rate` tinyint(2) unsigned NOT NULL default '0',
265  `date` date NOT NULL default '0000-00-00',
266  PRIMARY KEY  (`element_id`,`user_id`,`anonymous_id`)
267) ENGINE=MyISAM;
268
269--
270-- Table structure for table `piwigo_search`
271--
272
273DROP TABLE IF EXISTS `piwigo_search`;
274CREATE TABLE `piwigo_search` (
275  `id` int(10) unsigned NOT NULL auto_increment,
276  `last_seen` date default NULL,
277  `rules` text,
278  PRIMARY KEY  (`id`)
279) ENGINE=MyISAM;
280
281--
282-- Table structure for table `piwigo_sessions`
283--
284
285DROP TABLE IF EXISTS `piwigo_sessions`;
286CREATE TABLE `piwigo_sessions` (
287  `id` varchar(255) binary NOT NULL default '',
288  `data` mediumtext NOT NULL,
289  `expiration` datetime NOT NULL default '0000-00-00 00:00:00',
290  PRIMARY KEY  (`id`)
291) ENGINE=MyISAM;
292
293--
294-- Table structure for table `piwigo_sites`
295--
296
297DROP TABLE IF EXISTS `piwigo_sites`;
298CREATE TABLE `piwigo_sites` (
299  `id` tinyint(4) NOT NULL auto_increment,
300  `galleries_url` varchar(255) NOT NULL default '',
301  PRIMARY KEY  (`id`),
302  UNIQUE KEY `sites_ui1` (`galleries_url`)
303) ENGINE=MyISAM;
304
305--
306-- Table structure for table `piwigo_tags`
307--
308
309DROP TABLE IF EXISTS `piwigo_tags`;
310CREATE TABLE `piwigo_tags` (
311  `id` smallint(5) unsigned NOT NULL auto_increment,
312  `name` varchar(255) NOT NULL default '',
313  `url_name` varchar(255) binary NOT NULL default '',
314  `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
315  PRIMARY KEY  (`id`),
316  KEY `tags_i1` (`url_name`),
317  KEY `lastmodified` (`lastmodified`)
318) ENGINE=MyISAM;
319
320--
321-- Table structure for table `piwigo_themes`
322--
323
324DROP TABLE IF EXISTS `piwigo_themes`;
325CREATE TABLE `piwigo_themes` (
326  `id` varchar(64) NOT NULL default '',
327  `version` varchar(64) NOT NULL default '0',
328  `name` varchar(64) default NULL,
329  PRIMARY KEY  (`id`)
330) ENGINE=MyISAM;
331
332--
333-- Table structure for table `piwigo_upgrade`
334--
335
336DROP TABLE IF EXISTS `piwigo_upgrade`;
337CREATE TABLE `piwigo_upgrade` (
338  `id` varchar(20) NOT NULL default '',
339  `applied` datetime NOT NULL default '0000-00-00 00:00:00',
340  `description` varchar(255) default NULL,
341  PRIMARY KEY  (`id`)
342) ENGINE=MyISAM;
343
344--
345-- Table structure for table `piwigo_user_access`
346--
347
348DROP TABLE IF EXISTS `piwigo_user_access`;
349CREATE TABLE `piwigo_user_access` (
350  `user_id` smallint(5) NOT NULL default '0',
351  `cat_id` smallint(5) unsigned NOT NULL default '0',
352  PRIMARY KEY  (`user_id`,`cat_id`)
353) ENGINE=MyISAM;
354
355--
356-- Table structure for table `piwigo_user_cache`
357--
358
359DROP TABLE IF EXISTS `piwigo_user_cache`;
360CREATE TABLE `piwigo_user_cache` (
361  `user_id` smallint(5) NOT NULL default '0',
362  `need_update` enum('true','false') NOT NULL default 'true',
363  `cache_update_time` integer unsigned NOT NULL default 0,
364  `forbidden_categories` mediumtext,
365  `nb_total_images` mediumint(8) unsigned default NULL,
366  `last_photo_date` datetime DEFAULT NULL,
367  `nb_available_tags` INT(5) DEFAULT NULL,
368  `nb_available_comments` INT(5) DEFAULT NULL,
369  `image_access_type` enum('NOT IN','IN') NOT NULL default 'NOT IN',
370  `image_access_list` mediumtext default NULL,
371  PRIMARY KEY  (`user_id`)
372) ENGINE=MyISAM;
373
374--
375-- Table structure for table `piwigo_user_cache_categories`
376--
377
378DROP TABLE IF EXISTS `piwigo_user_cache_categories`;
379CREATE TABLE `piwigo_user_cache_categories` (
380  `user_id` smallint(5) NOT NULL default '0',
381  `cat_id` smallint(5) unsigned NOT NULL default '0',
382  `date_last` datetime default NULL,
383  `max_date_last` datetime default NULL,
384  `nb_images` mediumint(8) unsigned NOT NULL default '0',
385  `count_images` mediumint(8) unsigned default '0',
386  `nb_categories` mediumint(8) unsigned default '0',
387  `count_categories` mediumint(8) unsigned default '0',
388  `user_representative_picture_id` mediumint(8) unsigned default NULL,
389  PRIMARY KEY  (`user_id`,`cat_id`)
390) ENGINE=MyISAM;
391
392--
393-- Table structure for table `piwigo_user_feed`
394--
395
396DROP TABLE IF EXISTS `piwigo_user_feed`;
397CREATE TABLE `piwigo_user_feed` (
398  `id` varchar(50) binary NOT NULL default '',
399  `user_id` smallint(5) NOT NULL default '0',
400  `last_check` datetime default NULL,
401  PRIMARY KEY  (`id`)
402) ENGINE=MyISAM;
403
404--
405-- Table structure for table `piwigo_user_group`
406--
407
408DROP TABLE IF EXISTS `piwigo_user_group`;
409CREATE TABLE `piwigo_user_group` (
410  `user_id` smallint(5) NOT NULL default '0',
411  `group_id` smallint(5) unsigned NOT NULL default '0',
412  PRIMARY KEY  (`group_id`,`user_id`)
413) ENGINE=MyISAM;
414
415--
416-- Table structure for table `piwigo_user_infos`
417--
418
419DROP TABLE IF EXISTS `piwigo_user_infos`;
420CREATE TABLE `piwigo_user_infos` (
421  `user_id` smallint(5) NOT NULL default '0',
422  `nb_image_page` smallint(3) unsigned NOT NULL default '15',
423  `status` enum('webmaster','admin','normal','generic','guest') NOT NULL default 'guest',
424  `language` varchar(50) NOT NULL default 'en_UK',
425  `expand` enum('true','false') NOT NULL default 'false',
426  `show_nb_comments` enum('true','false') NOT NULL default 'false',
427  `show_nb_hits` enum('true','false') NOT NULL default 'false',
428  `recent_period` tinyint(3) unsigned NOT NULL default '7',
429  `theme` varchar(255) NOT NULL default 'elegant',
430  `registration_date` datetime NOT NULL default '0000-00-00 00:00:00',
431  `enabled_high` enum('true','false') NOT NULL default 'true',
432  `level` tinyint unsigned NOT NULL default '0',
433  `activation_key` char(20) default NULL,
434  `lastmodified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
435  PRIMARY KEY (`user_id`),
436  KEY `lastmodified` (`lastmodified`)
437) ENGINE=MyISAM;
438
439--
440-- Table structure for table `piwigo_user_mail_notification`
441--
442
443DROP TABLE IF EXISTS `piwigo_user_mail_notification`;
444CREATE TABLE `piwigo_user_mail_notification` (
445  `user_id` smallint(5) NOT NULL default '0',
446  `check_key` varchar(16) binary NOT NULL default '',
447  `enabled` enum('true','false') NOT NULL default 'false',
448  `last_send` datetime default NULL,
449  PRIMARY KEY  (`user_id`),
450  UNIQUE KEY `user_mail_notification_ui1` (`check_key`)
451) ENGINE=MyISAM;
452
453--
454-- Table structure for table `piwigo_users`
455--
456
457DROP TABLE IF EXISTS `piwigo_users`;
458CREATE TABLE `piwigo_users` (
459  `id` smallint(5) NOT NULL auto_increment,
460  `username` varchar(100) binary NOT NULL default '',
461  `password` varchar(255) default NULL,
462  `mail_address` varchar(255) default NULL,
463  PRIMARY KEY  (`id`),
464  UNIQUE KEY `users_ui1` (`username`)
465) ENGINE=MyISAM;
Note: See TracBrowser for help on using the repository browser.