Use explicit stable ride identity index for migration compatibility

This commit is contained in:
bponders12-cell 2026-09-01 21:00:11 -04:00
parent 55d0905f91
commit de516d023e
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,9 @@ class Rides extends Table {
IntColumn get id => integer().autoIncrement()();
/// Stable MotorCloud identity. Generated once when a ride is created and
/// preserved across local database IDs, reinstalls/restores, and sync retries.
TextColumn get cloudRideId => text().nullable().unique()();
/// Uniqueness is enforced by the database migration/index rather than the
/// generated Drift declaration so older generated code remains upgrade-safe.
TextColumn get cloudRideId => text().nullable()();
DateTimeColumn get startTime => dateTime()();
DateTimeColumn get endTime => dateTime().nullable()();
RealColumn get distanceMiles => real().withDefault(const Constant(0.0))();
@ -15,7 +17,6 @@ class Rides extends Table {
RealColumn get maxBrakingG => real().withDefault(const Constant(0.0))();
RealColumn get best0to60Ms => real().nullable()();
RealColumn get best0to100Ms => real().nullable()();
RealColumn get distance => real().withDefault(const Constant(0.0))();
IntColumn get movingTime => integer().withDefault(const Constant(0))();
IntColumn get stoppedTime => integer().withDefault(const Constant(0))();
@ -23,7 +24,6 @@ class Rides extends Table {
RealColumn get topSpeed => real().withDefault(const Constant(0.0))();
RealColumn get elevationGain => real().withDefault(const Constant(0.0))();
RealColumn get elevationLoss => real().withDefault(const Constant(0.0))();
IntColumn get motorcycleId => integer().nullable()();
IntColumn get motorcycleYear => integer().nullable()();
TextColumn get motorcycleMake => text().nullable()();