Commit 14706a15 authored by Matija Obreza's avatar Matija Obreza

Updated liquibase-changeLog from mvn liquibase:diff

- Crop code: Use common column length Crop.CROP_SHORTNAME_LENGTH
parent daeae654
......@@ -856,7 +856,7 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<version>${liquibase.version}.2</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<verbose>true</verbose>
......
......@@ -29,6 +29,7 @@ import org.genesys.catalog.model.traits.Descriptor;
import org.genesys.catalog.service.PublishValidationInterface;
import org.genesys.filerepository.model.RepositoryFile;
import org.genesys2.server.model.PublishState;
import org.genesys2.server.model.impl.Crop;
import org.genesys2.util.MCPDUtil;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
......@@ -132,7 +133,7 @@ public class Dataset extends UuidModel implements Publishable, SelfCleaning, Pub
@CollectionTable(name = "dataset_crops", joinColumns = @JoinColumn(name = "datasetId"),
// index
indexes = { @Index(columnList = "datasetId, crop") })
@Column(name = "crop", nullable = false, length = 20)
@Column(name = "crop", nullable = false, length = Crop.CROP_SHORTNAME_LENGTH)
@JsonView({ JsonViews.Minimal.class })
private Set<String> crops;
......
......@@ -24,6 +24,7 @@ import org.genesys.catalog.model.dataset.Dataset;
import org.genesys.catalog.model.vocab.ControlledVocabulary;
import org.genesys.catalog.model.vocab.VocabularyTerm;
import org.genesys2.server.model.PublishState;
import org.genesys2.server.model.impl.Crop;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
......@@ -200,7 +201,7 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private List<Dataset> datasets;
/** The crop. */
@Column(name = "crop", length = 100, nullable = true)
@Column(name = "crop", length = Crop.CROP_SHORTNAME_LENGTH, nullable = true)
private String crop;
/** Descriptor classification. */
......
......@@ -27,6 +27,7 @@ import org.genesys.blocks.model.UuidModel;
import org.genesys.blocks.security.model.AclAwareModel;
import org.genesys.catalog.model.Partner;
import org.genesys2.server.model.PublishState;
import org.genesys2.server.model.impl.Crop;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
......@@ -108,7 +109,7 @@ public class DescriptorList extends UuidModel implements Publishable, SelfCleani
private String publisher;
/** The crop. */
@Column(name = "crop", length = 100, nullable = true)
@Column(name = "crop", length = Crop.CROP_SHORTNAME_LENGTH, nullable = true)
private String crop;
/** Extra information associated with the descriptor list */
......
......@@ -61,11 +61,13 @@ public class Crop extends GlobalVersionedAuditedModel implements AclAwareModel {
public static final Logger LOG = LoggerFactory.getLogger(Crop.class);
public static final int CROP_SHORTNAME_LENGTH = 50;
/**
* Crop short name used as short name in URLs
*/
@Column(nullable = false, length = 50, unique = true)
@Column(nullable = false, length = CROP_SHORTNAME_LENGTH, unique = true)
private String shortName;
@Column(name = "otherName", nullable = false, unique = true, length = 255)
......
......@@ -120,7 +120,7 @@ public class Subset extends UuidModel implements AclAwareModel, SelfCleaning {
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "subset_crops", joinColumns = @JoinColumn(name = "subsetId"),
indexes = { @Index(columnList = "subsetId, crop") })
@Column(name = "crop", nullable = false, length = 20)
@Column(name = "crop", nullable = false, length = Crop.CROP_SHORTNAME_LENGTH)
@JsonView({ JsonViews.Minimal.class })
private Set<String> crops;
......
......@@ -3876,48 +3876,62 @@ databaseChangeLog:
referencedColumnNames: id
referencedTableName: subset
- changeSet:
id: 1536945927974-1
author: mobreza (generated)
comment: Fix crop shortName (code) to 50
changes:
- modifyDataType:
columnName: crop
newDataType: varchar(50)
tableName: dataset_crops
- modifyDataType:
columnName: crop
newDataType: varchar(50)
tableName: descriptor
- modifyDataType:
columnName: crop
newDataType: varchar(50)
tableName: descriptorlist
- changeSet:
id: 1536939885074-68
id: 1536945927974-4
author: vpavlov
comment: Add crops to Subset
changes:
- addColumn:
columns:
- column:
name: date
type: VARCHAR(8)
tableName: subset
- addColumn:
columns:
- column:
name: source
type: VARCHAR(200)
tableName: subset
- createTable:
columns:
- column:
constraints:
nullable: false
primaryKey: true
name: subsetId
type: BIGINT
- column:
constraints:
nullable: false
primaryKey: true
name: crop
type: VARCHAR(20)
tableName: subset_crops
- addPrimaryKey:
comment: subset_crops PK
columnNames: subsetId, crop
constraintName: PRIMARY
type: VARCHAR(50)
tableName: subset_crops
- addForeignKeyConstraint:
comment: subset_crops FK
baseColumnNames: subsetId
baseTableName: subset_crops
constraintName: FK_04466eb03847ac24cefb2f7ff
constraintName: FK_hny3je51ro3jv72dubq9lt4o2
deferrable: false
initiallyDeferred: false
onDelete: NO ACTION
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: subset
- addColumn:
comment: Add date and source to subset
columns:
- column:
name: date
type: varchar(8)
- column:
name: source
type: varchar(200)
tableName: subset
validate: true
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