84aaaff9444e build(deps): bump testcontainers from 1.20.0 to 1.20.1 (#4387) dependabot[bot],
| .. | ||
| docs/ | ||
| src/ | ||
| README.md | 2.3 KiB | |
| build.gradle.kts | 1.3 KiB | |
README.md
SQL Asset
Provides SQL persistence for assets.
Prerequisites
Please apply this schema to your SQL database.
Entity Diagram
Configuration
| Key | Description | Mandatory |
|---|---|---|
| edc.datasource.asset.name | Datasource used by this extension | X |
Migrate from 0.3.1 to 0.3.2
This table structure has been changed, from 3 tables (one for the asset, one for properties and one for data address) to
a single table with json fields.
To migrate an existing database, please first add the 3 new columns in the edc_asset table:
ALTER TABLE edc_asset
ADD COLUMN properties json DEFAULT '{}',
ADD COLUMN private_properties json DEFAULT '{}',
ADD COLUMN data_address json DEFAULT '{}';
Then migrate the existing data in the new format:
UPDATE edc_asset
SET properties=(SELECT JSON_OBJECT_AGG(property_name, property_value)
FROM edc_asset_property
WHERE asset_id_fk = edc_asset.asset_id
AND property_is_private = FALSE),
private_properties=(SELECT JSON_OBJECT_AGG(property_name, property_value)
FROM edc_asset_property
WHERE asset_id_fk = edc_asset.asset_id
AND property_is_private = TRUE),
data_address=(SELECT properties FROM edc_asset_dataaddress WHERE asset_id_fk = edc_asset.asset_id);
After the migration, the tables edc_asset_dataaddress and edc_asset_property can be deleted.