-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add migrations for the policy-monitor sql schema
- Loading branch information
Showing
17 changed files
with
151 additions
and
115 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
.../eclipse/tractusx/edc/postgresql/migration/PolicyMonitorPostgresqlMigrationExtension.java
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,23 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.postgresql.migration; | ||
|
||
public class PolicyMonitorPostgresqlMigrationExtension extends AbstractPostgresqlMigrationExtension { | ||
private static final String NAME_SUBSYSTEM = "policy-monitor"; | ||
|
||
protected String getSubsystemName() { | ||
return NAME_SUBSYSTEM; | ||
} | ||
} |
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
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
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
File renamed without changes.
46 changes: 46 additions & 0 deletions
46
...sx/edc/postgresql/migration/policy-monitor/V0_0_1__Init_PolicyMonitor_Database_Schema.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,46 @@ | ||
-- | ||
-- Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
-- | ||
-- This program and the accompanying materials are made available under the | ||
-- terms of the Apache License, Version 2.0 which is available at | ||
-- https://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
-- | ||
-- Contributors: | ||
-- Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
-- | ||
|
||
-- Statements are designed for and tested with Postgres only! | ||
|
||
|
||
CREATE TABLE IF NOT EXISTS edc_lease | ||
( | ||
leased_by VARCHAR NOT NULL, | ||
leased_at BIGINT, | ||
lease_duration INTEGER NOT NULL, | ||
lease_id VARCHAR NOT NULL | ||
CONSTRAINT lease_pk | ||
PRIMARY KEY | ||
); | ||
|
||
COMMENT ON COLUMN edc_lease.leased_at IS 'posix timestamp of lease'; | ||
COMMENT ON COLUMN edc_lease.lease_duration IS 'duration of lease in milliseconds'; | ||
|
||
CREATE TABLE IF NOT EXISTS edc_policy_monitor | ||
( | ||
entry_id VARCHAR NOT NULL PRIMARY KEY, | ||
state INTEGER NOT NULL , | ||
created_at BIGINT NOT NULL , | ||
updated_at BIGINT NOT NULL , | ||
state_count INTEGER DEFAULT 0 NOT NULL, | ||
state_time_stamp BIGINT, | ||
trace_context JSON, | ||
error_detail VARCHAR, | ||
lease_id VARCHAR | ||
CONSTRAINT policy_monitor_lease_lease_id_fk | ||
REFERENCES edc_lease | ||
ON DELETE SET NULL, | ||
properties JSON, | ||
contract_id VARCHAR | ||
); |
Oops, something went wrong.