Delete ConstraintViolationException, correct db migration script

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-08-23 17:11:33 +02:00
parent 8f35f5495d
commit 9f5a2ea3d5
5 changed files with 24 additions and 69 deletions

View File

@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleFields;
import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeFields;
import org.eclipse.hawkbit.repository.exception.ConstraintViolationException;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
@@ -515,10 +514,6 @@ public class JpaSoftwareManagement implements SoftwareManagement {
throw new EntityAlreadyExistsException("Given type contains an Id!");
}
if (type.getMaxAssignments() <= 0) {
throw new ConstraintViolationException("The value for max assignments has to be greater than 0!");
}
return softwareModuleTypeRepository.save((JpaSoftwareModuleType) type);
}

View File

@@ -1,2 +1,2 @@
alter table sp_software_module_type
add constraint maxAssignmentCheck check (maxAssignments > 0);
add constraint maxAssignmentCheck check (max_ds_assignments > 0);

View File

@@ -1,2 +1,2 @@
alter table sp_software_module_type
add constraint maxAssignmentCheck check (maxAssignments > 0);
add constraint maxAssignmentCheck check (max_ds_assignments > 0);