From 5ff7e69fab7ee7bd00965e10cf16965b65a81425 Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Sun, 15 Mar 2020 20:07:43 -0700 Subject: [PATCH] Add locations table --- lib/src/data/database/database.g.dart | 515 ++++++++++++++------- lib/src/data/database/tables/checkup.dart | 6 +- lib/src/data/database/tables/index.dart | 7 +- lib/src/data/database/tables/location.dart | 12 + 4 files changed, 376 insertions(+), 164 deletions(-) create mode 100644 lib/src/data/database/tables/location.dart diff --git a/lib/src/data/database/database.g.dart b/lib/src/data/database/database.g.dart index 382b002..c60cec7 100644 --- a/lib/src/data/database/database.g.dart +++ b/lib/src/data/database/database.g.dart @@ -10,20 +10,14 @@ part of 'database.dart'; class Checkup extends DataClass implements Insertable { final int id; final DateTime created; - final double locationLat; - final double locationLong; - final double locationAccuracy; - final double locationAltitude; + final int location; final SubjectiveQuestions subjectiveQuestions; final Vitals vitals; final String assessment; Checkup( {@required this.id, @required this.created, - this.locationLat, - this.locationLong, - this.locationAccuracy, - this.locationAltitude, + this.location, this.subjectiveQuestions, this.vitals, this.assessment}); @@ -32,20 +26,13 @@ class Checkup extends DataClass implements Insertable { final effectivePrefix = prefix ?? ''; final intType = db.typeSystem.forDartType(); final dateTimeType = db.typeSystem.forDartType(); - final doubleType = db.typeSystem.forDartType(); final stringType = db.typeSystem.forDartType(); return Checkup( id: intType.mapFromDatabaseResponse(data['${effectivePrefix}id']), created: dateTimeType .mapFromDatabaseResponse(data['${effectivePrefix}created']), - locationLat: doubleType - .mapFromDatabaseResponse(data['${effectivePrefix}location_lat']), - locationLong: doubleType - .mapFromDatabaseResponse(data['${effectivePrefix}location_long']), - locationAccuracy: doubleType - .mapFromDatabaseResponse(data['${effectivePrefix}location_accuracy']), - locationAltitude: doubleType - .mapFromDatabaseResponse(data['${effectivePrefix}location_altitude']), + location: + intType.mapFromDatabaseResponse(data['${effectivePrefix}location']), subjectiveQuestions: $CheckupsTable.$converter0.mapToDart( stringType.mapFromDatabaseResponse( data['${effectivePrefix}subjective_questions'])), @@ -61,10 +48,7 @@ class Checkup extends DataClass implements Insertable { return Checkup( id: serializer.fromJson(json['id']), created: serializer.fromJson(json['created']), - locationLat: serializer.fromJson(json['locationLat']), - locationLong: serializer.fromJson(json['locationLong']), - locationAccuracy: serializer.fromJson(json['locationAccuracy']), - locationAltitude: serializer.fromJson(json['locationAltitude']), + location: serializer.fromJson(json['location']), subjectiveQuestions: serializer.fromJson(json['subjectiveQuestions']), vitals: serializer.fromJson(json['vitals']), @@ -77,10 +61,7 @@ class Checkup extends DataClass implements Insertable { return { 'id': serializer.toJson(id), 'created': serializer.toJson(created), - 'locationLat': serializer.toJson(locationLat), - 'locationLong': serializer.toJson(locationLong), - 'locationAccuracy': serializer.toJson(locationAccuracy), - 'locationAltitude': serializer.toJson(locationAltitude), + 'location': serializer.toJson(location), 'subjectiveQuestions': serializer.toJson(subjectiveQuestions), 'vitals': serializer.toJson(vitals), @@ -95,18 +76,9 @@ class Checkup extends DataClass implements Insertable { created: created == null && nullToAbsent ? const Value.absent() : Value(created), - locationLat: locationLat == null && nullToAbsent + location: location == null && nullToAbsent ? const Value.absent() - : Value(locationLat), - locationLong: locationLong == null && nullToAbsent - ? const Value.absent() - : Value(locationLong), - locationAccuracy: locationAccuracy == null && nullToAbsent - ? const Value.absent() - : Value(locationAccuracy), - locationAltitude: locationAltitude == null && nullToAbsent - ? const Value.absent() - : Value(locationAltitude), + : Value(location), subjectiveQuestions: subjectiveQuestions == null && nullToAbsent ? const Value.absent() : Value(subjectiveQuestions), @@ -121,20 +93,14 @@ class Checkup extends DataClass implements Insertable { Checkup copyWith( {int id, DateTime created, - double locationLat, - double locationLong, - double locationAccuracy, - double locationAltitude, + int location, SubjectiveQuestions subjectiveQuestions, Vitals vitals, String assessment}) => Checkup( id: id ?? this.id, created: created ?? this.created, - locationLat: locationLat ?? this.locationLat, - locationLong: locationLong ?? this.locationLong, - locationAccuracy: locationAccuracy ?? this.locationAccuracy, - locationAltitude: locationAltitude ?? this.locationAltitude, + location: location ?? this.location, subjectiveQuestions: subjectiveQuestions ?? this.subjectiveQuestions, vitals: vitals ?? this.vitals, assessment: assessment ?? this.assessment, @@ -144,10 +110,7 @@ class Checkup extends DataClass implements Insertable { return (StringBuffer('Checkup(') ..write('id: $id, ') ..write('created: $created, ') - ..write('locationLat: $locationLat, ') - ..write('locationLong: $locationLong, ') - ..write('locationAccuracy: $locationAccuracy, ') - ..write('locationAltitude: $locationAltitude, ') + ..write('location: $location, ') ..write('subjectiveQuestions: $subjectiveQuestions, ') ..write('vitals: $vitals, ') ..write('assessment: $assessment') @@ -161,27 +124,16 @@ class Checkup extends DataClass implements Insertable { $mrjc( created.hashCode, $mrjc( - locationLat.hashCode, - $mrjc( - locationLong.hashCode, - $mrjc( - locationAccuracy.hashCode, - $mrjc( - locationAltitude.hashCode, - $mrjc( - subjectiveQuestions.hashCode, - $mrjc( - vitals.hashCode, assessment.hashCode))))))))); + location.hashCode, + $mrjc(subjectiveQuestions.hashCode, + $mrjc(vitals.hashCode, assessment.hashCode)))))); @override bool operator ==(dynamic other) => identical(this, other) || (other is Checkup && other.id == this.id && other.created == this.created && - other.locationLat == this.locationLat && - other.locationLong == this.locationLong && - other.locationAccuracy == this.locationAccuracy && - other.locationAltitude == this.locationAltitude && + other.location == this.location && other.subjectiveQuestions == this.subjectiveQuestions && other.vitals == this.vitals && other.assessment == this.assessment); @@ -190,20 +142,14 @@ class Checkup extends DataClass implements Insertable { class CheckupsCompanion extends UpdateCompanion { final Value id; final Value created; - final Value locationLat; - final Value locationLong; - final Value locationAccuracy; - final Value locationAltitude; + final Value location; final Value subjectiveQuestions; final Value vitals; final Value assessment; const CheckupsCompanion({ this.id = const Value.absent(), this.created = const Value.absent(), - this.locationLat = const Value.absent(), - this.locationLong = const Value.absent(), - this.locationAccuracy = const Value.absent(), - this.locationAltitude = const Value.absent(), + this.location = const Value.absent(), this.subjectiveQuestions = const Value.absent(), this.vitals = const Value.absent(), this.assessment = const Value.absent(), @@ -211,10 +157,7 @@ class CheckupsCompanion extends UpdateCompanion { CheckupsCompanion.insert({ this.id = const Value.absent(), this.created = const Value.absent(), - this.locationLat = const Value.absent(), - this.locationLong = const Value.absent(), - this.locationAccuracy = const Value.absent(), - this.locationAltitude = const Value.absent(), + this.location = const Value.absent(), this.subjectiveQuestions = const Value.absent(), this.vitals = const Value.absent(), this.assessment = const Value.absent(), @@ -222,20 +165,14 @@ class CheckupsCompanion extends UpdateCompanion { CheckupsCompanion copyWith( {Value id, Value created, - Value locationLat, - Value locationLong, - Value locationAccuracy, - Value locationAltitude, + Value location, Value subjectiveQuestions, Value vitals, Value assessment}) { return CheckupsCompanion( id: id ?? this.id, created: created ?? this.created, - locationLat: locationLat ?? this.locationLat, - locationLong: locationLong ?? this.locationLong, - locationAccuracy: locationAccuracy ?? this.locationAccuracy, - locationAltitude: locationAltitude ?? this.locationAltitude, + location: location ?? this.location, subjectiveQuestions: subjectiveQuestions ?? this.subjectiveQuestions, vitals: vitals ?? this.vitals, assessment: assessment ?? this.assessment, @@ -265,6 +202,329 @@ class $CheckupsTable extends Checkups with TableInfo<$CheckupsTable, Checkup> { defaultValue: currentDateAndTime); } + final VerificationMeta _locationMeta = const VerificationMeta('location'); + GeneratedIntColumn _location; + @override + GeneratedIntColumn get location => _location ??= _constructLocation(); + GeneratedIntColumn _constructLocation() { + return GeneratedIntColumn('location', $tableName, true, + $customConstraints: 'NULL REFERENCES locations(id)'); + } + + final VerificationMeta _subjectiveQuestionsMeta = + const VerificationMeta('subjectiveQuestions'); + GeneratedTextColumn _subjectiveQuestions; + @override + GeneratedTextColumn get subjectiveQuestions => + _subjectiveQuestions ??= _constructSubjectiveQuestions(); + GeneratedTextColumn _constructSubjectiveQuestions() { + return GeneratedTextColumn( + 'subjective_questions', + $tableName, + true, + ); + } + + final VerificationMeta _vitalsMeta = const VerificationMeta('vitals'); + GeneratedTextColumn _vitals; + @override + GeneratedTextColumn get vitals => _vitals ??= _constructVitals(); + GeneratedTextColumn _constructVitals() { + return GeneratedTextColumn( + 'vitals', + $tableName, + true, + ); + } + + final VerificationMeta _assessmentMeta = const VerificationMeta('assessment'); + GeneratedTextColumn _assessment; + @override + GeneratedTextColumn get assessment => _assessment ??= _constructAssessment(); + GeneratedTextColumn _constructAssessment() { + return GeneratedTextColumn( + 'assessment', + $tableName, + true, + ); + } + + @override + List get $columns => + [id, created, location, subjectiveQuestions, vitals, assessment]; + @override + $CheckupsTable get asDslTable => this; + @override + String get $tableName => _alias ?? 'checkups'; + @override + final String actualTableName = 'checkups'; + @override + VerificationContext validateIntegrity(CheckupsCompanion d, + {bool isInserting = false}) { + final context = VerificationContext(); + if (d.id.present) { + context.handle(_idMeta, id.isAcceptableValue(d.id.value, _idMeta)); + } + if (d.created.present) { + context.handle(_createdMeta, + created.isAcceptableValue(d.created.value, _createdMeta)); + } + if (d.location.present) { + context.handle(_locationMeta, + location.isAcceptableValue(d.location.value, _locationMeta)); + } + context.handle( + _subjectiveQuestionsMeta, const VerificationResult.success()); + context.handle(_vitalsMeta, const VerificationResult.success()); + if (d.assessment.present) { + context.handle(_assessmentMeta, + assessment.isAcceptableValue(d.assessment.value, _assessmentMeta)); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + Checkup map(Map data, {String tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null; + return Checkup.fromData(data, _db, prefix: effectivePrefix); + } + + @override + Map entityToSql(CheckupsCompanion d) { + final map = {}; + if (d.id.present) { + map['id'] = Variable(d.id.value); + } + if (d.created.present) { + map['created'] = Variable(d.created.value); + } + if (d.location.present) { + map['location'] = Variable(d.location.value); + } + if (d.subjectiveQuestions.present) { + final converter = $CheckupsTable.$converter0; + map['subjective_questions'] = Variable( + converter.mapToSql(d.subjectiveQuestions.value)); + } + if (d.vitals.present) { + final converter = $CheckupsTable.$converter1; + map['vitals'] = + Variable(converter.mapToSql(d.vitals.value)); + } + if (d.assessment.present) { + map['assessment'] = Variable(d.assessment.value); + } + return map; + } + + @override + $CheckupsTable createAlias(String alias) { + return $CheckupsTable(_db, alias); + } + + static TypeConverter $converter0 = + const SubjectiveQuestionsConverter(); + static TypeConverter $converter1 = const VitalsConverter(); +} + +class Location extends DataClass implements Insertable { + final int id; + final DateTime created; + final double locationLat; + final double locationLong; + final double locationAccuracy; + final double locationAltitude; + Location( + {@required this.id, + @required this.created, + this.locationLat, + this.locationLong, + this.locationAccuracy, + this.locationAltitude}); + factory Location.fromData(Map data, GeneratedDatabase db, + {String prefix}) { + final effectivePrefix = prefix ?? ''; + final intType = db.typeSystem.forDartType(); + final dateTimeType = db.typeSystem.forDartType(); + final doubleType = db.typeSystem.forDartType(); + return Location( + id: intType.mapFromDatabaseResponse(data['${effectivePrefix}id']), + created: dateTimeType + .mapFromDatabaseResponse(data['${effectivePrefix}created']), + locationLat: doubleType + .mapFromDatabaseResponse(data['${effectivePrefix}location_lat']), + locationLong: doubleType + .mapFromDatabaseResponse(data['${effectivePrefix}location_long']), + locationAccuracy: doubleType + .mapFromDatabaseResponse(data['${effectivePrefix}location_accuracy']), + locationAltitude: doubleType + .mapFromDatabaseResponse(data['${effectivePrefix}location_altitude']), + ); + } + factory Location.fromJson(Map json, + {ValueSerializer serializer}) { + serializer ??= moorRuntimeOptions.defaultSerializer; + return Location( + id: serializer.fromJson(json['id']), + created: serializer.fromJson(json['created']), + locationLat: serializer.fromJson(json['locationLat']), + locationLong: serializer.fromJson(json['locationLong']), + locationAccuracy: serializer.fromJson(json['locationAccuracy']), + locationAltitude: serializer.fromJson(json['locationAltitude']), + ); + } + @override + Map toJson({ValueSerializer serializer}) { + serializer ??= moorRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'created': serializer.toJson(created), + 'locationLat': serializer.toJson(locationLat), + 'locationLong': serializer.toJson(locationLong), + 'locationAccuracy': serializer.toJson(locationAccuracy), + 'locationAltitude': serializer.toJson(locationAltitude), + }; + } + + @override + LocationsCompanion createCompanion(bool nullToAbsent) { + return LocationsCompanion( + id: id == null && nullToAbsent ? const Value.absent() : Value(id), + created: created == null && nullToAbsent + ? const Value.absent() + : Value(created), + locationLat: locationLat == null && nullToAbsent + ? const Value.absent() + : Value(locationLat), + locationLong: locationLong == null && nullToAbsent + ? const Value.absent() + : Value(locationLong), + locationAccuracy: locationAccuracy == null && nullToAbsent + ? const Value.absent() + : Value(locationAccuracy), + locationAltitude: locationAltitude == null && nullToAbsent + ? const Value.absent() + : Value(locationAltitude), + ); + } + + Location copyWith( + {int id, + DateTime created, + double locationLat, + double locationLong, + double locationAccuracy, + double locationAltitude}) => + Location( + id: id ?? this.id, + created: created ?? this.created, + locationLat: locationLat ?? this.locationLat, + locationLong: locationLong ?? this.locationLong, + locationAccuracy: locationAccuracy ?? this.locationAccuracy, + locationAltitude: locationAltitude ?? this.locationAltitude, + ); + @override + String toString() { + return (StringBuffer('Location(') + ..write('id: $id, ') + ..write('created: $created, ') + ..write('locationLat: $locationLat, ') + ..write('locationLong: $locationLong, ') + ..write('locationAccuracy: $locationAccuracy, ') + ..write('locationAltitude: $locationAltitude') + ..write(')')) + .toString(); + } + + @override + int get hashCode => $mrjf($mrjc( + id.hashCode, + $mrjc( + created.hashCode, + $mrjc( + locationLat.hashCode, + $mrjc( + locationLong.hashCode, + $mrjc(locationAccuracy.hashCode, + locationAltitude.hashCode)))))); + @override + bool operator ==(dynamic other) => + identical(this, other) || + (other is Location && + other.id == this.id && + other.created == this.created && + other.locationLat == this.locationLat && + other.locationLong == this.locationLong && + other.locationAccuracy == this.locationAccuracy && + other.locationAltitude == this.locationAltitude); +} + +class LocationsCompanion extends UpdateCompanion { + final Value id; + final Value created; + final Value locationLat; + final Value locationLong; + final Value locationAccuracy; + final Value locationAltitude; + const LocationsCompanion({ + this.id = const Value.absent(), + this.created = const Value.absent(), + this.locationLat = const Value.absent(), + this.locationLong = const Value.absent(), + this.locationAccuracy = const Value.absent(), + this.locationAltitude = const Value.absent(), + }); + LocationsCompanion.insert({ + this.id = const Value.absent(), + this.created = const Value.absent(), + this.locationLat = const Value.absent(), + this.locationLong = const Value.absent(), + this.locationAccuracy = const Value.absent(), + this.locationAltitude = const Value.absent(), + }); + LocationsCompanion copyWith( + {Value id, + Value created, + Value locationLat, + Value locationLong, + Value locationAccuracy, + Value locationAltitude}) { + return LocationsCompanion( + id: id ?? this.id, + created: created ?? this.created, + locationLat: locationLat ?? this.locationLat, + locationLong: locationLong ?? this.locationLong, + locationAccuracy: locationAccuracy ?? this.locationAccuracy, + locationAltitude: locationAltitude ?? this.locationAltitude, + ); + } +} + +class $LocationsTable extends Locations + with TableInfo<$LocationsTable, Location> { + final GeneratedDatabase _db; + final String _alias; + $LocationsTable(this._db, [this._alias]); + final VerificationMeta _idMeta = const VerificationMeta('id'); + GeneratedIntColumn _id; + @override + GeneratedIntColumn get id => _id ??= _constructId(); + GeneratedIntColumn _constructId() { + return GeneratedIntColumn('id', $tableName, false, + hasAutoIncrement: true, declaredAsPrimaryKey: true); + } + + final VerificationMeta _createdMeta = const VerificationMeta('created'); + GeneratedDateTimeColumn _created; + @override + GeneratedDateTimeColumn get created => _created ??= _constructCreated(); + GeneratedDateTimeColumn _constructCreated() { + return GeneratedDateTimeColumn('created', $tableName, false, + defaultValue: currentDateAndTime); + } + final VerificationMeta _locationLatMeta = const VerificationMeta('locationLat'); GeneratedRealColumn _locationLat; @@ -321,44 +581,6 @@ class $CheckupsTable extends Checkups with TableInfo<$CheckupsTable, Checkup> { ); } - final VerificationMeta _subjectiveQuestionsMeta = - const VerificationMeta('subjectiveQuestions'); - GeneratedTextColumn _subjectiveQuestions; - @override - GeneratedTextColumn get subjectiveQuestions => - _subjectiveQuestions ??= _constructSubjectiveQuestions(); - GeneratedTextColumn _constructSubjectiveQuestions() { - return GeneratedTextColumn( - 'subjective_questions', - $tableName, - true, - ); - } - - final VerificationMeta _vitalsMeta = const VerificationMeta('vitals'); - GeneratedTextColumn _vitals; - @override - GeneratedTextColumn get vitals => _vitals ??= _constructVitals(); - GeneratedTextColumn _constructVitals() { - return GeneratedTextColumn( - 'vitals', - $tableName, - true, - ); - } - - final VerificationMeta _assessmentMeta = const VerificationMeta('assessment'); - GeneratedTextColumn _assessment; - @override - GeneratedTextColumn get assessment => _assessment ??= _constructAssessment(); - GeneratedTextColumn _constructAssessment() { - return GeneratedTextColumn( - 'assessment', - $tableName, - true, - ); - } - @override List get $columns => [ id, @@ -366,19 +588,16 @@ class $CheckupsTable extends Checkups with TableInfo<$CheckupsTable, Checkup> { locationLat, locationLong, locationAccuracy, - locationAltitude, - subjectiveQuestions, - vitals, - assessment + locationAltitude ]; @override - $CheckupsTable get asDslTable => this; + $LocationsTable get asDslTable => this; @override - String get $tableName => _alias ?? 'checkups'; + String get $tableName => _alias ?? 'locations'; @override - final String actualTableName = 'checkups'; + final String actualTableName = 'locations'; @override - VerificationContext validateIntegrity(CheckupsCompanion d, + VerificationContext validateIntegrity(LocationsCompanion d, {bool isInserting = false}) { final context = VerificationContext(); if (d.id.present) { @@ -410,26 +629,19 @@ class $CheckupsTable extends Checkups with TableInfo<$CheckupsTable, Checkup> { locationAltitude.isAcceptableValue( d.locationAltitude.value, _locationAltitudeMeta)); } - context.handle( - _subjectiveQuestionsMeta, const VerificationResult.success()); - context.handle(_vitalsMeta, const VerificationResult.success()); - if (d.assessment.present) { - context.handle(_assessmentMeta, - assessment.isAcceptableValue(d.assessment.value, _assessmentMeta)); - } return context; } @override Set get $primaryKey => {id}; @override - Checkup map(Map data, {String tablePrefix}) { + Location map(Map data, {String tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null; - return Checkup.fromData(data, _db, prefix: effectivePrefix); + return Location.fromData(data, _db, prefix: effectivePrefix); } @override - Map entityToSql(CheckupsCompanion d) { + Map entityToSql(LocationsCompanion d) { final map = {}; if (d.id.present) { map['id'] = Variable(d.id.value); @@ -451,38 +663,23 @@ class $CheckupsTable extends Checkups with TableInfo<$CheckupsTable, Checkup> { map['location_altitude'] = Variable(d.locationAltitude.value); } - if (d.subjectiveQuestions.present) { - final converter = $CheckupsTable.$converter0; - map['subjective_questions'] = Variable( - converter.mapToSql(d.subjectiveQuestions.value)); - } - if (d.vitals.present) { - final converter = $CheckupsTable.$converter1; - map['vitals'] = - Variable(converter.mapToSql(d.vitals.value)); - } - if (d.assessment.present) { - map['assessment'] = Variable(d.assessment.value); - } return map; } @override - $CheckupsTable createAlias(String alias) { - return $CheckupsTable(_db, alias); + $LocationsTable createAlias(String alias) { + return $LocationsTable(_db, alias); } - - static TypeConverter $converter0 = - const SubjectiveQuestionsConverter(); - static TypeConverter $converter1 = const VitalsConverter(); } abstract class _$Database extends GeneratedDatabase { _$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e); $CheckupsTable _checkups; $CheckupsTable get checkups => _checkups ??= $CheckupsTable(this); + $LocationsTable _locations; + $LocationsTable get locations => _locations ??= $LocationsTable(this); @override Iterable get allTables => allSchemaEntities.whereType(); @override - List get allSchemaEntities => [checkups]; + List get allSchemaEntities => [checkups, locations]; } diff --git a/lib/src/data/database/tables/checkup.dart b/lib/src/data/database/tables/checkup.dart index cbe25ae..09214c0 100644 --- a/lib/src/data/database/tables/checkup.dart +++ b/lib/src/data/database/tables/checkup.dart @@ -10,10 +10,8 @@ class Checkups extends Table { DateTimeColumn get created => dateTime().withDefault(currentDateAndTime)(); // Location - RealColumn get locationLat => real().nullable()(); - RealColumn get locationLong => real().nullable()(); - RealColumn get locationAccuracy => real().nullable()(); - RealColumn get locationAltitude => real().nullable()(); + IntColumn get location => + integer().nullable().customConstraint('NULL REFERENCES locations(id)')(); // Subjective questions TextColumn get subjectiveQuestions => diff --git a/lib/src/data/database/tables/index.dart b/lib/src/data/database/tables/index.dart index 1e28648..1c7dfa2 100644 --- a/lib/src/data/database/tables/index.dart +++ b/lib/src/data/database/tables/index.dart @@ -1,5 +1,10 @@ import 'checkup.dart'; +import 'location.dart'; export 'checkup.dart'; +export 'location.dart'; -const List tables = [Checkups]; +const List tables = [ + Checkups, + Locations, +]; diff --git a/lib/src/data/database/tables/location.dart b/lib/src/data/database/tables/location.dart new file mode 100644 index 0000000..440d584 --- /dev/null +++ b/lib/src/data/database/tables/location.dart @@ -0,0 +1,12 @@ +import 'package:moor/moor.dart'; + +class Locations extends Table { + IntColumn get id => integer().autoIncrement()(); + DateTimeColumn get created => dateTime().withDefault(currentDateAndTime)(); + + // Location + RealColumn get locationLat => real().nullable()(); + RealColumn get locationLong => real().nullable()(); + RealColumn get locationAccuracy => real().nullable()(); + RealColumn get locationAltitude => real().nullable()(); +}