Commit a8c8b6a1 authored by Matija Obreza's avatar Matija Obreza
Browse files

- Liquibase

parent 635b2334
package org.genesys.catalog.model.dataset;
import org.genesys.blocks.model.AuditedVersionedModel;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.io.Serializable;
import java.util.Set;
import org.genesys.blocks.model.AuditedVersionedModel;
/**
* @author Andrey Lugovskoy.
*/
@Entity
@Table(name = "accession", uniqueConstraints = {
@UniqueConstraint(name = "UQ_accession_genus_inst", columnNames = { "taxGenus", "instCode", "acceNumb" }),
@Table(name = "accessionidentifier", uniqueConstraints = {
@UniqueConstraint(name = "UQ_accession_genus_inst", columnNames = { "genus", "instCode", "acceNumb" }),
@UniqueConstraint(name = "UQ_accession_doi", columnNames = { "doi" }) })
public class AccessionIdentifier extends AuditedVersionedModel implements Serializable {
private static final long serialVersionUID = 1L;
@ManyToMany(mappedBy = "accessionIdentifiers")
private Set<Dataset> datasets;
......@@ -31,7 +34,7 @@ public class AccessionIdentifier extends AuditedVersionedModel implements Serial
@Column(name = "acceNumb", nullable = false, length = 128)
public String acceNumb;
@Column(name = "taxGenus", nullable = false)
@Column(name = "genus", nullable = false, length = 128)
public String genus;
public Set<Dataset> getDatasets() {
......
......@@ -16,7 +16,6 @@
package org.genesys.catalog.model.dataset;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -35,13 +34,14 @@ import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import org.genesys.blocks.model.JsonViews;
import org.genesys.blocks.model.Publishable;
import org.genesys.blocks.model.UuidEntity;
import org.genesys.blocks.security.model.AclAwareModel;
import org.genesys.catalog.annotations.PublishValidation;
import org.genesys.catalog.service.PublishValidationInterface;
import org.genesys.catalog.model.traits.Descriptor;
import org.genesys.catalog.service.PublishValidationInterface;
import org.genesys.common.model.Partner;
import org.genesys.filerepository.model.RepositoryFile;
import org.springframework.data.annotation.CreatedDate;
......
......@@ -72,19 +72,11 @@
<id>default-cli</id>
<configuration>
<outputChangeLogFile>${project.basedir}/src/main/resources/liquibase/liquibase-initial.yml</outputChangeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost/catalog?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false&amp;useSSL=false</url>
<username>root</username>
</configuration>
</execution>
<execution>
<id>update</id>
<configuration>
<diffChangeLogFile>${project.basedir}/src/main/resources/liquibase/liquibase-changeLog-diff.yml</diffChangeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost/catalog?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false&amp;useSSL=false</url>
<url>jdbc:mysql://localhost/catalogproduction?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false&amp;useSSL=false</url>
<username>root</username>
<referenceUrl>jdbc:mysql://localhost/catalogproduction?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false&amp;useSSL=false</referenceUrl>
<referenceUrl>jdbc:mysql://localhost/catalog?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false&amp;useSSL=false</referenceUrl>
<referenceUsername>root</referenceUsername>
</configuration>
</execution>
......@@ -132,7 +124,7 @@
</execution>
</executions>
<configuration>
<!-- first check to see if you have locally modified files, and will
<!-- first check to see if you have locally modified files, and will
fail if there are any. -->
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
......
......@@ -2551,3 +2551,140 @@ databaseChangeLog:
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: partner
## Dataset accessions
- changeSet:
id: 1513587335781-1
author: mobreza (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
primaryKey: true
name: id
type: BIGINT
- column:
constraints:
nullable: false
name: active
type: BIT(1)
- column:
constraints:
nullable: false
name: version
type: INT
- column:
name: created_by
type: BIGINT
- column:
name: created_date
type: datetime(6)
- column:
name: last_modified_by
type: BIGINT
- column:
name: last_modified_date
type: datetime(6)
- column:
constraints:
nullable: false
name: acce_numb
type: VARCHAR(128)
- column:
name: doi
type: VARCHAR(255)
- column:
constraints:
nullable: false
name: genus
type: VARCHAR(128)
- column:
constraints:
nullable: false
name: inst_code
type: VARCHAR(10)
tableName: accessionidentifier
- changeSet:
id: 1513587335781-3
author: mobreza (generated)
changes:
- addUniqueConstraint:
columnNames: doi
constraintName: UQ_accession_doi
tableName: accessionidentifier
- changeSet:
id: 1513587335781-4
author: mobreza (generated)
changes:
- addUniqueConstraint:
columnNames: genus, inst_code, acce_numb
constraintName: UQ_accession_genus_inst
tableName: accessionidentifier
- changeSet:
id: 1513587335781-2
author: mobreza (generated)
changes:
- addColumn:
columns:
- column:
constraints:
nullable: false
name: accession_id
type: BIGINT(19)
tableName: datasetaccessions
- changeSet:
id: 1513587335781-5
author: mobreza (generated)
changes:
- createIndex:
columns:
- column:
name: accession_id
indexName: FK_qydduecfqehd9orguiqldwmxc
tableName: datasetaccessions
- changeSet:
id: 1513587335781-6
author: mobreza (generated)
changes:
- addForeignKeyConstraint:
baseColumnNames: accession_id
baseTableName: datasetaccessions
constraintName: FK_qydduecfqehd9orguiqldwmxc
deferrable: false
initiallyDeferred: false
onDelete: NO ACTION
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: accessionidentifier
- changeSet:
id: 1513587335781-11
author: mobreza (generated)
changes:
- dropForeignKeyConstraint:
baseTableName: datasetaccessions
constraintName: FK_en9mv5mnjvpv5a937a78qun2i
- dropPrimaryKey:
tableName: datasetaccessions
- addForeignKeyConstraint:
baseColumnNames: dataset_id
baseTableName: datasetaccessions
constraintName: FK_en9mv5mnjvpv5a937a78qun2i
deferrable: false
initiallyDeferred: false
onDelete: NO ACTION
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: dataset
- addPrimaryKey:
columnNames: dataset_id, accession_id
constraintName: PRIMARY
tableName: datasetaccessions
- changeSet:
id: 1513587335781-7
author: mobreza (generated)
changes:
- dropColumn:
columnName: accession_identifer
tableName: datasetaccessions
Supports Markdown
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