| 1 | -- |
| 2 | -- Copyright (c) 2022 ZF Friedrichshafen AG |
| 3 | -- |
| 4 | -- This program and the accompanying materials are made available under the |
| 5 | -- terms of the Apache License, Version 2.0 which is available at |
| 6 | -- https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | -- |
| 8 | -- SPDX-License-Identifier: Apache-2.0 |
| 9 | -- |
| 10 | -- Contributors: |
| 11 | -- ZF Friedrichshafen AG - Initial SQL Query |
| 12 | -- |
| 13 | |
| 14 | -- Statements are designed for and tested with Postgres only! |
| 15 | |
| 16 | -- table: edc_policydefinitions |
| 17 | CREATE TABLE IF NOT EXISTS edc_policydefinitions |
| 18 | ( |
| 19 | policy_id VARCHAR NOT NULL, |
| 20 | created_at BIGINT NOT NULL, |
| 21 | permissions JSON, |
| 22 | prohibitions JSON, |
| 23 | duties JSON, |
| 24 | profiles JSON, |
| 25 | extensible_properties JSON, |
| 26 | inherits_from VARCHAR, |
| 27 | assigner VARCHAR, |
| 28 | assignee VARCHAR, |
| 29 | target VARCHAR, |
| 30 | policy_type VARCHAR NOT NULL, |
| 31 | private_properties JSON, |
| 32 | PRIMARY KEY (policy_id) |
| 33 | ); |
| 34 | |
| 35 | COMMENT ON COLUMN edc_policydefinitions.permissions IS 'Java List<Permission> serialized as JSON'; |
| 36 | COMMENT ON COLUMN edc_policydefinitions.prohibitions IS 'Java List<Prohibition> serialized as JSON'; |
| 37 | COMMENT ON COLUMN edc_policydefinitions.duties IS 'Java List<Duty> serialized as JSON'; |
| 38 | COMMENT ON COLUMN edc_policydefinitions.profiles IS 'Java List<String> serialized as JSON'; |
| 39 | COMMENT ON COLUMN edc_policydefinitions.extensible_properties IS 'Java Map<String, Object> serialized as JSON'; |
| 40 | COMMENT ON COLUMN edc_policydefinitions.policy_type IS 'Java PolicyType serialized as JSON'; |
| 41 | |
| 42 | CREATE UNIQUE INDEX IF NOT EXISTS edc_policydefinitions_id_uindex |
| 43 | ON edc_policydefinitions (policy_id); |