build(#335): commit the drift generated code so CI can analyze/build

CI failed on every job: offband_database.g.dart (drift's build_runner output)
was gitignored and no workflow runs build_runner, so analyze and all six
platform builds hit "Target of URI hasn't been generated". drift is the first
code in this repo needing codegen, which is why dev's CI never had to.

The workflows are not matrixed - six separate build jobs plus analyze, web
deploy and release-signed, each with its own `flutter pub get`. Adding a
codegen step to all of them is wide and easy to miss one. Instead the generated
file is committed (drift supports this): one file, works across every job and
workflow with no CI edits, and reproducible.

drift_dev is pinned (2.34.0) alongside the already-pinned drift, so a future
regeneration produces the same file rather than drifting from the committed
copy. Regenerated against the pinned versions before committing.

Follow-up worth having: a CI check that regenerates and diffs, so a schema
change without regen fails loudly rather than shipping a stale .g.dart.
integration/290-306-335
Strycher 20 hours ago
parent 3ff272ad8c
commit 53f87f51e3

3
.gitignore vendored

@ -93,3 +93,6 @@ keystore.properties
# Local build secrets (Giphy etc.) — injected via --dart-define-from-file # Local build secrets (Giphy etc.) — injected via --dart-define-from-file
dart_defines.json dart_defines.json
# drift generated code is committed so CI needs no build_runner step (#335)
!/lib/storage/drift/offband_database.g.dart

@ -0,0 +1,445 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'offband_database.dart';
// ignore_for_file: type=lint
class $StoredBlobsTable extends StoredBlobs
with TableInfo<$StoredBlobsTable, StoredBlob> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$StoredBlobsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _keyMeta = const VerificationMeta('key');
@override
late final GeneratedColumn<String> key = GeneratedColumn<String>(
'key',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _valueMeta = const VerificationMeta('value');
@override
late final GeneratedColumn<String> value = GeneratedColumn<String>(
'value',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
'updated_at',
aliasedName,
false,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: currentDateAndTime,
);
@override
List<GeneratedColumn> get $columns => [key, value, updatedAt];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'stored_blobs';
@override
VerificationContext validateIntegrity(
Insertable<StoredBlob> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('key')) {
context.handle(
_keyMeta,
key.isAcceptableOrUnknown(data['key']!, _keyMeta),
);
} else if (isInserting) {
context.missing(_keyMeta);
}
if (data.containsKey('value')) {
context.handle(
_valueMeta,
value.isAcceptableOrUnknown(data['value']!, _valueMeta),
);
} else if (isInserting) {
context.missing(_valueMeta);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {key};
@override
StoredBlob map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return StoredBlob(
key: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}key'],
)!,
value: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}value'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$StoredBlobsTable createAlias(String alias) {
return $StoredBlobsTable(attachedDatabase, alias);
}
}
class StoredBlob extends DataClass implements Insertable<StoredBlob> {
final String key;
final String value;
final DateTime updatedAt;
const StoredBlob({
required this.key,
required this.value,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['key'] = Variable<String>(key);
map['value'] = Variable<String>(value);
map['updated_at'] = Variable<DateTime>(updatedAt);
return map;
}
StoredBlobsCompanion toCompanion(bool nullToAbsent) {
return StoredBlobsCompanion(
key: Value(key),
value: Value(value),
updatedAt: Value(updatedAt),
);
}
factory StoredBlob.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return StoredBlob(
key: serializer.fromJson<String>(json['key']),
value: serializer.fromJson<String>(json['value']),
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'key': serializer.toJson<String>(key),
'value': serializer.toJson<String>(value),
'updatedAt': serializer.toJson<DateTime>(updatedAt),
};
}
StoredBlob copyWith({String? key, String? value, DateTime? updatedAt}) =>
StoredBlob(
key: key ?? this.key,
value: value ?? this.value,
updatedAt: updatedAt ?? this.updatedAt,
);
StoredBlob copyWithCompanion(StoredBlobsCompanion data) {
return StoredBlob(
key: data.key.present ? data.key.value : this.key,
value: data.value.present ? data.value.value : this.value,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('StoredBlob(')
..write('key: $key, ')
..write('value: $value, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(key, value, updatedAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is StoredBlob &&
other.key == this.key &&
other.value == this.value &&
other.updatedAt == this.updatedAt);
}
class StoredBlobsCompanion extends UpdateCompanion<StoredBlob> {
final Value<String> key;
final Value<String> value;
final Value<DateTime> updatedAt;
final Value<int> rowid;
const StoredBlobsCompanion({
this.key = const Value.absent(),
this.value = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
StoredBlobsCompanion.insert({
required String key,
required String value,
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : key = Value(key),
value = Value(value);
static Insertable<StoredBlob> custom({
Expression<String>? key,
Expression<String>? value,
Expression<DateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (key != null) 'key': key,
if (value != null) 'value': value,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
StoredBlobsCompanion copyWith({
Value<String>? key,
Value<String>? value,
Value<DateTime>? updatedAt,
Value<int>? rowid,
}) {
return StoredBlobsCompanion(
key: key ?? this.key,
value: value ?? this.value,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (key.present) {
map['key'] = Variable<String>(key.value);
}
if (value.present) {
map['value'] = Variable<String>(value.value);
}
if (updatedAt.present) {
map['updated_at'] = Variable<DateTime>(updatedAt.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('StoredBlobsCompanion(')
..write('key: $key, ')
..write('value: $value, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
abstract class _$OffbandDatabase extends GeneratedDatabase {
_$OffbandDatabase(QueryExecutor e) : super(e);
$OffbandDatabaseManager get managers => $OffbandDatabaseManager(this);
late final $StoredBlobsTable storedBlobs = $StoredBlobsTable(this);
@override
Iterable<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [storedBlobs];
}
typedef $$StoredBlobsTableCreateCompanionBuilder =
StoredBlobsCompanion Function({
required String key,
required String value,
Value<DateTime> updatedAt,
Value<int> rowid,
});
typedef $$StoredBlobsTableUpdateCompanionBuilder =
StoredBlobsCompanion Function({
Value<String> key,
Value<String> value,
Value<DateTime> updatedAt,
Value<int> rowid,
});
class $$StoredBlobsTableFilterComposer
extends Composer<_$OffbandDatabase, $StoredBlobsTable> {
$$StoredBlobsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get key => $composableBuilder(
column: $table.key,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get value => $composableBuilder(
column: $table.value,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
}
class $$StoredBlobsTableOrderingComposer
extends Composer<_$OffbandDatabase, $StoredBlobsTable> {
$$StoredBlobsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get key => $composableBuilder(
column: $table.key,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get value => $composableBuilder(
column: $table.value,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$StoredBlobsTableAnnotationComposer
extends Composer<_$OffbandDatabase, $StoredBlobsTable> {
$$StoredBlobsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get key =>
$composableBuilder(column: $table.key, builder: (column) => column);
GeneratedColumn<String> get value =>
$composableBuilder(column: $table.value, builder: (column) => column);
GeneratedColumn<DateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
}
class $$StoredBlobsTableTableManager
extends
RootTableManager<
_$OffbandDatabase,
$StoredBlobsTable,
StoredBlob,
$$StoredBlobsTableFilterComposer,
$$StoredBlobsTableOrderingComposer,
$$StoredBlobsTableAnnotationComposer,
$$StoredBlobsTableCreateCompanionBuilder,
$$StoredBlobsTableUpdateCompanionBuilder,
(
StoredBlob,
BaseReferences<_$OffbandDatabase, $StoredBlobsTable, StoredBlob>,
),
StoredBlob,
PrefetchHooks Function()
> {
$$StoredBlobsTableTableManager(_$OffbandDatabase db, $StoredBlobsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$StoredBlobsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$StoredBlobsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$StoredBlobsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> key = const Value.absent(),
Value<String> value = const Value.absent(),
Value<DateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => StoredBlobsCompanion(
key: key,
value: value,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
required String key,
required String value,
Value<DateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => StoredBlobsCompanion.insert(
key: key,
value: value,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$StoredBlobsTableProcessedTableManager =
ProcessedTableManager<
_$OffbandDatabase,
$StoredBlobsTable,
StoredBlob,
$$StoredBlobsTableFilterComposer,
$$StoredBlobsTableOrderingComposer,
$$StoredBlobsTableAnnotationComposer,
$$StoredBlobsTableCreateCompanionBuilder,
$$StoredBlobsTableUpdateCompanionBuilder,
(
StoredBlob,
BaseReferences<_$OffbandDatabase, $StoredBlobsTable, StoredBlob>,
),
StoredBlob,
PrefetchHooks Function()
>;
class $OffbandDatabaseManager {
final _$OffbandDatabase _db;
$OffbandDatabaseManager(this._db);
$$StoredBlobsTableTableManager get storedBlobs =>
$$StoredBlobsTableTableManager(_db, _db.storedBlobs);
}

@ -102,7 +102,7 @@ dev_dependencies:
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^6.0.0 flutter_lints: ^6.0.0
flutter_launcher_icons: ^0.14.4 flutter_launcher_icons: ^0.14.4
drift_dev: ^2.34.0 drift_dev: 2.34.0
build_runner: ^2.15.1 build_runner: ^2.15.1
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the

Loading…
Cancel
Save

Powered by TurnKey Linux.