Skip to content

Migration script

  • MSSQL
  • Battery power
  • v4 to v5
IF NOT EXISTS (SELECT NULL FROM SYS.EXTENDED_PROPERTIES WHERE [major_id] = OBJECT_ID('teleport_battery_power') AND [name] = N'version' AND [minor_id] = 0)
EXEC sys.sp_addextendedproperty
@name=N'version',
@value=5,
@level0type=N'SCHEMA',
@level0name=N'dbo',
@level1type=N'TABLE',
@level1name=N'teleport_battery_power'
ELSE EXEC sys.sp_updateextendedproperty
@name=N'version',
@value=5,
@level0type=N'SCHEMA',
@level0name=N'dbo',
@level1type=N'TABLE',
@level1name=N'teleport_battery_power';
ALTER TABLE teleport_battery_power
ADD
recent_setpoint_statistics_min decimal(23,3) DEFAULT NULL,
recent_setpoint_statistics_max decimal(23,3) DEFAULT NULL,
recent_setpoint_statistics_active_power_min decimal(23,3) DEFAULT NULL,
recent_setpoint_statistics_active_power_max decimal(23,3) DEFAULT NULL,
recent_setpoint_statistics_reactive_power_min decimal(23,3) DEFAULT NULL,
recent_setpoint_statistics_reactive_power_max decimal(23,3) DEFAULT NULL,
setpoints_desired_deliver_fcr_modbus_server decimal(23,3) DEFAULT NULL,
setpoints_effective_deliver_fcr decimal(23,3) DEFAULT NULL,
cellular_signal_quality decimal(7,2) DEFAULT NULL;
ALTER TABLE teleport_battery_power_bess_rack
ADD
rack_status varchar(32) DEFAULT NULL,
state_of_charge decimal(7,4) DEFAULT NULL,
cell_temperature_min decimal(6,2) DEFAULT NULL,
cell_temperature_cell_id_min int DEFAULT NULL,
cell_temperature_max decimal(6,2) DEFAULT NULL,
cell_temperature_cell_id_max int DEFAULT NULL,
cell_voltage_min decimal(6,3) DEFAULT NULL,
cell_voltage_cell_id_min int DEFAULT NULL,
cell_voltage_max decimal(6,3) DEFAULT NULL,
cell_voltage_cell_id_max int DEFAULT NULL,
cell_voltage_average decimal(6,3) DEFAULT NULL;