create table s9y_authors (realname varchar(255) NOT NULL default '',username varchar(32) default null,password varchar(64) default null,authorid INTEGER PRIMARY KEY,mail_comments int(1) default '1',mail_trackbacks int(1) default '1',email varchar(128) not null default '',userlevel int(4)  not null default '0',right_publish int(1) default '1',hashtype int(1) default '0') ;
create table s9y_groups (id INTEGER PRIMARY KEY,name varchar(64) default null) ;
create table s9y_groupconfig (id int(10)  not null default '0',property varchar(128) default null,value varchar(32) default null) ;
CREATE INDEX groupid_idx ON s9y_groupconfig (id);
CREATE INDEX groupprop_idx ON s9y_groupconfig (id, property);
create table s9y_authorgroups (groupid int(10)  not null default '0',authorid int(10)  not null default '0') ;
CREATE INDEX authorgroup_idxA ON s9y_authorgroups (groupid);
CREATE INDEX authorgroup_idxB ON s9y_authorgroups (authorid);
create table s9y_access (groupid int(10)  not null default '0',artifact_id int(10)  not null default '0',artifact_type varchar(64) NOT NULL default '',artifact_mode varchar(64) NOT NULL default '',artifact_index varchar(64) NOT NULL default '') ;
CREATE INDEX accessgroup_idx ON s9y_access(groupid);
CREATE INDEX accessgroupT_idx ON s9y_access(artifact_id,artifact_type,artifact_mode);
CREATE INDEX accessforeign_idx ON s9y_access(artifact_id);
create table s9y_comments (id INTEGER PRIMARY KEY,entry_id int(10)  not null default '0',parent_id int(10)  not null default '0',timestamp int(10)  default null,title varchar(150) default null,author varchar(80) default null,email varchar(200) default null,url varchar(200) default null,ip varchar(64) default null,body text,type varchar(100) default 'regular',subscribed BOOLEAN NOT NULL,status varchar(50) not null,referer varchar(200) default null) ;
CREATE INDEX commentry_idx ON s9y_comments (entry_id);
CREATE INDEX commpentry_idx ON s9y_comments (parent_id);
CREATE INDEX commtype_idx ON s9y_comments (type);
CREATE INDEX commstat_idx ON s9y_comments (status);
create table s9y_entries (id INTEGER PRIMARY KEY,title varchar(200) default null,timestamp int(10)  default null,body text,comments int(4)  default '0',trackbacks int(4)  default '0',extended text,exflag int(1) default null,author varchar(20) default null,authorid int(11) default null,isdraft BOOLEAN NOT NULL,allow_comments BOOLEAN NOT NULL,last_modified int(10)  default null,moderate_comments BOOLEAN NOT NULL) ;

CREATE INDEX date_idx ON s9y_entries (timestamp);
CREATE INDEX mod_idx ON s9y_entries (last_modified);
CREATE INDEX edraft_idx ON s9y_entries (isdraft);
CREATE INDEX eauthor_idx ON s9y_entries (authorid);
create table s9y_references (id INTEGER PRIMARY KEY,entry_id int(10)  not null default '0',link text,name text,type varchar(128) not null default '') ;
CREATE INDEX refentry_idx ON s9y_references (entry_id);
CREATE INDEX reftype_idx ON s9y_references (type);
CREATE TABLE s9y_exits (entry_id int(11) NOT NULL default '0',day date NOT NULL,count int(11) NOT NULL default '0',scheme varchar(5),host varchar(128) NOT NULL,port varchar(5),path varchar(255),query varchar(255)) ;
CREATE INDEX exits_idx ON s9y_exits (entry_id,day,host);
CREATE TABLE s9y_referrers (entry_id int(11) NOT NULL default '0',day date NOT NULL,count int(11) NOT NULL default '0',scheme varchar(5),host varchar(128) NOT NULL,port varchar(5),path varchar(255),query varchar(255),PRIMARY KEY  (host,day,entry_id)) ;
CREATE INDEX referrers_idx ON s9y_referrers (entry_id,day);
create table s9y_config (name varchar(255) not null,value text not null,authorid int(11) default '0') ;
CREATE INDEX configauthorid_idx ON s9y_config (authorid);
create table s9y_options (name varchar(255) not null,value text not null,okey varchar(64) not null default '') ;
CREATE INDEX options_idx ON s9y_options (okey);
CREATE TABLE s9y_suppress (ip varchar(64) default NULL,scheme varchar(5),host varchar(128),port varchar(5),path varchar(255),query varchar(255),last timestamp NOT NULL) ;
CREATE INDEX url_idx on s9y_suppress (host, ip);
CREATE INDEX urllast_idx on s9y_suppress (last);
CREATE TABLE s9y_plugins (name varchar(128) not null,placement varchar(6) not null default 'right',sort_order int(4) not null default '0',authorid int(11) default '0',path varchar(255) default null,PRIMARY KEY(name)) ;
CREATE INDEX pluginauthorid_idx ON s9y_plugins (authorid);
CREATE INDEX pluginplace_idx ON s9y_plugins (placement);
CREATE INDEX pluginretr_idx ON s9y_plugins (placement, sort_order);
CREATE TABLE s9y_category (categoryid INTEGER PRIMARY KEY,category_name varchar(255) default NULL,category_icon varchar(255) default NULL,category_description text,authorid int(11) default NULL,category_left int(11) default '0',category_right int(11) default '0',parentid int(11) DEFAULT '0' NOT NULL,sort_order int(11),hide_sub int(1)) ;
CREATE INDEX categorya_idx ON s9y_category (authorid);
CREATE INDEX categoryp_idx ON s9y_category (parentid);
CREATE INDEX categorylr_idx ON s9y_category (category_left, category_right);
CREATE INDEX categoryso_idx ON s9y_category (sort_order);
CREATE TABLE s9y_images (id INTEGER PRIMARY KEY,name varchar(255) not null default '',extension varchar(5) not null default '',mime varchar(255) not null default '',size int(11) not null default '0',dimensions_width int(11) not null default '0',dimensions_height int(11) not null default '0',date int(11) not null default '0',thumbnail_name varchar(255) not null default '',authorid int(11) default '0',path text,hotlink int(1),realname varchar(255) not null default '') ;
CREATE INDEX imagesauthorid_idx ON s9y_images (authorid);
CREATE  INDEX pathkey_idx on s9y_images (path);
CREATE TABLE s9y_entrycat (entryid int(11) not null,categoryid int(11) not null) ;
CREATE UNIQUE INDEX entryid_idx ON s9y_entrycat (entryid, categoryid);
create table s9y_entryproperties (entryid int(11) not null,property varchar(255) not null,value text) ;
CREATE INDEX entrypropid_idx ON s9y_entryproperties (entryid);
CREATE UNIQUE INDEX prop_idx ON s9y_entryproperties (entryid, property);
create table s9y_mediaproperties (mediaid int(11) not null,property varchar(128) not null,property_group varchar(50) not null default '',property_subgroup varchar(50) not null default '',value text) ;
CREATE INDEX mediapropid_idx ON s9y_mediaproperties (mediaid);
CREATE UNIQUE INDEX media_idx ON s9y_mediaproperties (mediaid, property, property_group, property_subgroup);
CREATE TABLE s9y_permalinks (permalink varchar(255) not null default '',entry_id int(10)  not null default '0',type varchar(200) not null default '',data text) ;
CREATE INDEX pl_idx ON s9y_permalinks (permalink);
CREATE INDEX ple_idx ON s9y_permalinks (entry_id);
CREATE INDEX plt_idx ON s9y_permalinks (type);
create table s9y_plugincategories (class_name varchar(250) default null,category varchar(250) default null) ;
create table s9y_pluginlist (plugin_file varchar(255) NOT NULL default '',class_name varchar(255) NOT NULL default '',plugin_class varchar(255) NOT NULL default '',pluginPath varchar(255) NOT NULL default '',name varchar(255) NOT NULL default '',description text NOT NULL,version varchar(12) NOT NULL default '',upgrade_version varchar(12) NOT NULL default '',plugintype varchar(255) NOT NULL default '',pluginlocation varchar(255) NOT NULL default '',stackable int(1) NOT NULL default '0',author varchar(255) NOT NULL default '',requirements text NOT NULL,website varchar(255) NOT NULL default '',last_modified int(11) NOT NULL default '0') ;
CREATE INDEX pluginlist_f_idx ON s9y_pluginlist(plugin_file);
CREATE INDEX pluginlist_cn_idx ON s9y_pluginlist(class_name);
CREATE INDEX pluginlist_pt_idx ON s9y_pluginlist(plugintype);
CREATE INDEX pluginlist_pl_idx ON s9y_pluginlist(pluginlocation);
INSERT INTO s9y_authors (realname,username,password,authorid,mail_comments,mail_trackbacks,email,userlevel,right_publish) VALUES ('John Doe','admin','21232f297a57a5a743894a0e4a801fc3',1,1,1,'john@example.com',255,1);
INSERT INTO s9y_config (name,value,authorid) VALUES ('template','carl_contest',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('serendipityPath','/usr/share/serendipity/www/',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('uploadPath','uploads/',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('serendipityHTTPPath','/serendipity/',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('templatePath','templates/',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('uploadHTTPPath','uploads/',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('baseURL','',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('autodetect_baseURL','true',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('indexFile','index.php',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkStructure','archives/%id%-%title%.html',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkAuthorStructure','authors/%id%-%realname%',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkCategoryStructure','categories/%id%-%name%',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkFeedCategoryStructure','feeds/categories/%id%-%name%.rss',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkFeedAuthorStructure','feeds/authors/%id%-%realname%.rss',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkArchivesPath','archives',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkArchivePath','archive',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkCategoriesPath','categories',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkAuthorsPath','authors',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkUnsubscribePath','unsubscribe',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkDeletePath','delete',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkApprovePath','approve',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkFeedsPath','feeds',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkPluginPath','plugin',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkAdminPath','admin',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('permalinkSearchPath','search',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('allowSubscriptions','true',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('blogTitle','My personal blog',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('blogDescription','Powered by Debian',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('blogMail','',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('lang','en',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('charset','UTF-8/',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('calendar','gregorian',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('lang_content_negotiation','true',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('fetchLimit','15',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('useGzip','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('wysiwyg','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('XHTML11','true',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('enablePopup','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('embed','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('top_as_links','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('trackReferrer','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('blockReferer',';',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('rewrite','none',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('serverOffsetHours','0',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('showFutureEntries','false',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('enableACL','true',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('magick','true',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('convert','/usr/bin/convert',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('thumbSuffix','serendipityThumb',0);
INSERT INTO s9y_config (name,value,authorid) VALUES ('thumbSize','110',0);
INSERT INTO s9y_entries (id,title,timestamp,body,comments,trackbacks,extended,exflag,author,authorid,isdraft,allow_comments,last_modified,moderate_comments) VALUES (1,'Serendipity installed succesfully', 0,'<strong>Congratulations!</strong> The Serendipity <a href=\"http://www.debian.org/\">Debian</a> package has been succesfully installed.<p>\r\n\r\nYou need to change the password for the administrative user. You can do that and further configuration of your blog in <a href=\"serendipity_admin.php\">Serendipity administration</a>. Have fun!',0,0,'',0,'admin',1,'false','false', 0,'true');
INSERT INTO s9y_entrycat (entryid,categoryid) VALUES (1,0);
INSERT INTO s9y_groups (id,name) VALUES (1,'USERLEVEL_EDITOR_DESC');
INSERT INTO s9y_groups (id,name) VALUES (2,'USERLEVEL_CHIEF_DESC');
INSERT INTO s9y_groups (id,name) VALUES (3,'USERLEVEL_ADMIN_DESC');
INSERT INTO s9y_permalinks (permalink,entry_id,type,data) VALUES ('authors/1-John-Doe',1,'author',NULL);
INSERT INTO s9y_permalinks (permalink,entry_id,type,data) VALUES ('archives/1-Serendipity-installed-succesfully.html',1,'entry',NULL);
INSERT INTO s9y_references (id,entry_id,link,name) VALUES (1,1,'http://www.debian.org/','Debian');
INSERT INTO s9y_references (id,entry_id,link,name) VALUES (2,1,'serendipity_admin.php','Serendipity administration');

INSERT INTO s9y_plugins (name,placement,sort_order) VALUES ('@serendipity_plug_plugin:4c7b3e68eea90c39b3cf3fd4d50640f3','right',999)