diff --git a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/ElectricPowerQualitySummaryEntity.java b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/ElectricPowerQualitySummaryEntity.java index 79e66554..ee0f0a1d 100644 --- a/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/ElectricPowerQualitySummaryEntity.java +++ b/openespi-common/src/main/java/org/greenbuttonalliance/espi/common/domain/usage/ElectricPowerQualitySummaryEntity.java @@ -113,6 +113,17 @@ public class ElectricPowerQualitySummaryEntity extends IdentifiedObject { @Column(name = "short_interruptions") private Long shortInterruptions; + /** + * Summary interval for this power quality summary. + * Time period covered by these measurements. + */ + @Embedded + @AttributeOverrides({ + @AttributeOverride(name = "start", column = @Column(name = "summary_interval_start")), + @AttributeOverride(name = "duration", column = @Column(name = "summary_interval_duration")) + }) + private DateTimeInterval summaryInterval; + /** * Number of supply voltage dips during the summary period. * Temporary reductions in RMS voltage. @@ -142,17 +153,6 @@ public class ElectricPowerQualitySummaryEntity extends IdentifiedObject { @Column(name = "temp_overvoltage") private Long tempOvervoltage; - /** - * Summary interval for this power quality summary. - * Time period covered by these measurements. - */ - @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "start", column = @Column(name = "summary_interval_start")), - @AttributeOverride(name = "duration", column = @Column(name = "summary_interval_duration")) - }) - private DateTimeInterval summaryInterval; - /** * Usage point that this power quality summary belongs to. * Many summaries can belong to one usage point. diff --git a/openespi-common/src/main/resources/db/migration/V3__Create_additiional_Base_Tables.sql b/openespi-common/src/main/resources/db/migration/V3__Create_additiional_Base_Tables.sql index da1bad5e..a3b96706 100644 --- a/openespi-common/src/main/resources/db/migration/V3__Create_additiional_Base_Tables.sql +++ b/openespi-common/src/main/resources/db/migration/V3__Create_additiional_Base_Tables.sql @@ -340,15 +340,16 @@ CREATE TABLE electric_power_quality_summaries power_frequency BIGINT, rapid_voltage_changes BIGINT, short_interruptions BIGINT, - supply_voltage_dips BIGINT, - supply_voltage_imbalance BIGINT, - supply_voltage_variations BIGINT, - temp_overvoltage BIGINT, -- Embedded DateTimeInterval: summaryInterval summary_interval_start BIGINT, summary_interval_duration BIGINT, + supply_voltage_dips BIGINT, + supply_voltage_imbalance BIGINT, + supply_voltage_variations BIGINT, + temp_overvoltage BIGINT, + -- Foreign key relationships usage_point_id CHAR(36),