--
-- Table structure for table `wikiapproval_request`
--
 
DROP TABLE IF EXISTS `wikiapproval_request`;
CREATE TABLE `wikiapproval_request` (
  `page_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY  (`page_id`,`user_id`),
  KEY `FK_wikiapproval_request_user` (`user_id`),
  CONSTRAINT `FK_wikiapproval_request_page` FOREIGN KEY (`page_id`) REFERENCES `wikipage` (`page_id`),
  CONSTRAINT `FK_wikiapproval_request_user` FOREIGN KEY (`user_id`) REFERENCES `wikiuser` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Table structure for table `wikiapproval`
--
 
DROP TABLE IF EXISTS `wikiapproval`;
CREATE TABLE `wikiapproval` (
  `rev_id` int(10) UNSIGNED NOT NULL,
  `rev_page` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY  (`rev_id`,`rev_page`,`user_id`),
  KEY `FK_wikiapproval_user` (`user_id`),
  CONSTRAINT `FK_wikiapproval_revision` FOREIGN KEY (`rev_id`, `rev_page`) REFERENCES `wikirevision` (`rev_id`, `rev_page`),
  CONSTRAINT `FK_wikiapproval_user` FOREIGN KEY (`user_id`) REFERENCES `wikiuser` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Table structure for table `wikiapproval_version`
--
 
DROP TABLE IF EXISTS `wikiapproval_version`;
CREATE TABLE `wikiapproval_version` (
  `page_id` int(10) UNSIGNED NOT NULL,
  `last_approved_revision_id` int(10) UNSIGNED DEFAULT NULL,
  `version` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `subversion` int(10) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY  (`page_id`),
  KEY `FK_wikiapproval_version_revision_id` (`last_approved_revision_id`,`page_id`),
  CONSTRAINT `FK_wikiapproval_version_page_id` FOREIGN KEY (`page_id`) REFERENCES `wikipage` (`page_id`),
  CONSTRAINT `FK_wikiapproval_version_revision_id` FOREIGN KEY (`last_approved_revision_id`, `page_id`) REFERENCES `wikirevision` (`rev_id`, `rev_page`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;