1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 12:26:48 +01:00

db refactoring: change column order for health overlay table also

This commit is contained in:
Andreas Shimokawa 2016-08-10 23:26:25 +02:00
parent 359ed46b06
commit 68b303246d
3 changed files with 6 additions and 5 deletions

View File

@ -158,15 +158,16 @@ public class GBDaoGenerator {
private static Entity addPebbleHealthActivityKindOverlay(Schema schema, Entity user, Entity device) {
Entity activityOverlay = addEntity(schema, "PebbleHealthActivityOverlay");
activityOverlay.addIdProperty();
Property timestampFrom = activityOverlay.addIntProperty("timestampFrom").notNull().getProperty();
Property timestampTo = activityOverlay.addIntProperty("timestampTo").notNull().getProperty();
activityOverlay.addIntProperty("rawKind").notNull();
Property userId = activityOverlay.addLongProperty("userId").getProperty();
activityOverlay.addToOne(user, userId);
Property deviceId = activityOverlay.addLongProperty("deviceId").getProperty();
activityOverlay.addToOne(device, deviceId);
Property timestampFrom = activityOverlay.addIntProperty("timestampFrom").notNull().getProperty();
Property timestampTo = activityOverlay.addIntProperty("timestampTo").notNull().getProperty();
activityOverlay.addIntProperty("rawKind").notNull();
Index indexUnique = new Index();
indexUnique.addProperty(deviceId);
indexUnique.addProperty(timestampFrom);

View File

@ -72,7 +72,7 @@ class DatalogSessionHealthOverlayData extends DatalogSessionPebbleHealth {
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
for (OverlayRecord overlayRecord : overlayRecords) {
overlayList.add(new PebbleHealthActivityOverlay(null, overlayRecord.timestampStart, overlayRecord.timestampStart + overlayRecord.durationSeconds - 1, overlayRecord.type, userId, deviceId)); //TODO: consider if "-1" is what we really want
overlayList.add(new PebbleHealthActivityOverlay(null, userId, deviceId, overlayRecord.timestampStart, overlayRecord.timestampStart + overlayRecord.durationSeconds - 1, overlayRecord.type)); //TODO: consider if "-1" is what we really want
}
overlayDao.insertOrReplaceInTx(overlayList);
} catch (Exception ex) {

View File

@ -71,7 +71,7 @@ class DatalogSessionHealthSleep extends DatalogSessionPebbleHealth {
List<PebbleHealthActivityOverlay> overlayList = new ArrayList<>();
for (SleepRecord sleepRecord : sleepRecords) {
overlayList.add(new PebbleHealthActivityOverlay(null, sleepRecord.bedTimeStart, sleepRecord.bedTimeEnd - 1, sleepRecord.type, userId, deviceId)); //TODO: consider if "-1" is what we really want
overlayList.add(new PebbleHealthActivityOverlay(null, userId, deviceId, sleepRecord.bedTimeStart, sleepRecord.bedTimeEnd - 1, sleepRecord.type)); //TODO: consider if "-1" is what we really want
}
overlayDao.insertOrReplaceInTx(overlayList);
} catch (Exception ex) {