Add migration to add meter data columns

This commit is contained in:
Rob Watson 2022-07-19 10:01:24 +02:00
parent def17ff49c
commit 1d716594da
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,27 @@
ALTER TABLE et_runtime_data DROP COLUMN meter_test_status;
ALTER TABLE et_runtime_data DROP COLUMN meter_comm_status;
ALTER TABLE et_runtime_data DROP COLUMN active_power_l1;
ALTER TABLE et_runtime_data DROP COLUMN active_power_l2;
ALTER TABLE et_runtime_data DROP COLUMN active_power_l3;
ALTER TABLE et_runtime_data DROP COLUMN active_power_total;
ALTER TABLE et_runtime_data DROP COLUMN reactive_power_total;
ALTER TABLE et_runtime_data DROP COLUMN meter_power_factor1;
ALTER TABLE et_runtime_data DROP COLUMN meter_power_factor2;
ALTER TABLE et_runtime_data DROP COLUMN meter_power_factor3;
ALTER TABLE et_runtime_data DROP COLUMN meter_power_factor;
ALTER TABLE et_runtime_data DROP COLUMN meter_frequency;
ALTER TABLE et_runtime_data DROP COLUMN meter_energy_export_total;
ALTER TABLE et_runtime_data DROP COLUMN meter_energy_import_total;
ALTER TABLE et_runtime_data DROP COLUMN meter_active_power1;
ALTER TABLE et_runtime_data DROP COLUMN meter_active_power2;
ALTER TABLE et_runtime_data DROP COLUMN meter_active_power3;
ALTER TABLE et_runtime_data DROP COLUMN meter_active_power_total;
ALTER TABLE et_runtime_data DROP COLUMN meter_reactive_power1;
ALTER TABLE et_runtime_data DROP COLUMN meter_reactive_power2;
ALTER TABLE et_runtime_data DROP COLUMN meter_reactive_power3;
ALTER TABLE et_runtime_data DROP COLUMN meter_reactive_power_total;
ALTER TABLE et_runtime_data DROP COLUMN meter_apparent_power1;
ALTER TABLE et_runtime_data DROP COLUMN meter_apparent_power2;
ALTER TABLE et_runtime_data DROP COLUMN meter_apparent_power3;
ALTER TABLE et_runtime_data DROP COLUMN meter_apparent_power_total;
ALTER TABLE et_runtime_data DROP COLUMN meter_software_version;

View File

@ -0,0 +1,27 @@
ALTER TABLE et_runtime_data ADD COLUMN meter_test_status INT NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_comm_status INT NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN active_power_l1 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN active_power_l2 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN active_power_l3 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN active_power_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN reactive_power_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_power_factor1 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_power_factor2 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_power_factor3 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_power_factor DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_frequency DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_energy_export_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_energy_import_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_active_power1 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_active_power2 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_active_power3 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_active_power_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_reactive_power1 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_reactive_power2 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_reactive_power3 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_reactive_power_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_apparent_power1 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_apparent_power2 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_apparent_power3 DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_apparent_power_total DOUBLE PRECISION NOT NULL DEFAULT 0;
ALTER TABLE et_runtime_data ADD COLUMN meter_software_version INT NOT NULL DEFAULT 0;