Add new state_updated_at field to alarm
Adjust the database interaction for the new state_updated_at field in the alarm table Change-Id: I941f9bfdc64a43820dbbe3a4c047cc64b93335a7
This commit is contained in:
parent
c6f025016d
commit
5b33c539bf
|
@ -240,7 +240,7 @@ public class AlarmDAOImpl implements AlarmDAO {
|
|||
try {
|
||||
h.begin();
|
||||
h.insert(
|
||||
"insert into alarm (id, alarm_definition_id, state, created_at, updated_at) values (?, ?, ?, NOW(), NOW())",
|
||||
"insert into alarm (id, alarm_definition_id, state, state_updated_at, created_at, updated_at) values (?, ?, ?, NOW(), NOW(), NOW())",
|
||||
alarm.getId(), alarm.getAlarmDefinitionId(), alarm.getState().toString());
|
||||
|
||||
for (final SubAlarm subAlarm : alarm.getSubAlarms()) {
|
||||
|
@ -276,7 +276,7 @@ public class AlarmDAOImpl implements AlarmDAO {
|
|||
public void updateState(String id, AlarmState state) {
|
||||
|
||||
try (final Handle h = db.open()) {
|
||||
h.createStatement("update alarm set state = :state, updated_at = NOW() where id = :id")
|
||||
h.createStatement("update alarm set state = :state, state_updated_at = NOW(), updated_at = NOW() where id = :id")
|
||||
.bind("id", id).bind("state", state.toString()).execute();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue