mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 12:26:48 +01:00
Make some primary and foreign keys not-nullable
This commit is contained in:
parent
afef50dfab
commit
f2b344349f
@ -63,7 +63,7 @@ public class GBDaoGenerator {
|
||||
tag.addIdProperty();
|
||||
tag.addStringProperty("name").notNull();
|
||||
tag.addStringProperty("description").javaDocGetterAndSetter("An optional description of this tag.");
|
||||
tag.addLongProperty("userId");
|
||||
tag.addLongProperty("userId").notNull();
|
||||
|
||||
return tag;
|
||||
}
|
||||
@ -128,8 +128,8 @@ public class GBDaoGenerator {
|
||||
}
|
||||
|
||||
private static void addDateValidityTo(Entity entity) {
|
||||
entity.addDateProperty(VALID_FROM_UTC);
|
||||
entity.addDateProperty(VALID_TO_UTC);
|
||||
entity.addDateProperty(VALID_FROM_UTC).codeBeforeGetter(OVERRIDE);
|
||||
entity.addDateProperty(VALID_TO_UTC).codeBeforeGetter(OVERRIDE);
|
||||
|
||||
entity.implementsInterface(VALID_BY_DATE);
|
||||
}
|
||||
@ -189,10 +189,10 @@ public class GBDaoGenerator {
|
||||
activityOverlay.addIntProperty(TIMESTAMP_FROM).notNull().primaryKey();
|
||||
activityOverlay.addIntProperty(TIMESTAMP_TO).notNull().primaryKey();
|
||||
activityOverlay.addIntProperty(SAMPLE_RAW_KIND).notNull().primaryKey();
|
||||
Property deviceId = activityOverlay.addLongProperty("deviceId").primaryKey().getProperty();
|
||||
Property deviceId = activityOverlay.addLongProperty("deviceId").primaryKey().notNull().getProperty();
|
||||
activityOverlay.addToOne(device, deviceId);
|
||||
|
||||
Property userId = activityOverlay.addLongProperty("userId").getProperty();
|
||||
Property userId = activityOverlay.addLongProperty("userId").notNull().getProperty();
|
||||
activityOverlay.addToOne(user, userId);
|
||||
activityOverlay.addByteArrayProperty("rawPebbleHealthData");
|
||||
|
||||
@ -221,9 +221,9 @@ public class GBDaoGenerator {
|
||||
"intensity, are device specific. Normalized values can be retrieved through the\n" +
|
||||
"corresponding {@link SampleProvider}.");
|
||||
activitySample.addIntProperty("timestamp").notNull().codeBeforeGetterAndSetter(OVERRIDE).primaryKey();
|
||||
Property deviceId = activitySample.addLongProperty("deviceId").primaryKey().codeBeforeGetterAndSetter(OVERRIDE).getProperty();
|
||||
Property deviceId = activitySample.addLongProperty("deviceId").primaryKey().notNull().codeBeforeGetterAndSetter(OVERRIDE).getProperty();
|
||||
activitySample.addToOne(device, deviceId);
|
||||
Property userId = activitySample.addLongProperty("userId").codeBeforeGetterAndSetter(OVERRIDE).getProperty();
|
||||
Property userId = activitySample.addLongProperty("userId").notNull().codeBeforeGetterAndSetter(OVERRIDE).getProperty();
|
||||
activitySample.addToOne(user, userId);
|
||||
}
|
||||
|
||||
|
@ -605,8 +605,8 @@ public class DBHelper {
|
||||
int colSteps = cursor.getColumnIndex(KEY_STEPS);
|
||||
int colType = cursor.getColumnIndex(KEY_TYPE);
|
||||
int colCustomShort = cursor.getColumnIndex(KEY_CUSTOM_SHORT);
|
||||
Long deviceId = DBHelper.getDevice(targetDevice, targetSession).getId();
|
||||
Long userId = user.getId();
|
||||
long deviceId = DBHelper.getDevice(targetDevice, targetSession).getId();
|
||||
long userId = user.getId();
|
||||
newSamples = new ArrayList<>(Math.min(BATCH_SIZE, cursor.getCount()));
|
||||
while (cursor.moveToNext()) {
|
||||
T newSample = sampleProvider.createActivitySample();
|
||||
|
@ -42,7 +42,7 @@ public abstract class AbstractActivitySample implements ActivitySample {
|
||||
|
||||
public abstract void setTimestamp(int timestamp);
|
||||
|
||||
public abstract void setUserId(Long userId);
|
||||
public abstract void setUserId(long userId);
|
||||
|
||||
@Override
|
||||
public void setHeartRate(int heartRate) {
|
||||
@ -53,11 +53,11 @@ public abstract class AbstractActivitySample implements ActivitySample {
|
||||
return NOT_MEASURED;
|
||||
}
|
||||
|
||||
public abstract void setDeviceId(Long deviceId);
|
||||
public abstract void setDeviceId(long deviceId);
|
||||
|
||||
public abstract Long getDeviceId();
|
||||
public abstract long getDeviceId();
|
||||
|
||||
public abstract Long getUserId();
|
||||
public abstract long getUserId();
|
||||
|
||||
@Override
|
||||
public int getRawIntensity() {
|
||||
|
Loading…
Reference in New Issue
Block a user