Skip to content

Commit

Permalink
Update CompasSclDataPostgreSQLRepository.java
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Wilbrink <[email protected]>
  • Loading branch information
pascalwilbrink authored Dec 11, 2024
1 parent cd4ac79 commit 9a6b164
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public List<IItem> list(SclFileType type) {
from (select distinct on (scl_file.id) *
from scl_file
where scl_file.type = ?
AND scl_file.is_deleted = false
order by scl_file.id
, scl_file.major_version desc
, scl_file.minor_version desc
Expand Down Expand Up @@ -115,6 +116,7 @@ left outer join (
and scl_data.patch_version = scl_file.patch_version
where scl_file.id = ?
and scl_file.type = ?
and scl_file.is_deleted = false
order by scl_file.major_version
, scl_file.minor_version
, scl_file.patch_version
Expand Down Expand Up @@ -162,6 +164,7 @@ public String findByUUID(SclFileType type, UUID id, Version version) {
and scl_file.major_version = ?
and scl_file.minor_version = ?
and scl_file.patch_version = ?
and scl_file.is_deleted = false
""";

try (var connection = dataSource.getConnection();
Expand Down Expand Up @@ -191,6 +194,7 @@ public boolean hasDuplicateSclName(SclFileType type, String name) {
select distinct on (scl_file.id) scl_file.name
from scl_file
where scl_file.type = ?
and scl_file.is_deleted = false
order by scl_file.id
, scl_file.major_version desc
, scl_file.minor_version desc
Expand Down Expand Up @@ -221,6 +225,7 @@ public IAbstractItem findMetaInfoByUUID(SclFileType type, UUID id) {
from scl_file
where scl_file.id = ?
and scl_file.type = ?
and scl_file.is_deleted = false
order by scl_file.major_version desc, scl_file.minor_version desc, scl_file.patch_version desc
""";

Expand Down Expand Up @@ -305,7 +310,8 @@ insert into scl_label(scl_id, major_version, minor_version, patch_version, label
@Transactional(REQUIRED)
public void delete(SclFileType type, UUID id) {
var sql = """
delete from scl_file
UPDATE scl_file
SET scl_file.is_deleted = false
where scl_file.id = ?
and scl_file.type = ?
""";
Expand All @@ -324,7 +330,8 @@ public void delete(SclFileType type, UUID id) {
@Transactional(REQUIRED)
public void delete(SclFileType type, UUID id, Version version) {
var sql = """
delete from scl_file
UPDATE scl_file
SET scl_file.is_deleted = false
where scl_file.id = ?
and scl_file.type = ?
and scl_file.major_version = ?
Expand Down

0 comments on commit 9a6b164

Please sign in to comment.