-
Notifications
You must be signed in to change notification settings - Fork 23
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 #1109 from eclipse-tractusx/feature/985-notificati…
…on-contractagreements feature(chore):985 Added notification contracts.
- Loading branch information
Showing
1 changed file
with
17 additions
and
9 deletions.
There are no files selected for viewing
26 changes: 17 additions & 9 deletions
26
tx-backend/src/main/resources/db/migration/R__create_contract_agreement_view.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,11 +1,19 @@ | ||
create or replace view contract_agreement_view as | ||
-- Explicitly define column names for the view | ||
CREATE OR REPLACE VIEW contract_agreement_view (id, contract_agreement_id, type, created) AS | ||
SELECT * | ||
FROM ((SELECT assets_as_built.id, contract_agreement_id, 'ASSET_AS_BUILT' as type, created | ||
FROM assets_as_built | ||
where contract_agreement_id is not null) | ||
UNION ALL | ||
(SELECT assets_as_planned.id, contract_agreement_id, 'ASSET_AS_PLANNED' as type, created | ||
FROM assets_as_planned | ||
where contract_agreement_id is not null)) results | ||
FROM ( | ||
(SELECT assets_as_built.id, | ||
contract_agreement_id, | ||
'ASSET_AS_BUILT' AS type, | ||
created | ||
FROM assets_as_built | ||
WHERE contract_agreement_id IS NOT NULL) | ||
UNION ALL | ||
(SELECT assets_as_planned.id, | ||
contract_agreement_id, | ||
'ASSET_AS_PLANNED' AS type, | ||
created | ||
FROM assets_as_planned | ||
WHERE contract_agreement_id IS NOT NULL) | ||
) results | ||
ORDER BY created DESC; | ||
|