-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #695 from catenax-ng/fix/confidence-values-defaults
fix(Confidence): add default confidence criteria
- Loading branch information
Showing
2 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
bpdm-gate/src/main/resources/db/migration/V5_0_0_4__create_temp_confidence_criteria.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
WITH mapping AS ( | ||
SELECT bp.id as business_partner_id, nextVal('bpdm_sequence') as confidence_id | ||
FROM business_partners bp | ||
WHERE bp.stage = 'Output' AND bp.legal_entity_confidence_id IS NULL | ||
), | ||
confidence AS ( | ||
INSERT INTO confidence_criteria (id, created_at, updated_at, uuid, shared_by_owner, checked_by_external_data_source, number_of_business_partners, last_confidence_check_at, next_confidence_check_at, confidence_level) | ||
SELECT mapping.confidence_id, NOW(), NOW(), gen_random_uuid(), FALSE, FALSE, 1, NOW()::timestamp, NOW()::timestamp, 0 | ||
FROM mapping | ||
) | ||
UPDATE business_partners bp | ||
SET legal_entity_confidence_id = mapping.confidence_id | ||
FROM mapping | ||
WHERE bp.id = mapping.business_partner_id; | ||
|
||
|
||
WITH mapping AS ( | ||
SELECT bp.id as business_partner_id, nextVal('bpdm_sequence') as confidence_id | ||
FROM business_partners bp | ||
WHERE bp.stage = 'Output' AND bp.address_confidence_id IS NULL | ||
), | ||
confidence AS ( | ||
INSERT INTO confidence_criteria (id, created_at, updated_at, uuid, shared_by_owner, checked_by_external_data_source, number_of_business_partners, last_confidence_check_at, next_confidence_check_at, confidence_level) | ||
SELECT mapping.confidence_id, NOW(), NOW(), gen_random_uuid(), FALSE, FALSE, 1, NOW()::timestamp, NOW()::timestamp, 0 | ||
FROM mapping | ||
) | ||
UPDATE business_partners bp | ||
SET address_confidence_id = mapping.confidence_id | ||
FROM mapping | ||
WHERE bp.id = mapping.business_partner_id; |
36 changes: 18 additions & 18 deletions
36
bpdm-pool/src/main/resources/db/migration/V5_0_0_1__add_confidence_criteria.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
ALTER TABLE legal_entities | ||
ADD COLUMN shared_by_owner boolean NOT NULL, | ||
ADD COLUMN checked_by_external_data_source boolean NOT NULL, | ||
ADD COLUMN number_of_business_partners INT NOT NULL, | ||
ADD COLUMN last_confidence_check_at TIMESTAMP NOT NULL, | ||
ADD COLUMN next_confidence_check_at TIMESTAMP NOT NULL, | ||
ADD COLUMN confidence_level INT NOT NULL; | ||
ADD COLUMN shared_by_owner boolean NOT NULL DEFAULT FALSE, | ||
ADD COLUMN checked_by_external_data_source boolean NOT NULL DEFAULT FALSE, | ||
ADD COLUMN number_of_business_partners INT NOT NULL DEFAULT 1, | ||
ADD COLUMN last_confidence_check_at TIMESTAMP NOT NULL DEFAULT NOW()::timestamp, | ||
ADD COLUMN next_confidence_check_at TIMESTAMP NOT NULL DEFAULT NOW()::timestamp, | ||
ADD COLUMN confidence_level INT NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE sites | ||
ADD COLUMN shared_by_owner boolean NOT NULL, | ||
ADD COLUMN checked_by_external_data_source boolean NOT NULL, | ||
ADD COLUMN number_of_business_partners INT NOT NULL, | ||
ADD COLUMN last_confidence_check_at TIMESTAMP NOT NULL, | ||
ADD COLUMN next_confidence_check_at TIMESTAMP NOT NULL, | ||
ADD COLUMN confidence_level INT NOT NULL; | ||
ADD COLUMN shared_by_owner boolean NOT NULL DEFAULT FALSE, | ||
ADD COLUMN checked_by_external_data_source boolean NOT NULL DEFAULT FALSE, | ||
ADD COLUMN number_of_business_partners INT NOT NULL DEFAULT 1, | ||
ADD COLUMN last_confidence_check_at TIMESTAMP NOT NULL DEFAULT NOW()::timestamp, | ||
ADD COLUMN next_confidence_check_at TIMESTAMP NOT NULL DEFAULT NOW()::timestamp, | ||
ADD COLUMN confidence_level INT NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE logistic_addresses | ||
ADD COLUMN shared_by_owner boolean NOT NULL, | ||
ADD COLUMN checked_by_external_data_source boolean NOT NULL, | ||
ADD COLUMN number_of_business_partners INT NOT NULL, | ||
ADD COLUMN last_confidence_check_at TIMESTAMP NOT NULL, | ||
ADD COLUMN next_confidence_check_at TIMESTAMP NOT NULL, | ||
ADD COLUMN confidence_level INT NOT NULL; | ||
ADD COLUMN shared_by_owner boolean NOT NULL DEFAULT FALSE, | ||
ADD COLUMN checked_by_external_data_source boolean NOT NULL DEFAULT FALSE, | ||
ADD COLUMN number_of_business_partners INT NOT NULL DEFAULT 1, | ||
ADD COLUMN last_confidence_check_at TIMESTAMP NOT NULL DEFAULT NOW()::timestamp, | ||
ADD COLUMN next_confidence_check_at TIMESTAMP NOT NULL DEFAULT NOW()::timestamp, | ||
ADD COLUMN confidence_level INT NOT NULL DEFAULT 0; | ||
|