--
-- Host: 10.0.0.24    Database: dewiki
---------------------------------------------------------

--
-- Table structure for table `page`
--

CREATE TABLE `page` (
  `page_id` int(8) unsigned NOT NULL auto_increment,
  `page_namespace` int(11) NOT NULL default '0',
  `page_title` varchar(255) binary NOT NULL default '',
  `page_restrictions` tinyblob NOT NULL,
  `page_counter` bigint(20) unsigned NOT NULL default '0',
  `page_is_redirect` tinyint(1) unsigned NOT NULL default '0',
  `page_is_new` tinyint(1) unsigned NOT NULL default '0',
  `page_random` double unsigned NOT NULL default '0',
  `page_touched` varchar(14) binary NOT NULL default '',
  `page_latest` int(8) unsigned NOT NULL default '0',
  `page_len` int(8) unsigned NOT NULL default '0',
  `page_no_title_convert` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`page_id`),
  UNIQUE KEY `name_title` (`page_namespace`,`page_title`),
  KEY `page_random` (`page_random`),
  KEY `page_len` (`page_len`)
);
ALTER TABLE `page` DISABLE KEYS;


ALTER TABLE `page`  DROP KEY `name_title`;
ALTER TABLE `page`  DROP KEY `page_random`;
ALTER TABLE `page`  DROP KEY `page_len`;

;ALTER TABLE `page` DROP COLUMN `page_restrictions`;
;ALTER TABLE `page` DROP COLUMN `page_counter`;
;ALTER TABLE `page` DROP COLUMN `page_random`;
;ALTER TABLE `page` DROP COLUMN `page_is_new`;
;ALTER TABLE `page` DROP COLUMN `page_is_redirect`;
;ALTER TABLE `page` DROP COLUMN `page_no_title_convert`;

DELETE FROM `page` WHERE `page_namespace` <> 0;
;ALTER TABLE `page` ADD KEY (`page_title`);
;ALTER TABLE `page` ENABLE KEYS;


CREATE TABLE `lenawikipediindex` (  
  `type` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `created` datetime NOT NULL default '0000-00-00 00:00:00',
  KEY  (`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='list of downloaded wiki index';


CREATE TABLE `lenawikipedia_de_page` (
  `id` int(8) unsigned NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `title_reverse` varchar(100) NOT NULL default '',
  `touched` datetime,
  `latest` int(8) unsigned NOT NULL default '0',
  `len` int(8) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `title` (`title`),
  KEY `title_reverse` (`title_reverse`)
) DEFAULT CHARSET=utf8 COMMENT='wikipedia DE page index';

ALTER TABLE `wikipedia_de_page` DISABLE KEYS;

INSERT INTO wikipedia_de_page (id, title, title_reverse, len, latest, touched)
   SELECT page_id, page_title, REVERSE( page_title ), page_len, page_latest, page_touched FROM page WHERE `page_namespace` <> 0;

ALTER TABLE `wikipedia_de_page` ENABLE KEYS;

DROP TABLE page;
