From 69865a1f1a4db59f431e2fd62e819aad5659e07a Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 6 Aug 2020 08:21:01 +0000 Subject: [PATCH] Bug 25905: Add new 'import_oaipmh_biblios' table --- .../bug_25905_import_oaipmh_biblios_table.perl | 25 ++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 20 +++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_25905_import_oaipmh_biblios_table.perl diff --git a/installer/data/mysql/atomicupdate/bug_25905_import_oaipmh_biblios_table.perl b/installer/data/mysql/atomicupdate/bug_25905_import_oaipmh_biblios_table.perl new file mode 100644 index 0000000000..2a96ff2869 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25905_import_oaipmh_biblios_table.perl @@ -0,0 +1,25 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + + unless( TableExists('import_oaipmh_biblios') ) { + $dbh->do(q{ + CREATE TABLE import_oaipmh_biblios ( + id INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT, + repository MEDIUMTEXT NOT NULL, -- this is a URL so it needs to be long + identifier MEDIUMTEXT NOT NULL, -- this is technically a URI + datestamp datetime NOT NULL, -- this is a UTC timestamp + deleted TINYINT(1) DEFAULT 0, -- boolean for header status of deleted + metadata LONGTEXT NOT NULL, -- OAI-PMH encapsulated metadata + frameworkcode varchar(4) NOT NULL, -- frameworkcode to use when importing + biblionumber INT(11), + last_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (id), + KEY biblionumber (biblionumber), + CONSTRAINT FK_import_oaipmh_biblios_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE NO ACTION + ) ENGINE = INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 25905, "Add a new 'import_oaipmh_biblios' table"); +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index cc7c133653..e4298f17b8 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4570,6 +4570,26 @@ CREATE TABLE advanced_editor_macros ( CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table import_oaipmh_biblios +-- + +DROP TABLE IF EXISTS import_oaipmh_biblios; +CREATE TABLE import_oaipmh_biblios ( + id INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT, + repository MEDIUMTEXT NOT NULL, -- this is a URL so it needs to be long + identifier MEDIUMTEXT NOT NULL, -- this is technically a URI + datestamp datetime NOT NULL, -- this is a UTC timestamp + deleted TINYINT(1) DEFAULT 0, -- boolean for header status of deleted + metadata LONGTEXT NOT NULL, -- OAI-PMH encapsulated metadata + frameworkcode varchar(4) NOT NULL, -- frameworkcode to use when importing + biblionumber INT(11), + last_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (id), + KEY biblionumber (biblionumber), + CONSTRAINT FK_import_oaipmh_biblios_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE = INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -- 2.11.0