Skip to content

Commit

Permalink
Merge pull request #334 from OPUS4/issue206
Browse files Browse the repository at this point in the history
Beliebige Identifier-Typen in Datenbank erlauben
  • Loading branch information
j3nsch authored Oct 31, 2023
2 parents d4b361c + 451c0f3 commit b594b13
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
14 changes: 8 additions & 6 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@

<target name="build" depends="prepare,lint,analyse-code,pdepend,phpdoc,phpcb" />

<target name="clean">
<delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/api" />
<delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/pdepend" />
<delete dir="${basedir}/build/code-browser" />
<target name="clean" depends="delete-build, clean-workspace, prepare-workspace">
</target>

<target name="delete-build">
<delete dir="${basedir}/build" />
</target>

<target name="clean-workspace">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${workspaceDir}/cache" includes="**/*" />
</delete>
Expand Down
28 changes: 28 additions & 0 deletions db/schema/021-Allow-any-identifier-type.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
START TRANSACTION;

-- Replace identifier type ENUM with VARCHAR to allow any type

ALTER TABLE `document_identifiers`
ADD COLUMN `typestr` VARCHAR(10) NULL COMMENT 'Type of identifier';

UPDATE `document_identifiers`
SET `typestr` = CAST(`type` as CHAR);

ALTER TABLE `document_identifiers`
DROP INDEX `fk_document_identifiers_documents_type`;

ALTER TABLE `document_identifiers`
DROP COLUMN `type`;

ALTER TABLE `document_identifiers`
RENAME COLUMN `typestr` TO `type`;

ALTER TABLE `document_identifiers`
ADD INDEX `fk_document_identifiers_documents_type` (`document_id` ASC, `type` ASC);

-- Update database version

TRUNCATE TABLE `schema_version`;
INSERT INTO `schema_version` (`version`) VALUES (21);

COMMIT;
1 change: 1 addition & 0 deletions library/Opus/Identifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class Identifier extends AbstractDependentModel implements IdentifierInterface
'Opac' => 'opac-id',
'Arxiv' => 'arxiv',
'Pubmed' => 'pmid',
'Ismn' => 'ismn',
];

/**
Expand Down
4 changes: 3 additions & 1 deletion library/Opus/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ class Version
{
/**
* Opus Framework version identification - see compareVersion()
*
* TODO Is this still used anywhere? Apparently it has not been updated for recent version.
*/
public const VERSION = '4.7.1';

/**
* Version of database schema.
*/
public const SCHEMA_VERSION = 20;
public const SCHEMA_VERSION = 21;

/**
* Compare the specified Opus Framework version string $version
Expand Down

0 comments on commit b594b13

Please sign in to comment.