2 CREATE DATABASE IF NOT EXISTS irreco CHARACTER SET utf8;
7 CREATE TABLE IF NOT EXISTS `irreco`.`category` (
8 `id` int(10) unsigned NOT NULL auto_increment,
9 `name` varchar(30) NOT NULL,
11 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Device type categories';
16 CREATE TABLE IF NOT EXISTS `irreco`.`backend` (
17 `id` int(10) unsigned NOT NULL auto_increment,
18 `name` varchar(30) NOT NULL,
20 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Irreco Backends';
23 * List of manufacturers.
25 CREATE TABLE IF NOT EXISTS `irreco`.`manufacturer` (
26 `id` int(10) unsigned NOT NULL auto_increment,
27 `name` varchar(30) NOT NULL,
29 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Device manufacturers';
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';
46 * Filedata max size is now 4 Gt
47 * Old size was 64 kt which was too small for some images
49 ALTER TABLE `irreco`.`file` CHANGE `data` `data` LONGBLOB NOT NULL;
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,
62 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Database users';
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,
77 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Backend Configuration file index';
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,
98 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for buttons';
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',
116 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for themes';
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,
129 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table for Background-images';
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';
144 CREATE TABLE IF NOT EXISTS `irreco`.`remote` (
\r
145 `id` int(10) NOT NULL auto_increment,
\r
146 `user_id` int(10) NOT NULL,
\r
148 `category` int(10) NOT NULL,
\r
149 `manufacturer` int(10) NOT NULL,
\r
150 `model` varchar(30) NOT NULL,
\r
151 `file_hash` varchar(40) NOT NULL,
\r
152 `file_name` varchar(60) NOT NULL,
\r
153 `uploaded` datetime NOT NULL,
\r
154 `modified` datetime NOT NULL,
\r
155 `downloaded` datetime NOT NULL,
\r
156 `download_count` int(11) NOT NULL default '0',
\r
157 `downloadable` tinyint(1) NOT NULL default '0',
\r
159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 COMMENT='Table for remotes';
\r
162 * Configurations of remote
164 CREATE TABLE IF NOT EXISTS `irreco`.`remote_configuration` (
\r
165 `id` int(10) NOT NULL auto_increment,
\r
166 `remote_id` int(10) NOT NULL,
\r
167 `configuration_id` int(10) NOT NULL,
168 FOREIGN KEY(remote_id) REFERENCES remote(id) ON DELETE CASCADE,
\r
170 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 COMMENT='Configurations of remote';
\r
175 CREATE TABLE IF NOT EXISTS `irreco`.`remote_theme` (
\r
176 `id` int(10) NOT NULL auto_increment,
\r
177 `remote_id` int(10) NOT NULL,
\r
178 `theme_id` int(10) NOT NULL,
179 FOREIGN KEY(remote_id) REFERENCES remote(id) ON DELETE CASCADE,
\r
181 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 COMMENT='Themes of remote';
\r