forked from eclipse-edc/Connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
56 lines (50 loc) · 1.77 KB
/
schema.sql
File metadata and controls
56 lines (50 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--
-- Copyright (c) 2022 Daimler TSS GmbH
--
-- 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:
-- Daimler TSS GmbH - Initial SQL Query
--
-- THIS SCHEMA HAS BEEN WRITTEN AND TESTED ONLY FOR POSTGRES
-- table: edc_asset
CREATE TABLE IF NOT EXISTS edc_asset
(
asset_id VARCHAR NOT NULL,
created_at BIGINT NOT NULL,
PRIMARY KEY (asset_id)
);
-- table: edc_asset_dataaddress
CREATE TABLE IF NOT EXISTS edc_asset_dataaddress
(
asset_id_fk VARCHAR NOT NULL,
properties JSON NOT NULL,
PRIMARY KEY (asset_id_fk),
FOREIGN KEY (asset_id_fk) REFERENCES edc_asset (asset_id) ON DELETE CASCADE
);
COMMENT ON COLUMN edc_asset_dataaddress.properties IS 'DataAddress properties serialized as JSON';
-- table: edc_asset_property
CREATE TABLE IF NOT EXISTS edc_asset_property
(
asset_id_fk VARCHAR NOT NULL,
property_name VARCHAR NOT NULL,
property_value VARCHAR NOT NULL,
property_type VARCHAR NOT NULL,
property_is_private BOOLEAN NOT NULL,
PRIMARY KEY (asset_id_fk, property_name),
FOREIGN KEY (asset_id_fk) REFERENCES edc_asset (asset_id) ON DELETE CASCADE
);
COMMENT ON COLUMN edc_asset_property.property_name IS
'Asset property key';
COMMENT ON COLUMN edc_asset_property.property_value IS
'Asset property value';
COMMENT ON COLUMN edc_asset_property.property_type IS
'Asset property class name';
COMMENT ON COLUMN edc_asset_property.property_is_private IS
'Asset property private flag';
CREATE INDEX IF NOT EXISTS idx_edc_asset_property_value
ON edc_asset_property (property_name, property_value);