install-2.0.sql 3.36 KB
-- install-2.0
-- sql for fresh install of metarepository v2.0
-- includes sql from metarepository v1.0
-- plus changes needed for oai-pmh and data-provider

drop database if exists metarepository;
create database metarepository;

use metarepository;

-- Archive's Table
CREATE TABLE  `repositories` (
  `arcid` varchar(255) PRIMARY KEY,
  `allsets` tinyint(1) DEFAULT '1',
  `harvesting` tinyint(1) DEFAULT '0',
  `oaiurl` varchar(255)  DEFAULT NULL,
  `homepage` varchar(255)  DEFAULT NULL,
  `name` varchar(255)  DEFAULT NULL,
  `description_en` varchar(1000)  DEFAULT NULL,
  `description_pt` varchar(1000)  DEFAULT NULL,
  `active` tinyint(1) DEFAULT '0',
  `version` varchar(20)  DEFAULT '2.0',
  `adminemail` varchar(255)  DEFAULT NULL,
  `harvest_method` varchar(50)  NOT NULL,
  `last_harvest` datetime DEFAULT NULL,
  `metadata_format` varchar(50)  DEFAULT 'oai_dc',
  `resumption_token` varchar(255)  DEFAULT NULL,
  `harvested` tinyint(1) DEFAULT '0',
  `order` integer default '0',
  `full_text` tinyint(1) default '0'
);

-- Store Sets
CREATE TABLE  `sets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `archive_id` varchar(255)  DEFAULT NULL,
  `set_name` varchar(255)  DEFAULT NULL,
  `set_spec` varchar(255)  DEFAULT NULL,
  `active` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`)
);

-- Metadata Document's tables
CREATE TABLE  `documents` (
  `id` varchar(255)  NOT NULL,
  `harvested_date` datetime DEFAULT NULL,
  `harvest_event` datetime DEFAULT NULL,
  `archive_id` varchar(255)  NOT NULL,
  `titles` longtext ,
  `creators` longtext ,
  `subjects` longtext ,
  `descriptions` longtext ,
  `publishers` longtext ,
  `contributors` longtext ,
  `dates` longtext ,
  `types` longtext ,
  `formats` longtext ,
  `identifiers` longtext ,
  `sources` longtext ,
  `languages` longtext ,
  `relations` longtext ,
  `coverages` longtext ,
  `rights` longtext ,
  `alltext` longtext ,
  `parsed` tinyint(1) DEFAULT '0',
  `document_issue_date` varchar(255)  DEFAULT NULL,
  `document_link` varchar(300)  DEFAULT NULL,
  `document_type` varchar(255)  DEFAULT NULL,
  `document_language` varchar(255)  DEFAULT NULL,
  `document_views` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  FULLTEXT KEY `creators` (`creators`),
  FULLTEXT KEY `titles` (`titles`),
  FULLTEXT KEY `descriptions` (`descriptions`),
  FULLTEXT KEY `subjects` (`subjects`),
  FULLTEXT KEY `dates` (`dates`),
  FULLTEXT KEY `types` (`types`),
  FULLTEXT KEY `document_issue_date` (`document_issue_date`),
  FULLTEXT KEY `alltext` (`alltext`),
  FULLTEXT KEY `archive_id` (`archive_id`)
);

CREATE TABLE  `document_set` (
  `document_id` varchar(255)  DEFAULT NULL,
  `set_id` int(11) NOT NULL
);

CREATE TABLE `problems` (
  `document_id` varchar(255)  DEFAULT NULL,
  `problem` varchar(255)  DEFAULT NULL
);

CREATE TABLE  `historic` (
  `archive_id` varchar(255)  DEFAULT NULL,
  `year` int(11) DEFAULT NULL,
  `month` int(11) DEFAULT NULL,
  `day` int(11) DEFAULT NULL,
  `documents` int(11) DEFAULT NULL
);

CREATE TABLE  `tagcloudsubject` (
  `word` varchar(255)  DEFAULT NULL,
  `count` int(11) DEFAULT '1',
  `hidden` tinyint(1) NOT NULL DEFAULT '0'
);

CREATE TABLE  `tagcloudsearch` (
  `word` varchar(255)  DEFAULT NULL,
  `count` int(11) DEFAULT '1',
  `hidden` tinyint(1) NOT NULL DEFAULT '0'
) ;

CREATE TABLE  `deleted_documents` (
  `deleted_id` varchar(255)  NOT NULL,
  `delition_date` datetime DEFAULT NULL,
  PRIMARY KEY (`deleted_id`)
);