Modified settings table. Added samble labels.
[irreco.git] / database / irreco-database.sql
blob6f29713a942479e4e846469a659ce56c92ff2d8a
2 CREATE DATABASE IF NOT EXISTS irreco CHARACTER SET utf8;
4 /*
5  * List of categories.
6  */
7 CREATE TABLE IF NOT EXISTS `irreco`.`category` (
8   `id` int(10) unsigned NOT NULL auto_increment,
9   `name` varchar(30) NOT NULL,
10   PRIMARY KEY  (`id`)
11 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Device type categories';
14  * List of backends.
15  */
16 CREATE TABLE IF NOT EXISTS `irreco`.`backend` (
17   `id` int(10) unsigned NOT NULL auto_increment,
18   `name` varchar(30) NOT NULL,
19   PRIMARY KEY  (`id`)
20 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Irreco Backends';
23  * List of manufacturers.
24  */
25 CREATE TABLE IF NOT EXISTS `irreco`.`manufacturer` (
26   `id` int(10) unsigned NOT NULL auto_increment,
27   `name` varchar(30) NOT NULL,
28   PRIMARY KEY  (`id`)
29 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Device manufacturers';
32  * File storage table.
33  */
34 CREATE TABLE IF NOT EXISTS `irreco`.`file` (
35   `hash` varchar(40) NOT NULL,
36   `name` varchar(60) NOT NULL,
37   `data` LONGBLOB NOT NULL,
38   `uploaded` datetime NOT NULL,
39   `downloaded` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
40   `download_count` int(11) NOT NULL default '0',
41   PRIMARY KEY  (`hash`,`name`)
42 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='File storage';
45  * File storage update
46  * Filedata max size is now 4 Gt
47  * Old size was 64 kt which was too small for some images
48  */
49 ALTER TABLE `irreco`.`file` CHANGE `data` `data` LONGBLOB NOT NULL;
52  * Users
53  */
54 CREATE TABLE IF NOT EXISTS `irreco`.`user` (
55   `id` int(10) unsigned NOT NULL auto_increment,
56   `name` varchar(30) NOT NULL,
57   `email` varchar(60) NOT NULL,
58   `password` varchar(40) NOT NULL,
59   `account_registered` datetime NOT NULL,
60   `previous_login` datetime NOT NULL,
61   PRIMARY KEY  (`id`)
62 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Database users';
65  * Configuration map.
66  */
67 CREATE TABLE IF NOT EXISTS `irreco`.`configuration` (
68   `id` int(10) unsigned NOT NULL auto_increment,
69   `user` int(10) unsigned NOT NULL,
70   `backend` int(10) unsigned NOT NULL,
71   `category` int(10) unsigned NOT NULL,
72   `manufacturer` int(10) unsigned NOT NULL,
73   `model` varchar(30) NOT NULL,
74   `file_hash` varchar(40) NOT NULL,
75   `file_name` varchar(60) NOT NULL,
76   PRIMARY KEY  (`id`)
77 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Backend Configuration file index';
80  * Buttons
81  */
82 CREATE TABLE IF NOT EXISTS `irreco`.`button` (
83 `id` int(10) unsigned NOT NULL auto_increment,
84 `name` varchar(50) NOT NULL,
85 `allow_text` tinyint(1) NOT NULL,
86 `text_format_up` varchar(120) default NULL,
87 `text_format_down` varchar(120) default NULL,
88 `text_padding` int(11) NOT NULL,
89 `text_h_align` double NOT NULL,\r
90 `text_v_align` double NOT NULL,
91 `image_up_hash` varchar(40) NOT NULL,
92 `image_up_name` varchar(60) NOT NULL,
93 `image_down_hash` varchar(40) NOT NULL,
94 `image_down_name` varchar(60) NOT NULL,
95 `folder` varchar(50) NOT NULL,
96 `theme_id` int(11) NOT NULL,
97 PRIMARY KEY ( `id` )
98 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for buttons';
101  * Themes
102  */
103 CREATE TABLE IF NOT EXISTS `irreco`.`theme` (
104 `id` int(10) unsigned NOT NULL auto_increment,
105 `name` varchar(50) NOT NULL,
106 `user_id` int(11) NOT NULL,
107 `comment` text default NULL,
108 `preview_button` varchar(50) NOT NULL,
109 `folder` varchar(50) NOT NULL,
110 `uploaded` datetime NOT NULL,
111 `modified` datetime NOT NULL,
112 `downloaded` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
113 `download_count` int(11) NOT NULL,
114 `downloadable` tinyint(1) NOT NULL default '0',
115 PRIMARY KEY ( `id` )
116 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for themes';
119  * Backgrounds
120  */
121 CREATE TABLE IF NOT EXISTS `irreco`.`bg` (
122 `id` int(10) unsigned NOT NULL auto_increment,
123 `name` varchar(50) NOT NULL,
124 `image_hash` varchar(40) NOT NULL,
125 `image_name` varchar(60) NOT NULL,
126 `folder` varchar(50) NOT NULL,
127 `theme_id` int(11) NOT NULL,
128 PRIMARY KEY ( `id` )
129 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for Background-images';
132  * User agents
133  */
134 CREATE TABLE IF NOT EXISTS `irreco`.`user_agent` (
135   `user_agent` char(200) NOT NULL,
136   `date` date NOT NULL,
137   `count` int(11) NOT NULL,
138   PRIMARY KEY  (`user_agent`,`date`)
139 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for user agents';