Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Confidence): add default confidence criteria #695

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
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;

Loading