aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java2
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntityArranger.java2
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentExtract.java2
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java4
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java4
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java2
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java2
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java22
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java4
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java4
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java8
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java4
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java8
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java2
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java2
-rw-r--r--cps-ri/src/main/resources/changelog/changelog-master.yaml2
-rw-r--r--cps-ri/src/main/resources/changelog/db/changes/20-change-foreign-key-id-types-to-integer.yaml48
-rw-r--r--integration-test/src/test/resources/liquibase/test-changelog.yaml6
18 files changed, 89 insertions, 39 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java
index b59150f2e4..403741a2d6 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java
@@ -55,7 +55,7 @@ public class AnchorEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- private Integer id;
+ private Long id;
@NotNull
@Column
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntityArranger.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntityArranger.java
index c1b1322bb5..697eb8de00 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntityArranger.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntityArranger.java
@@ -58,7 +58,7 @@ public class FragmentEntityArranger {
* @return a collection of FragmentEntities (trees) with descendants.
*/
public static Collection<FragmentEntity> toFragmentEntityTreesAcrossAnchors(
- final Map<Integer, AnchorEntity> anchorEntityPerId, final Collection<FragmentExtract> fragmentExtracts) {
+ final Map<Long, AnchorEntity> anchorEntityPerId, final Collection<FragmentExtract> fragmentExtracts) {
final Map<Long, FragmentEntity> fragmentEntityPerId = new HashMap<>();
for (final FragmentExtract fragmentExtract : fragmentExtracts) {
final AnchorEntity anchorEntity = anchorEntityPerId.get(fragmentExtract.getAnchorId());
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentExtract.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentExtract.java
index 3aa19e670b..50be3c7b7a 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentExtract.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentExtract.java
@@ -24,7 +24,7 @@ public interface FragmentExtract {
Long getId();
- Integer getAnchorId();
+ Long getAnchorId();
String getXpath();
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java
index 53ae820262..71d97a3ed2 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public class YangResourceEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
+ private Integer id;
@NotNull
@Column
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
index 890941bf33..fdb01485ad 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
@@ -346,10 +346,10 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
fragmentRepository.findExtractsWithDescendantsByIds(fragmentEntityIds, fetchDescendantsOption.getDepth());
if (anchorEntity == ALL_ANCHORS) {
- final Collection<Integer> anchorIds = fragmentExtracts.stream()
+ final Collection<Long> anchorIds = fragmentExtracts.stream()
.map(FragmentExtract::getAnchorId).collect(Collectors.toSet());
final List<AnchorEntity> anchorEntities = anchorRepository.findAllById(anchorIds);
- final Map<Integer, AnchorEntity> anchorEntityPerId = anchorEntities.stream()
+ final Map<Long, AnchorEntity> anchorEntityPerId = anchorEntities.stream()
.collect(Collectors.toMap(AnchorEntity::getId, Function.identity()));
return FragmentEntityArranger.toFragmentEntityTreesAcrossAnchors(anchorEntityPerId, fragmentExtracts);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
index 5eda15a3d7..e149a1f149 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
@@ -172,7 +172,7 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
final SchemaSetEntity schemaSetEntity =
schemaSetRepository.getByDataspaceAndName(dataspaceEntity, schemaSetName);
- final List<Long> allYangResourceIds =
+ final List<Integer> allYangResourceIds =
yangResourceRepository.getResourceIdsByModuleReferences(allModuleReferences);
yangResourceRepository.insertSchemaSetIdYangResourceId(schemaSetEntity.getId(), allYangResourceIds);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java
index fe9ff9e2f0..5bb5857810 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java
@@ -33,7 +33,7 @@ import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
@Repository
-public interface AnchorRepository extends JpaRepository<AnchorEntity, Integer> {
+public interface AnchorRepository extends JpaRepository<AnchorEntity, Long> {
Optional<AnchorEntity> findByDataspaceAndName(DataspaceEntity dataspaceEntity, String name);
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java
index 2691be9844..425a7267d9 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java
@@ -47,7 +47,7 @@ public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>,
new DataNodeNotFoundException(anchorEntity.getDataspace().getName(), anchorEntity.getName(), xpath));
}
- List<FragmentEntity> findByAnchorIdAndXpathIn(int anchorId, String[] xpaths);
+ List<FragmentEntity> findByAnchorIdAndXpathIn(long anchorId, String[] xpaths);
default List<FragmentEntity> findByAnchorAndXpathIn(final AnchorEntity anchorEntity,
final Collection<String> xpaths) {
@@ -64,41 +64,41 @@ public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>,
return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths.toArray(new String[0]));
}
- boolean existsByAnchorId(int anchorId);
+ boolean existsByAnchorId(long anchorId);
@Query("SELECT f FROM FragmentEntity f WHERE anchor = :anchor")
List<FragmentExtract> findAllExtractsByAnchor(@Param("anchor") AnchorEntity anchorEntity);
@Modifying
@Query(value = "DELETE FROM fragment WHERE anchor_id = ANY (:anchorIds)", nativeQuery = true)
- void deleteByAnchorIdIn(@Param("anchorIds") int[] anchorIds);
+ void deleteByAnchorIdIn(@Param("anchorIds") long[] anchorIds);
default void deleteByAnchorIn(final Collection<AnchorEntity> anchorEntities) {
- deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToInt(id -> id).toArray());
+ deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToLong(id -> id).toArray());
}
@Modifying
@Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", nativeQuery = true)
- void deleteByAnchorIdAndXpaths(@Param("anchorId") int anchorId, @Param("xpaths") String[] xpaths);
+ void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") String[] xpaths);
- default void deleteByAnchorIdAndXpaths(final int anchorId, final Collection<String> xpaths) {
+ default void deleteByAnchorIdAndXpaths(final long anchorId, final Collection<String> xpaths) {
deleteByAnchorIdAndXpaths(anchorId, xpaths.toArray(new String[0]));
}
@Modifying
@Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE ANY (:xpathPatterns)",
nativeQuery = true)
- void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") int anchorId,
+ void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") long anchorId,
@Param("xpathPatterns") String[] xpathPatterns);
- default void deleteListsByAnchorIdAndXpaths(int anchorId, Collection<String> xpaths) {
+ default void deleteListsByAnchorIdAndXpaths(long anchorId, Collection<String> xpaths) {
final String[] listXpathPatterns = xpaths.stream().map(xpath -> xpath + "[%").toArray(String[]::new);
deleteByAnchorIdAndXpathLikeAny(anchorId, listXpathPatterns);
}
@Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)",
nativeQuery = true)
- List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") int anchorId,
+ List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") long anchorId,
@Param("xpaths") String[] xpaths);
default List<String> findAllXpathByAnchorAndXpathIn(final AnchorEntity anchorEntity,
@@ -125,11 +125,11 @@ public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>,
+ "FROM fragment f INNER JOIN parent_search p ON f.id = p.id",
nativeQuery = true
)
- List<FragmentExtract> findExtractsWithDescendants(@Param("anchorId") int anchorId,
+ List<FragmentExtract> findExtractsWithDescendants(@Param("anchorId") long anchorId,
@Param("xpaths") String[] xpaths,
@Param("maxDepth") int maxDepth);
- default List<FragmentExtract> findExtractsWithDescendants(final int anchorId, final Collection<String> xpaths,
+ default List<FragmentExtract> findExtractsWithDescendants(final long anchorId, final Collection<String> xpaths,
final int maxDepth) {
return findExtractsWithDescendants(anchorId, xpaths.toArray(new String[0]), maxDepth);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java
index ef701bc7dc..15ffa372f9 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,5 +25,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ModuleReferenceRepository extends JpaRepository<YangResourceEntity, Long>, ModuleReferenceQuery {}
+public interface ModuleReferenceRepository extends JpaRepository<YangResourceEntity, Integer>, ModuleReferenceQuery {}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java
index 0361749cdc..aacebd63b3 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,6 @@ import java.util.List;
public interface SchemaSetYangResourceRepository {
- void insertSchemaSetIdYangResourceId(final Integer schemaSetId, final List<Long> yangResourceId);
+ void insertSchemaSetIdYangResourceId(final Integer schemaSetId, final List<Integer> yangResourceIds);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java
index c87e15adbf..0f7f2c0658 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,15 +37,15 @@ public class SchemaSetYangResourceRepositoryImpl implements SchemaSetYangResourc
private EntityManager entityManager;
@Override
- public void insertSchemaSetIdYangResourceId(final Integer schemaSetId, final List<Long> yangResourceIds) {
+ public void insertSchemaSetIdYangResourceId(final Integer schemaSetId, final List<Integer> yangResourceIds) {
final Session session = entityManager.unwrap(Session.class);
session.doWork(connection -> {
try (PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO SCHEMA_SET_YANG_RESOURCES (SCHEMA_SET_ID, YANG_RESOURCE_ID) VALUES ( ?, ?)")) {
int sqlQueryCount = 1;
- for (final long yangResourceId : yangResourceIds) {
+ for (final int yangResourceId : yangResourceIds) {
preparedStatement.setInt(1, schemaSetId);
- preparedStatement.setLong(2, yangResourceId);
+ preparedStatement.setInt(2, yangResourceId);
preparedStatement.addBatch();
if (sqlQueryCount % MAX_INSERT_BATCH_SIZE == 0 || sqlQueryCount == yangResourceIds.size()) {
preparedStatement.executeBatch();
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java
index 335c971f97..9ae32b3e78 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,6 @@ import org.onap.cps.spi.model.ModuleReference;
public interface YangResourceNativeRepository {
- List<Long> getResourceIdsByModuleReferences(Collection<ModuleReference> moduleReferences);
+ List<Integer> getResourceIdsByModuleReferences(Collection<ModuleReference> moduleReferences);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java
index 850b274c91..f09a1a0c46 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,14 +42,14 @@ public class YangResourceNativeRepositoryImpl implements YangResourceNativeRepos
@Override
@Transactional
- public List<Long> getResourceIdsByModuleReferences(final Collection<ModuleReference> moduleReferences) {
+ public List<Integer> getResourceIdsByModuleReferences(final Collection<ModuleReference> moduleReferences) {
if (moduleReferences.isEmpty()) {
return Collections.emptyList();
}
final Query query = entityManager.createNativeQuery(getCombinedSelectSqlQuery(moduleReferences))
.unwrap(org.hibernate.query.NativeQuery.class)
- .addScalar("id", StandardBasicTypes.LONG);
- final List<Long> yangResourceIds = query.getResultList();
+ .addScalar("id", StandardBasicTypes.INTEGER);
+ final List<Integer> yangResourceIds = query.getResultList();
if (yangResourceIds.size() != moduleReferences.size()) {
log.warn("ModuleReferences size : {} and QueryResult size : {}", moduleReferences.size(),
yangResourceIds.size());
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java
index 7584ff65c0..df21ccc52e 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java
@@ -32,7 +32,7 @@ import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
@Repository
-public interface YangResourceRepository extends JpaRepository<YangResourceEntity, Long>,
+public interface YangResourceRepository extends JpaRepository<YangResourceEntity, Integer>,
YangResourceNativeRepository, SchemaSetYangResourceRepository {
List<YangResourceEntity> findAllByChecksumIn(String[] checksums);
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java b/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java
index 6f96cffdc1..eb3c5289af 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java
@@ -163,7 +163,7 @@ public class SessionManager {
final Session session = getSession(sessionId);
final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
final AnchorEntity anchorEntity = anchorRepository.getByDataspaceAndName(dataspaceEntity, anchorName);
- final int anchorId = anchorEntity.getId();
+ final long anchorId = anchorEntity.getId();
log.debug("Attempting to lock anchor {} for session {}", anchorName, sessionId);
session.get(AnchorEntity.class, anchorId, LockMode.PESSIMISTIC_WRITE);
log.info("Anchor {} successfully locked", anchorName);
diff --git a/cps-ri/src/main/resources/changelog/changelog-master.yaml b/cps-ri/src/main/resources/changelog/changelog-master.yaml
index 40e23e2e30..4e6986e71f 100644
--- a/cps-ri/src/main/resources/changelog/changelog-master.yaml
+++ b/cps-ri/src/main/resources/changelog/changelog-master.yaml
@@ -54,3 +54,5 @@ databaseChangeLog:
file: changelog/db/changes/18-cascade-delete-fragment-children.yaml
- include:
file: changelog/db/changes/19-delete-not-required-dataspace-id-from-fragment.yaml
+ - include:
+ file: changelog/db/changes/20-change-foreign-key-id-types-to-integer.yaml
diff --git a/cps-ri/src/main/resources/changelog/db/changes/20-change-foreign-key-id-types-to-integer.yaml b/cps-ri/src/main/resources/changelog/db/changes/20-change-foreign-key-id-types-to-integer.yaml
new file mode 100644
index 0000000000..4c0cd9f336
--- /dev/null
+++ b/cps-ri/src/main/resources/changelog/db/changes/20-change-foreign-key-id-types-to-integer.yaml
@@ -0,0 +1,48 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2023 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+databaseChangeLog:
+ - changeSet:
+ author: cps
+ id: 20
+ changes:
+ - modifyDataType:
+ columnName: dataspace_id
+ newDataType: INTEGER
+ tableName: schema_set
+ - modifyDataType:
+ columnName: schema_set_id
+ newDataType: INTEGER
+ tableName: schema_set_yang_resources
+ - modifyDataType:
+ columnName: yang_resource_id
+ newDataType: INTEGER
+ tableName: schema_set_yang_resources
+ rollback:
+ - modifyDataType:
+ columnName: dataspace_id
+ newDataType: BIGINT
+ tableName: schema_set
+ - modifyDataType:
+ columnName: schema_set_id
+ newDataType: BIGINT
+ tableName: schema_set_yang_resources
+ - modifyDataType:
+ columnName: yang_resource_id
+ newDataType: BIGINT
+ tableName: schema_set_yang_resources
diff --git a/integration-test/src/test/resources/liquibase/test-changelog.yaml b/integration-test/src/test/resources/liquibase/test-changelog.yaml
index f9e2e2fafb..3f12331453 100644
--- a/integration-test/src/test/resources/liquibase/test-changelog.yaml
+++ b/integration-test/src/test/resources/liquibase/test-changelog.yaml
@@ -150,7 +150,7 @@ databaseChangeLog:
constraints:
nullable: false
name: dataspace_id
- type: BIGINT
+ type: INTEGER
tableName: schema_set
- changeSet:
id: 1-6
@@ -232,12 +232,12 @@ databaseChangeLog:
constraints:
nullable: false
name: schema_set_id
- type: BIGINT
+ type: INTEGER
- column:
constraints:
nullable: false
name: yang_resource_id
- type: BIGINT
+ type: INTEGER
tableName: schema_set_yang_resources
- changeSet:
id: 1-10