Commit c6f08e07 authored by PECQUOT's avatar PECQUOT
Browse files

[fix] Remove rankOrderOnVessel from Landing and LandingVO

[enh] add LandingRepositoryImpl.findAllByObservedLocationId with natural sort on vessel registration code
parent 1f1ad377
sumaris.config.option.auth.allExtractionTypeAccess.role.description=
sumaris.config.option.extraction.accessNotSelfExtraction.role.description=
sumaris.config.option.extraction.cli.frequency.description=
sumaris.config.option.extraction.cli.output.format.description=
sumaris.config.option.extraction.enabled.description=
......
sumaris.config.option.auth.allExtractionTypeAccess.role.description=
sumaris.config.option.extraction.accessNotSelfExtraction.role.description=
sumaris.config.option.extraction.cli.frequency.description=
sumaris.config.option.extraction.cli.output.format.description=
sumaris.config.option.extraction.enabled.description=
......
......@@ -47,8 +47,6 @@ import org.hibernate.dialect.Dialect;
import org.nuiton.i18n.I18n;
import org.nuiton.version.Version;
import org.nuiton.version.Versions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DataRetrievalFailureException;
......@@ -56,7 +54,7 @@ import org.springframework.jdbc.datasource.DataSourceUtils;
import javax.persistence.EntityManager;
import javax.persistence.criteria.From;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Root;
import javax.sql.DataSource;
......@@ -1717,25 +1715,35 @@ public class Daos {
public static <X> Path<X> composePath(Root<?> root, String attributePath) {
String[] paths = attributePath.split("\\.");
From<?, ?> from = root; // starting from root
String[] attributes = attributePath.split("\\.");
Path<?> path = root; // starting from root
Path<X> result = null;
for (int i = 0; i < paths.length; i++) {
String path = paths[i];
for (int i = 0; i < attributes.length; i++) {
String attribute = attributes[i];
if (i == paths.length - 1) {
if (i == attributes.length - 1) {
// last path, find it
result = from.get(path);
result = path.get(attribute);
} else {
// need a join (find it from existing joins of from)
Join join = from.getJoins().stream()
.filter(j -> j.getAttribute().getName().equals(path))
.findFirst().orElse(null);
if (join == null) {
throw new IllegalArgumentException(String.format("the join %s from %s doesn't exists", path, from.getClass().getSimpleName()));
if (path instanceof From) {
// find a join (find it from existing joins of from)
From<?, ?> from = (From<?, ?>) path;
try {
path = from.getJoins().stream()
.filter(j -> j.getAttribute().getName().equals(attribute))
.findFirst()
.orElseGet(() -> from.join(attribute, JoinType.LEFT));
continue;
} catch (IllegalArgumentException ignored) {
}
}
// find an attribute
try {
path = path.get(attribute);
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException(String.format("the join or attribute [%s] from [%s] doesn't exists", attribute, path.getJavaType()));
}
from = join;
}
}
......
......@@ -26,6 +26,7 @@ package net.sumaris.core.util;
import com.google.common.base.Preconditions;
import com.google.common.collect.*;
import lombok.extern.slf4j.Slf4j;
import net.sumaris.core.dao.technical.SortDirection;
import net.sumaris.core.dao.technical.model.IEntity;
import net.sumaris.core.exception.SumarisTechnicalException;
......@@ -51,6 +52,7 @@ import java.util.stream.Stream;
* helper class for beans (split by property, make sure list exists, ...)
* Created by blavenie on 13/10/15.
*/
@Slf4j
public class Beans {
protected Beans() {
......@@ -397,7 +399,12 @@ public class Beans {
return (o1, o2) -> -1;
}
//public static Map<String, String[]> cacheCopyPropertiesIgnored;
public static <T> T clone(T source, Class<T> sourceClass) {
T target = newInstance(sourceClass);
copyProperties(source, target);
return target;
}
public static Map<Class<?>, Map<Class<?>, String[]>> cacheCopyPropertiesIgnored = Maps.newConcurrentMap();
/**
......@@ -446,6 +453,26 @@ public class Beans {
BeanUtils.copyProperties(source, target, ArrayUtils.addAll(ignoredProperties, exceptProperties));
}
public static boolean beanIsEmpty(Object bean, String... ignoredAttributes) {
if (bean == null)
return true;
return Arrays.stream(bean.getClass().getDeclaredFields())
.filter(field -> !ArrayUtils.contains(ignoredAttributes, field.getName()))
.allMatch(field -> {
Object property = getProperty(bean, field.getName());
if (property == null)
return true;
if (property.getClass().isArray()) {
return ArrayUtils.isEmpty((Object[]) property);
}
if (property instanceof Collection)
return CollectionUtils.isEmpty((Collection<?>) property);
log.warn(String.format("Unable to determinate if %s is null", property));
return false;
});
}
/**
* Compute equality of 2 Map
* should return true if :
......
......@@ -30,21 +30,15 @@ import net.sumaris.core.dao.administration.user.PersonRepository;
import net.sumaris.core.dao.technical.Daos;
import net.sumaris.core.dao.technical.Pageables;
import net.sumaris.core.dao.technical.SortDirection;
import net.sumaris.core.dao.technical.jpa.BindableSpecification;
import net.sumaris.core.dao.technical.jpa.IFetchOptions;
import net.sumaris.core.dao.technical.jpa.SumarisJpaRepositoryImpl;
import net.sumaris.core.dao.technical.model.IUpdateDateEntityBean;
import net.sumaris.core.model.administration.user.Person;
import net.sumaris.core.model.data.IDataEntity;
import net.sumaris.core.model.data.IWithObserversEntity;
import net.sumaris.core.model.data.IWithVesselEntity;
import net.sumaris.core.model.data.IWithVesselSnapshotEntity;
import net.sumaris.core.model.data.*;
import net.sumaris.core.model.referential.QualityFlag;
import net.sumaris.core.model.referential.QualityFlagEnum;
import net.sumaris.core.util.Beans;
import net.sumaris.core.vo.administration.user.DepartmentVO;
import net.sumaris.core.vo.administration.user.PersonVO;
import net.sumaris.core.vo.data.DataFetchOptions;
import net.sumaris.core.vo.data.IDataFetchOptions;
import net.sumaris.core.vo.data.IDataVO;
import net.sumaris.core.vo.data.VesselSnapshotVO;
......@@ -68,7 +62,6 @@ import java.util.stream.Collectors;
/**
* @author peck7 on 30/03/2020.
*/
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@NoRepositoryBean
@Slf4j
public abstract class DataRepositoryImpl<E extends IDataEntity<Integer>, V extends IDataVO<Integer>, F extends IDataFilter, O extends IDataFetchOptions>
......@@ -107,7 +100,7 @@ public abstract class DataRepositoryImpl<E extends IDataEntity<Integer>, V exten
@Override
public Page<V> findAll(F filter, Pageable pageable, O fetchOptions) {
return findAll(toSpecification(filter), pageable)
return findAll(toSpecification(filter, fetchOptions), pageable)
.map(e -> this.toVO(e, fetchOptions));
}
......@@ -276,6 +269,7 @@ public abstract class DataRepositoryImpl<E extends IDataEntity<Integer>, V exten
toVO(source, target, null, copyIfNull);
}
@SuppressWarnings("unchecked")
public void toVO(E source, V target, O fetchOptions, boolean copyIfNull) {
Beans.copyProperties(source, target);
......@@ -291,13 +285,13 @@ public abstract class DataRepositoryImpl<E extends IDataEntity<Integer>, V exten
// Vessel
if (source instanceof IWithVesselEntity && target instanceof IWithVesselSnapshotEntity) {
VesselSnapshotVO vesselSnapshot = new VesselSnapshotVO();
vesselSnapshot.setId((Integer) ((IWithVesselEntity) source).getVessel().getId());
vesselSnapshot.setId(((IWithVesselEntity<Integer, Vessel>) source).getVessel().getId());
((IWithVesselSnapshotEntity<Integer, VesselSnapshotVO>) target).setVesselSnapshot(vesselSnapshot);
}
// Observers
if (source instanceof IWithObserversEntity && target instanceof IWithObserversEntity) {
Set<Person> sourceObservers = ((IWithObserversEntity) source).getObservers();
Set<Person> sourceObservers = ((IWithObserversEntity<Integer, Person>) source).getObservers();
if ((fetchOptions == null || fetchOptions.isWithObservers()) && CollectionUtils.isNotEmpty(sourceObservers)) {
Set<PersonVO> observers = sourceObservers.stream()
.map(personRepository::toVO)
......
......@@ -25,6 +25,7 @@ package net.sumaris.core.dao.data.landing;
import lombok.extern.slf4j.Slf4j;
import net.sumaris.core.dao.data.RootDataRepositoryImpl;
import net.sumaris.core.dao.referential.location.LocationRepository;
import net.sumaris.core.dao.technical.Page;
import net.sumaris.core.model.data.Landing;
import net.sumaris.core.model.data.ObservedLocation;
import net.sumaris.core.model.data.Trip;
......@@ -39,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
......@@ -74,6 +76,54 @@ public class LandingRepositoryImpl
.and(hasExcludeVesselIds(filter.getExcludeVesselIds()));
}
@Override
public List<LandingVO> findAllByObservedLocationId(int observedLocationId, Page page, DataFetchOptions fetchOptions) {
boolean sortByVesselRegistrationCode = Landing.Fields.VESSEL.equalsIgnoreCase(page.getSortBy());
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("select l from Landing l ");
if (sortByVesselRegistrationCode) {
// add joins
queryBuilder.append("left outer join l.vessel v left outer join v.vesselRegistrationPeriods vrp ");
}
// single filter
queryBuilder.append("where l.observedLocation.id = :observedLocationId ");
if (sortByVesselRegistrationCode) {
// add natural order on vessel registration code
queryBuilder.append(
String.format(
"order by regexp_substr(vrp.registrationCode, '[^0-9]*') %1$s, to_number(regexp_substr(vrp.registrationCode, '[0-9]+')) %1$s nulls first",
page.getSortDirection()
)
);
} else {
// other sort
queryBuilder.append(
String.format(
"order by l.%s %s",
page.getSortBy(),
page.getSortDirection()
)
);
}
TypedQuery<Landing> query = getEntityManager().createQuery(queryBuilder.toString(), Landing.class);
query.setParameter("observedLocationId", observedLocationId);
return readPage(query, Landing.class, page.asPageable(), null)
.stream()
.map(landing -> toVO(landing, fetchOptions))
.collect(Collectors.toList())
;
}
@Override
public List<LandingVO> saveAllByObservedLocationId(int observedLocationId, List<LandingVO> sources) {
// Load parent entity
......@@ -153,15 +203,22 @@ public class LandingRepositoryImpl
}
}
// RankOrderOnVessel
if (source.getRankOrderOnVessel() == null) {
// RankOrder
if (source.getRankOrder() == null) {
// must compute next rank order
target.setRankOrderOnVessel(getNextRankOrderOnVessel(target));
target.setRankOrder(getNextRankOrder(target));
}
}
private Integer getNextRankOrderOnVessel(Landing landing) {
/**
* Compute rank order for this landing
* Default value = 1 and incremented if another landing with same vessel found
*
* @param landing landing to save
* @return next rank order
*/
private Integer getNextRankOrder(Landing landing) {
// Default value
int result = 1;
......@@ -179,9 +236,9 @@ public class LandingRepositoryImpl
Optional<Integer> currentRankOrder = findAll(filter).stream()
// exclude itself
.filter(landingVO -> !landingVO.getId().equals(landing.getId()))
.map(LandingVO::getRankOrderOnVessel)
.map(LandingVO::getRankOrder)
.filter(Objects::nonNull)
// find max rankOrderOnVessel
// find max rankOrder
.max(Integer::compareTo);
if (currentRankOrder.isPresent()) {
result = Math.max(result, currentRankOrder.get());
......
......@@ -23,9 +23,11 @@ package net.sumaris.core.dao.data.landing;
*/
import net.sumaris.core.dao.data.RootDataSpecifications;
import net.sumaris.core.dao.technical.Page;
import net.sumaris.core.dao.technical.jpa.BindableSpecification;
import net.sumaris.core.dao.technical.model.IEntity;
import net.sumaris.core.model.data.Landing;
import net.sumaris.core.vo.data.DataFetchOptions;
import net.sumaris.core.vo.data.LandingVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
......@@ -157,7 +159,8 @@ public interface LandingSpecifications extends RootDataSpecifications<Landing> {
};
}
// Not tested
List<LandingVO> findAllByObservedLocationId(int observedLocationId, Page page, DataFetchOptions fetchOptions);
List<LandingVO> saveAllByObservedLocationId(int observedLocationId, List<LandingVO> sources);
List<LandingVO> findAllByTripIds(List<Integer> tripIds);
......
......@@ -10,12 +10,12 @@ package net.sumaris.core.model.data;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
......@@ -105,9 +105,6 @@ public class Landing implements IRootDataEntity<Integer>,
@Column(name = "rank_order")
private Integer rankOrder;
@Column(name = "rank_order_on_vessel")
private Integer rankOrderOnVessel;
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Program.class)
@JoinColumn(name = "program_fk", nullable = false)
private Program program;
......
......@@ -154,7 +154,7 @@ public class AggregatedLandingServiceImpl implements AggregatedLandingService {
VesselActivityVO activity = new VesselActivityVO();
activity.setDate(date);
activity.setRankOrder(landing.getRankOrderOnVessel());
activity.setRankOrder(landing.getRankOrder());
activity.setComments(landing.getComments());
// Add parent links
......@@ -405,7 +405,7 @@ public class AggregatedLandingServiceImpl implements AggregatedLandingService {
private boolean createOrUpdateLandings(ObservedLocationVO observedLocation, List<LandingVO> landings, List<Integer> landingIdsToRemove, Integer vesselId, VesselActivityVO activity) {
boolean landingsDirty = false;
LandingVO landing = landings.stream().filter(landingVO -> Objects.equals(landingVO.getRankOrderOnVessel(), activity.getRankOrder())).findFirst().orElse(null);
LandingVO landing = landings.stream().filter(landingVO -> Objects.equals(landingVO.getRankOrder(), activity.getRankOrder())).findFirst().orElse(null);
// Get measurements
if (hasMeasurements(activity)) {
......@@ -504,7 +504,7 @@ public class AggregatedLandingServiceImpl implements AggregatedLandingService {
private boolean createOrUpdateTrips(ObservedLocationVO observedLocation, List<LandingVO> landings, Integer vesselId, VesselActivityVO activity) {
LandingVO landing = landings.stream().filter(landingVO -> Objects.equals(landingVO.getRankOrderOnVessel(), activity.getRankOrder())).findFirst().orElse(null);
LandingVO landing = landings.stream().filter(landingVO -> Objects.equals(landingVO.getRankOrder(), activity.getRankOrder())).findFirst().orElse(null);
Preconditions.checkNotNull(landing, "The landing should already exists.");
Integer tripId = landing.getTrip() != null ? landing.getTrip().getId() : landing.getTripId();
// Check if trip ids corresponds (both null is ok)
......@@ -697,7 +697,7 @@ public class AggregatedLandingServiceImpl implements AggregatedLandingService {
landing.setProgram(parent.getProgram());
landing.setDateTime(parent.getStartDateTime());
landing.setLocation(parent.getLocation());
landing.setRankOrderOnVessel(activity.getRankOrder());
landing.setRankOrder(activity.getRankOrder());
landing.setComments(activity.getComments());
landing.setRecorderDepartment(parent.getRecorderDepartment());
landing.setRecorderPerson(parent.getRecorderPerson());
......
......@@ -35,11 +35,12 @@ import net.sumaris.core.event.config.ConfigurationUpdatedEvent;
import net.sumaris.core.event.entity.EntityDeleteEvent;
import net.sumaris.core.event.entity.EntityInsertEvent;
import net.sumaris.core.event.entity.EntityUpdateEvent;
import net.sumaris.core.model.data.*;
import net.sumaris.core.model.data.Landing;
import net.sumaris.core.model.data.LandingMeasurement;
import net.sumaris.core.model.data.Trip;
import net.sumaris.core.model.referential.pmfm.MatrixEnum;
import net.sumaris.core.util.Beans;
import net.sumaris.core.util.DataBeans;
import net.sumaris.core.util.StringUtils;
import net.sumaris.core.vo.data.*;
import net.sumaris.core.vo.data.sample.SampleVO;
import net.sumaris.core.vo.filter.LandingFilterVO;
......@@ -90,12 +91,10 @@ public class LandingServiceImpl implements LandingService {
if (page != null) {
// FIXME LP: Sorting by 'vessel' must sort by registration code
/*if (Landing.Fields.VESSEL.equals(page.getSortBy())) {
page.setSortBy(
StringUtils.doting(Landing.Fields.VESSEL, Vessel.Fields.VESSEL_REGISTRATION_PERIODS, VesselRegistrationPeriod.Fields.REGISTRATION_CODE)
);
}*/
// Use specific query to get landings by observed location (consider only observedLocationId is the only filter attribute)
if (Beans.beanIsEmpty(filter, LandingFilterVO.Fields.OBSERVED_LOCATION_ID)) {
return landingRepository.findAllByObservedLocationId(filter.getObservedLocationId(), page, fetchOptions);
}
return landingRepository.findAll(filter, page, fetchOptions);
......
......@@ -533,7 +533,7 @@ public class TripServiceImpl implements TripService {
landing.setProgram(observedLocation.getProgram());
landing.setLocation(observedLocation.getLocation());
landing.setVesselSnapshot(trip.getVesselSnapshot());
landing.setRankOrderOnVessel(trip.getLanding().getRankOrderOnVessel());
landing.setRankOrder(trip.getLanding().getRankOrder());
landing.setDateTime(trip.getReturnDateTime());
landing.setObservers(Beans.getSet(trip.getObservers()));
landing.setRecorderDepartment(observedLocation.getRecorderDepartment());
......
......@@ -24,7 +24,6 @@ package net.sumaris.core.vo.data;
import lombok.Builder;
import lombok.Data;
import net.sumaris.core.dao.technical.jpa.IFetchOptions;
@Data
@Builder
......@@ -58,5 +57,4 @@ public class DataFetchOptions implements IDataFetchOptions {
@Builder.Default
private boolean withMeasurementValues = false;
}
......@@ -63,7 +63,6 @@ public class LandingVO implements IRootDataVO<Integer>,
private Date dateTime;
private LocationVO location;
private Integer rankOrder;
private Integer rankOrderOnVessel;
private Set<PersonVO> observers;
private List<SampleVO> samples;
......
......@@ -99,6 +99,16 @@
</addColumn>
</changeSet>
<!-- table LANDING: remove RANK_ORDER_ON_VESSEL if empty -->
<changeSet author="ludovic.pecquot@e-is.pro" id="1625816880596-5">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from LANDING where RANK_ORDER_ON_VESSEL is not null</sqlCheck>
</preConditions>
<dropColumn tableName="LANDING">
<column name="RANK_ORDER_ON_VESSEL"/>
</dropColumn>
</changeSet>
<!-- update SYSTEM_VERSION -->
<changeSet author="benoit.lavenier@e-is.pro" id="1625816880596-200" runOnChange="true">
......@@ -111,6 +121,7 @@
<column name="DESCRIPTION">
- BATCH: Add column SUBGROUP_COUNT
- Add table EXPECTED_SALE and add relations on SALE_MEASUREMENT and PRODUCT
- Drop column LANDING.RANK_ORDER_ON_VESSEL
</column>
<column name="CREATION_DATE" valueComputed="sysdate"/>
<column name="UPDATE_DATE" valueComputed="current_timestamp"/>
......
......@@ -25,7 +25,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
logicalFilePath="https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-core/src/main/resources/net/sumaris/core/db/changelog/hsqldb/db-changelog-1.8.7.xml">
logicalFilePath="https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-core/src/main/resources/net/sumaris/core/db/changelog/postgresql/db-changelog-1.8.7.xml">
<property name="sqlCheck.not_empty.sql" value="SELECT COUNT(*) FROM STATUS WHERE ID=1"/>
<property name="sqlCheck.not_empty.expectedResult" value="1"/>
......
......@@ -25,7 +25,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
logicalFilePath="https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-core/src/main/resources/net/sumaris/core/db/changelog/hsqldb/db-changelog-1.8.8.xml">
logicalFilePath="https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-core/src/main/resources/net/sumaris/core/db/changelog/postgresql/db-changelog-1.8.8.xml">
<property name="sqlCheck.not_empty.sql" value="SELECT COUNT(*) FROM STATUS WHERE ID=1"/>
<property name="sqlCheck.not_empty.expectedResult" value="1"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
~ #%L
~ SUMARiS
~ %%
~ Copyright (C) 2019 SUMARiS Consortium
~ %%
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public
~ License along with this program. If not, see
~ <http://www.gnu.org/licenses/gpl-3.0.html>.
~ #L%
-->
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
logicalFilePath="https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-core/src/main/resources/net/sumaris/core/db/changelog/postgresql/db-changelog-1.8.8.xml">
<property name="sqlCheck.not_empty.sql" value="SELECT COUNT(*) FROM STATUS WHERE ID=1"/>
<property name="sqlCheck.not_empty.expectedResult" value="1"/>
<!-- table LANDING: remove RANK_ORDER_ON_VESSEL if empty -->
<changeSet author="ludovic.pecquot@e-is.pro" id="1625816880596-5">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from LANDING where RANK_ORDER_ON_VESSEL is not null</sqlCheck>
</preConditions>
<dropColumn tableName="LANDING">
<column name="RANK_ORDER_ON_VESSEL"/>
</dropColumn>
</changeSet>
<!-- update SYSTEM_VERSION -->
<changeSet author="benoit.lavenier@e-is.pro" id="1625816880596-200" runOnChange="true">
<delete tableName="SYSTEM_VERSION">
<where>LABEL='1.9.0'</where>
</delete>
<insert tableName="SYSTEM_VERSION">
<column name="ID" valueComputed="nextval('system_version_seq')"/>
<column name="LABEL">1.9.0</column>
<column name="DESCRIPTION">
- Drop column LANDING.RANK_ORDER_ON_VESSEL
</column>
<column name="CREATION_DATE" valueComputed="current_timestamp"/>
<column name="UPDATE_DATE" valueComputed="current_timestamp"/>
<column name="COMMENTS">
</column>
</insert>
</changeSet>
</databaseChangeLog>