Commit cc20fbee authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

JOINED inheritance strategy

parent 8918129f
Pipeline #13542 passed with stage
in 1 minute and 57 seconds
......@@ -66,7 +66,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
indexes = { @Index(unique = false, columnList = "folder_id", name = "IX_repoFile_path") }
// unique
, uniqueConstraints = { @UniqueConstraint(columnNames = { "folder_id", "originalFilename" }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Inheritance(strategy = InheritanceType.JOINED)
public class RepositoryFile extends AuditedVersionedModelWithoutId implements AclAwareModel, BaseMetadata, Copyable<RepositoryFile>, SelfCleaning {
/** The Constant serialVersionUID. */
......
databaseChangeLog:
- changeSet:
id: 1585750166969-1
author: mborodenko
comment:
changes:
- sql:
comment: Migrate repository_image data to repository_file
sql: >-
insert into repository_file
(id, version, accessRights, bibliographicCitation, contentType, created, createdDate, creator,
dateRetrieved, description, extension, extent, lastModifiedDate, license, md5Sum, originalFilename,
originalUrl, path, rightsHolder, sha1Sum, subject, title, uuid, active, createdBy, lastModifiedBy,
size, folder_id)
select
id, version, accessRights, bibliographicCitation, contentType, created, createdDate, creator,
dateRetrieved, description, extension, extent, lastModifiedDate, license, md5Sum, originalFilename,
originalUrl, path, rightsHolder, sha1Sum, subject, title, uuid, active, createdBy, lastModifiedBy,
size, folder_id
from repository_image;
- sql:
comment: Migrate repository_document data to repository_file
sql: >-
insert into repository_file
(id, version, accessRights, bibliographicCitation, contentType, created, createdDate, creator,
dateRetrieved, description, extension, extent, lastModifiedDate, license, md5Sum, originalFilename,
originalUrl, path, rightsHolder, sha1Sum, subject, title, uuid, active, createdBy, lastModifiedBy,
size,folder_id)
select
id, version, accessRights, bibliographicCitation, contentType, created, createdDate, creator,
dateRetrieved, description, extension, extent, lastModifiedDate, license, md5Sum, originalFilename,
originalUrl, path, rightsHolder, sha1Sum, subject, title, uuid, active, createdBy, lastModifiedBy,
size,folder_id
from repository_document;
# Drop unnecessary columns
- changeSet:
id: 1585750166969-2
author: mborodenko
comment: Drop unnecessary columns from the repository_image
changes:
- dropForeignKeyConstraint:
baseTableName: repository_image
constraintName: FK_2ma70p16s23l9b4gvqp51qw7f
- dropUniqueConstraint:
tableName: repository_image
constraintName: UK_dynu7yuj2xn19qlp387inexuh
- dropColumn:
tableName: repository_image
columnName: version
- dropColumn:
tableName: repository_image
columnName: accessRights
- dropColumn:
tableName: repository_image
columnName: bibliographicCitation
- dropColumn:
tableName: repository_image
columnName: contentType
- dropColumn:
tableName: repository_image
columnName: created
- dropColumn:
tableName: repository_image
columnName: createdDate
- dropColumn:
tableName: repository_image
columnName: creator
- dropColumn:
tableName: repository_image
columnName: dateRetrieved
- dropColumn:
tableName: repository_image
columnName: description
- dropColumn:
tableName: repository_image
columnName: extension
- dropColumn:
tableName: repository_image
columnName: extent
- dropColumn:
tableName: repository_image
columnName: lastModifiedDate
- dropColumn:
tableName: repository_image
columnName: license
- dropColumn:
tableName: repository_image
columnName: md5Sum
- dropColumn:
tableName: repository_image
columnName: originalFilename
- dropColumn:
tableName: repository_image
columnName: originalUrl
- dropColumn:
tableName: repository_image
columnName: path
- dropColumn:
tableName: repository_image
columnName: rightsHolder
- dropColumn:
tableName: repository_image
columnName: sha1Sum
- dropColumn:
tableName: repository_image
columnName: subject
- dropColumn:
tableName: repository_image
columnName: title
- dropColumn:
tableName: repository_image
columnName: uuid
- dropColumn:
tableName: repository_image
columnName: active
- dropColumn:
tableName: repository_image
columnName: createdBy
- dropColumn:
tableName: repository_image
columnName: lastModifiedBy
- dropColumn:
tableName: repository_image
columnName: size
- dropColumn:
tableName: repository_image
columnName: folder_id
- changeSet:
id: 1585750166969-3
author: mborodenko
comment: Drop unnecessary columns from the repository_document
changes:
- dropForeignKeyConstraint:
baseTableName: repository_document
constraintName: FK_trk7cw1r3dsxgu8jlia1ecrgj
- dropUniqueConstraint:
tableName: repository_document
constraintName: UK_1bckkd8l1n6n2hsl1895utixh
- dropColumn:
tableName: repository_document
columnName: version
- dropColumn:
tableName: repository_document
columnName: accessRights
- dropColumn:
tableName: repository_document
columnName: bibliographicCitation
- dropColumn:
tableName: repository_document
columnName: contentType
- dropColumn:
tableName: repository_document
columnName: created
- dropColumn:
tableName: repository_document
columnName: createdDate
- dropColumn:
tableName: repository_document
columnName: creator
- dropColumn:
tableName: repository_document
columnName: dateRetrieved
- dropColumn:
tableName: repository_document
columnName: description
- dropColumn:
tableName: repository_document
columnName: extension
- dropColumn:
tableName: repository_document
columnName: extent
- dropColumn:
tableName: repository_document
columnName: lastModifiedDate
- dropColumn:
tableName: repository_document
columnName: license
- dropColumn:
tableName: repository_document
columnName: md5Sum
- dropColumn:
tableName: repository_document
columnName: originalFilename
- dropColumn:
tableName: repository_document
columnName: originalUrl
- dropColumn:
tableName: repository_document
columnName: path
- dropColumn:
tableName: repository_document
columnName: rightsHolder
- dropColumn:
tableName: repository_document
columnName: sha1Sum
- dropColumn:
tableName: repository_document
columnName: subject
- dropColumn:
tableName: repository_document
columnName: title
- dropColumn:
tableName: repository_document
columnName: uuid
- dropColumn:
tableName: repository_document
columnName: active
- dropColumn:
tableName: repository_document
columnName: createdBy
- dropColumn:
tableName: repository_document
columnName: lastModifiedBy
- dropColumn:
tableName: repository_document
columnName: size
- dropColumn:
tableName: repository_document
columnName: folder_id
# Activate FK constraints
- changeSet:
id: 1585750166969-4
author: mborodenko
comment:
changes:
- addForeignKeyConstraint:
baseColumnNames: id
baseTableName: repository_document
constraintName: FK_ffgq0lnuuk9x6u7qmrefj4ohn
deferrable: false
initiallyDeferred: false
onDelete: NO ACTION
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: repository_file
- addForeignKeyConstraint:
baseColumnNames: id
baseTableName: repository_image
constraintName: FK_lsirk2eb67i23hc4i96k5sxgp
deferrable: false
initiallyDeferred: false
onDelete: NO ACTION
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: repository_file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment