fix: Drop invalid SetNull and SetDefault test models (#165)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Marcelo Mendonça Soares <marcelomendoncasoares@users.noreply.github.com>
This commit is contained in:
parent
f59a90bc97
commit
e12c9dc9f0
9 changed files with 21344 additions and 4036 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"__className__": "serverpod.DatabaseMigration",
|
||||
"actions": [
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "deleteTable",
|
||||
"deleteTable": "required_set_null_child"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "deleteTable",
|
||||
"deleteTable": "nullable_set_default_child"
|
||||
}
|
||||
],
|
||||
"warnings": [
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationWarning",
|
||||
"type": "tableDropped",
|
||||
"message": "Table \"required_set_null_child\" will be dropped.",
|
||||
"table": "required_set_null_child",
|
||||
"columns": [],
|
||||
"destrucive": true
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationWarning",
|
||||
"type": "tableDropped",
|
||||
"message": "Table \"nullable_set_default_child\" will be dropped.",
|
||||
"table": "nullable_set_default_child",
|
||||
"columns": [],
|
||||
"destrucive": true
|
||||
}
|
||||
],
|
||||
"migrationApiVersion": 1
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ part '20260907170602693/migration.dart';
|
|||
part '20260914144112288/migration.dart';
|
||||
part '20260914165608984/migration.dart';
|
||||
part '20260930185557154/migration.dart';
|
||||
part '20261007215503877/migration.dart';
|
||||
|
||||
/// Migration registry for the client-side database.
|
||||
class MigrationRegistry {
|
||||
|
|
@ -32,6 +33,7 @@ class MigrationRegistry {
|
|||
_Migration20260914144112288(),
|
||||
_Migration20260914165608984(),
|
||||
_Migration20260930185557154(),
|
||||
_Migration20261007215503877(),
|
||||
];
|
||||
|
||||
/// List of all client-side database migration versions.
|
||||
|
|
|
|||
|
|
@ -1,757 +0,0 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
// ignore_for_file: dead_code, unnecessary_null_comparison
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import 'package:serverpod_database/serverpod_database.dart' as _isd;
|
||||
import 'package:serverpod_offline_sync_test_client/src/protocol/protocol.dart'
|
||||
as _imkb9kra;
|
||||
import 'person.dart' as _iensfz4m;
|
||||
|
||||
abstract class NullableSetDefaultChild
|
||||
implements _isd.TableRow<_isc.UuidValue?>, _isc.ProtocolSerialization {
|
||||
NullableSetDefaultChild._({
|
||||
this.id,
|
||||
this.spaceId,
|
||||
required this.name,
|
||||
this.parentId,
|
||||
this.parent,
|
||||
});
|
||||
|
||||
factory NullableSetDefaultChild({
|
||||
_isc.UuidValue? id,
|
||||
int? spaceId,
|
||||
required String name,
|
||||
_isc.UuidValue? parentId,
|
||||
_iensfz4m.Person? parent,
|
||||
}) = _NullableSetDefaultChildImpl;
|
||||
|
||||
factory NullableSetDefaultChild.fromJson(
|
||||
Map<String, dynamic> jsonSerialization,
|
||||
) {
|
||||
return NullableSetDefaultChild(
|
||||
id: jsonSerialization['id'] == null
|
||||
? null
|
||||
: _isc.UuidValueJsonExtension.fromJson(jsonSerialization['id']),
|
||||
spaceId: jsonSerialization['spaceId'] as int?,
|
||||
name: jsonSerialization['name'] as String,
|
||||
parentId: jsonSerialization['parentId'] == null
|
||||
? null
|
||||
: _isc.UuidValueJsonExtension.fromJson(jsonSerialization['parentId']),
|
||||
parent: jsonSerialization['parent'] == null
|
||||
? null
|
||||
: _imkb9kra.Protocol().deserialize<_iensfz4m.Person>(
|
||||
jsonSerialization['parent'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static final t = NullableSetDefaultChildTable();
|
||||
|
||||
static const db = NullableSetDefaultChildRepository._();
|
||||
|
||||
@override
|
||||
_isc.UuidValue? id;
|
||||
|
||||
/// The space owning this row. Maintained by the sync engine.
|
||||
int? spaceId;
|
||||
|
||||
String name;
|
||||
|
||||
_isc.UuidValue? parentId;
|
||||
|
||||
_iensfz4m.Person? parent;
|
||||
|
||||
@override
|
||||
_isd.Table<_isc.UuidValue?> get table => t;
|
||||
|
||||
/// Returns a shallow copy of this [NullableSetDefaultChild]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
NullableSetDefaultChild copyWith({
|
||||
_isc.UuidValue? id,
|
||||
int? spaceId,
|
||||
String? name,
|
||||
_isc.UuidValue? parentId,
|
||||
_iensfz4m.Person? parent,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'NullableSetDefaultChild',
|
||||
if (id != null) 'id': id?.toJson(),
|
||||
if (spaceId != null) 'spaceId': spaceId,
|
||||
'name': name,
|
||||
if (parentId != null) 'parentId': parentId?.toJson(),
|
||||
if (parent != null) 'parent': parent?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'NullableSetDefaultChild',
|
||||
if (id != null) 'id': id?.toJson(),
|
||||
if (spaceId != null) 'spaceId': spaceId,
|
||||
'name': name,
|
||||
if (parentId != null) 'parentId': parentId?.toJson(),
|
||||
if (parent != null) 'parent': parent?.toJsonForProtocol(),
|
||||
};
|
||||
}
|
||||
|
||||
static NullableSetDefaultChildInclude include({
|
||||
_iensfz4m.PersonInclude? parent,
|
||||
}) {
|
||||
return NullableSetDefaultChildInclude._(parent: parent);
|
||||
}
|
||||
|
||||
static NullableSetDefaultChildIncludeList includeList({
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? where,
|
||||
int? limit,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<NullableSetDefaultChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<NullableSetDefaultChildTable>? orderByList,
|
||||
NullableSetDefaultChildInclude? include,
|
||||
}) {
|
||||
return NullableSetDefaultChildIncludeList._(
|
||||
where: where,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
orderBy: orderBy?.call(NullableSetDefaultChild.t),
|
||||
orderByList: orderByList?.call(NullableSetDefaultChild.t),
|
||||
include: include,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _NullableSetDefaultChildImpl extends NullableSetDefaultChild {
|
||||
_NullableSetDefaultChildImpl({
|
||||
_isc.UuidValue? id,
|
||||
int? spaceId,
|
||||
required String name,
|
||||
_isc.UuidValue? parentId,
|
||||
_iensfz4m.Person? parent,
|
||||
}) : super._(
|
||||
id: id,
|
||||
spaceId: spaceId,
|
||||
name: name,
|
||||
parentId: parentId,
|
||||
parent: parent,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [NullableSetDefaultChild]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
NullableSetDefaultChild copyWith({
|
||||
Object? id = _Undefined,
|
||||
Object? spaceId = _Undefined,
|
||||
String? name,
|
||||
Object? parentId = _Undefined,
|
||||
Object? parent = _Undefined,
|
||||
}) {
|
||||
return NullableSetDefaultChild(
|
||||
id: id is _isc.UuidValue? ? id : this.id,
|
||||
spaceId: spaceId is int? ? spaceId : this.spaceId,
|
||||
name: name ?? this.name,
|
||||
parentId: parentId is _isc.UuidValue? ? parentId : this.parentId,
|
||||
parent: parent is _iensfz4m.Person? ? parent : this.parent?.copyWith(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildUpdateTable
|
||||
extends _isd.UpdateTable<NullableSetDefaultChildTable> {
|
||||
NullableSetDefaultChildUpdateTable(super.table);
|
||||
|
||||
_isd.ColumnValue<int, int> spaceId(int? value) => _isd.ColumnValue(
|
||||
table.spaceId,
|
||||
value,
|
||||
);
|
||||
|
||||
_isd.ColumnValue<String, String> name(String value) => _isd.ColumnValue(
|
||||
table.name,
|
||||
value,
|
||||
);
|
||||
|
||||
_isd.ColumnValue<_isc.UuidValue, _isc.UuidValue> parentId(
|
||||
_isc.UuidValue? value,
|
||||
) => _isd.ColumnValue(
|
||||
table.parentId,
|
||||
value,
|
||||
);
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildTable extends _isd.Table<_isc.UuidValue?> {
|
||||
NullableSetDefaultChildTable({super.tableRelation})
|
||||
: super(tableName: 'nullable_set_default_child') {
|
||||
updateTable = NullableSetDefaultChildUpdateTable(this);
|
||||
spaceId = _isd.ColumnInt(
|
||||
'spaceId',
|
||||
this,
|
||||
);
|
||||
name = _isd.ColumnString(
|
||||
'name',
|
||||
this,
|
||||
);
|
||||
parentId = _isd.ColumnUuid(
|
||||
'parentId',
|
||||
this,
|
||||
);
|
||||
}
|
||||
|
||||
late final NullableSetDefaultChildUpdateTable updateTable;
|
||||
|
||||
/// The space owning this row. Maintained by the sync engine.
|
||||
late final _isd.ColumnInt spaceId;
|
||||
|
||||
late final _isd.ColumnString name;
|
||||
|
||||
late final _isd.ColumnUuid parentId;
|
||||
|
||||
_iensfz4m.PersonTable? _parent;
|
||||
|
||||
_iensfz4m.PersonTable get parent {
|
||||
if (_parent != null) return _parent!;
|
||||
_parent = _isd.createRelationTable(
|
||||
relationFieldName: 'parent',
|
||||
field: NullableSetDefaultChild.t.parentId,
|
||||
foreignField: _iensfz4m.Person.t.id,
|
||||
tableRelation: tableRelation,
|
||||
createTable: (foreignTableRelation) =>
|
||||
_iensfz4m.PersonTable(tableRelation: foreignTableRelation),
|
||||
);
|
||||
return _parent!;
|
||||
}
|
||||
|
||||
@override
|
||||
List<_isd.Column> get columns => [
|
||||
id,
|
||||
spaceId,
|
||||
name,
|
||||
parentId,
|
||||
];
|
||||
|
||||
@override
|
||||
_isd.Table? getRelationTable(String relationField) {
|
||||
if (relationField == 'parent') {
|
||||
return parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildInclude extends _isd.IncludeObject {
|
||||
NullableSetDefaultChildInclude._({_iensfz4m.PersonInclude? parent}) {
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
_iensfz4m.PersonInclude? _parent;
|
||||
|
||||
@override
|
||||
Map<String, _isd.Include?> get includes => {'parent': _parent};
|
||||
|
||||
@override
|
||||
_isd.Table<_isc.UuidValue?> get table => NullableSetDefaultChild.t;
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildIncludeList extends _isd.IncludeList {
|
||||
NullableSetDefaultChildIncludeList._({
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? where,
|
||||
super.limit,
|
||||
super.offset,
|
||||
super.orderBy,
|
||||
super.orderByList,
|
||||
super.include,
|
||||
}) {
|
||||
super.where = where?.call(NullableSetDefaultChild.t);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, _isd.Include?> get includes => include?.includes ?? {};
|
||||
|
||||
@override
|
||||
_isd.Table<_isc.UuidValue?> get table => NullableSetDefaultChild.t;
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildRepository {
|
||||
const NullableSetDefaultChildRepository._();
|
||||
|
||||
final attachRow = const NullableSetDefaultChildAttachRowRepository._();
|
||||
|
||||
final detachRow = const NullableSetDefaultChildDetachRowRepository._();
|
||||
|
||||
/// Returns a list of [NullableSetDefaultChild]s matching the given query parameters.
|
||||
///
|
||||
/// Use [where] to specify which items to include in the return value.
|
||||
/// If none is specified, all items will be returned.
|
||||
///
|
||||
/// To specify the order of the items use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// The maximum number of items can be set by [limit]. If no limit is set,
|
||||
/// all items matching the query will be returned.
|
||||
///
|
||||
/// [offset] defines how many items to skip, after which [limit] (or all)
|
||||
/// items are read from the database.
|
||||
///
|
||||
/// ```dart
|
||||
/// var persons = await Persons.db.find(
|
||||
/// session,
|
||||
/// where: (t) => t.lastName.equals('Jones'),
|
||||
/// orderBy: (t) => t.firstName,
|
||||
/// limit: 100,
|
||||
/// );
|
||||
/// ```
|
||||
Future<List<NullableSetDefaultChild>> find(
|
||||
_isd.DatabaseSession session, {
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? where,
|
||||
int? limit,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<NullableSetDefaultChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<NullableSetDefaultChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
NullableSetDefaultChildInclude? include,
|
||||
_isd.LockMode? lockMode,
|
||||
_isd.LockBehavior? lockBehavior,
|
||||
}) async {
|
||||
return session.db.find<NullableSetDefaultChild>(
|
||||
where: where?.call(NullableSetDefaultChild.t),
|
||||
orderBy: orderBy?.call(NullableSetDefaultChild.t),
|
||||
orderByList: orderByList?.call(NullableSetDefaultChild.t),
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
transaction: transaction,
|
||||
include: include,
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns the first matching [NullableSetDefaultChild] matching the given query parameters.
|
||||
///
|
||||
/// Use [where] to specify which items to include in the return value.
|
||||
/// If none is specified, all items will be returned.
|
||||
///
|
||||
/// To specify the order use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// [offset] defines how many items to skip, after which the next one will be picked.
|
||||
///
|
||||
/// ```dart
|
||||
/// var youngestPerson = await Persons.db.findFirstRow(
|
||||
/// session,
|
||||
/// where: (t) => t.lastName.equals('Jones'),
|
||||
/// orderBy: (t) => t.age,
|
||||
/// );
|
||||
/// ```
|
||||
Future<NullableSetDefaultChild?> findFirstRow(
|
||||
_isd.DatabaseSession session, {
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? where,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<NullableSetDefaultChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<NullableSetDefaultChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
NullableSetDefaultChildInclude? include,
|
||||
_isd.LockMode? lockMode,
|
||||
_isd.LockBehavior? lockBehavior,
|
||||
}) async {
|
||||
return session.db.findFirstRow<NullableSetDefaultChild>(
|
||||
where: where?.call(NullableSetDefaultChild.t),
|
||||
orderBy: orderBy?.call(NullableSetDefaultChild.t),
|
||||
orderByList: orderByList?.call(NullableSetDefaultChild.t),
|
||||
offset: offset,
|
||||
transaction: transaction,
|
||||
include: include,
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
);
|
||||
}
|
||||
|
||||
/// Finds a single [NullableSetDefaultChild] by its [id] or null if no such row exists.
|
||||
Future<NullableSetDefaultChild?> findById(
|
||||
_isd.DatabaseSession session,
|
||||
_isc.UuidValue id, {
|
||||
_isd.Transaction? transaction,
|
||||
NullableSetDefaultChildInclude? include,
|
||||
_isd.LockMode? lockMode,
|
||||
_isd.LockBehavior? lockBehavior,
|
||||
}) async {
|
||||
return session.db.findById<NullableSetDefaultChild>(
|
||||
id,
|
||||
transaction: transaction,
|
||||
include: include,
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
);
|
||||
}
|
||||
|
||||
/// Inserts all [NullableSetDefaultChild]s in the list and returns the inserted rows.
|
||||
///
|
||||
/// The returned [NullableSetDefaultChild]s will have their `id` fields set.
|
||||
///
|
||||
/// This is an atomic operation, meaning that if one of the rows fails to
|
||||
/// insert, none of the rows will be inserted.
|
||||
///
|
||||
/// If [ignoreConflicts] is set to `true`, rows that conflict with existing
|
||||
/// rows are silently skipped, and only the successfully inserted rows are
|
||||
/// returned.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the inserted rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<NullableSetDefaultChild>> insert(
|
||||
_isd.DatabaseSession session,
|
||||
List<NullableSetDefaultChild> rows, {
|
||||
_isd.Transaction? transaction,
|
||||
bool ignoreConflicts = false,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.insert<NullableSetDefaultChild>(
|
||||
rows,
|
||||
transaction: transaction,
|
||||
ignoreConflicts: ignoreConflicts,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Inserts a single [NullableSetDefaultChild] and returns the inserted row.
|
||||
///
|
||||
/// The returned [NullableSetDefaultChild] will have its `id` field set.
|
||||
Future<NullableSetDefaultChild> insertRow(
|
||||
_isd.DatabaseSession session,
|
||||
NullableSetDefaultChild row, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.insertRow<NullableSetDefaultChild>(
|
||||
row,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Upserts all [NullableSetDefaultChild]s in the list and returns the resulting rows.
|
||||
///
|
||||
/// If a row conflicts on the given [conflictColumns], the existing row is
|
||||
/// updated with the new values. Otherwise, a new row is inserted.
|
||||
///
|
||||
/// If [updateColumns] is provided, only those columns will be updated on
|
||||
/// conflict. If null, all non-conflict, non-id columns are updated.
|
||||
///
|
||||
/// If [updateWhere] is provided, the update only applies to rows matching the
|
||||
/// given expression. Conflicting rows that don't match are skipped and not
|
||||
/// returned, so the resulting list may be shorter than [rows].
|
||||
///
|
||||
/// The returned [NullableSetDefaultChild]s will have their `id` fields set.
|
||||
///
|
||||
/// This is an atomic operation, meaning that if one of the rows fails,
|
||||
/// none of the rows will be affected.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the resulting rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<NullableSetDefaultChild>> upsert(
|
||||
_isd.DatabaseSession session,
|
||||
List<NullableSetDefaultChild> rows, {
|
||||
required _isd.ColumnSelections<NullableSetDefaultChildTable>
|
||||
conflictColumns,
|
||||
_isd.ColumnSelections<NullableSetDefaultChildTable>? updateColumns,
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? updateWhere,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.upsert<NullableSetDefaultChild>(
|
||||
rows,
|
||||
conflictColumns: conflictColumns(NullableSetDefaultChild.t),
|
||||
updateColumns: updateColumns?.call(NullableSetDefaultChild.t),
|
||||
updateWhere: updateWhere?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Upserts a single [NullableSetDefaultChild] and returns the resulting row.
|
||||
///
|
||||
/// If the row conflicts on the given [conflictColumns], the existing row is
|
||||
/// updated. Otherwise, a new row is inserted.
|
||||
///
|
||||
/// If [updateColumns] is provided, only those columns will be updated on
|
||||
/// conflict. If null, all non-conflict, non-id columns are updated.
|
||||
///
|
||||
/// If [updateWhere] is provided, the update only applies when the existing
|
||||
/// row matches the expression. Returns `null` if no row was affected — for
|
||||
/// example when [updateWhere] does not match the conflicting row.
|
||||
///
|
||||
/// The returned [NullableSetDefaultChild] will have its `id` field set.
|
||||
Future<NullableSetDefaultChild?> upsertRow(
|
||||
_isd.DatabaseSession session,
|
||||
NullableSetDefaultChild row, {
|
||||
required _isd.ColumnSelections<NullableSetDefaultChildTable>
|
||||
conflictColumns,
|
||||
_isd.ColumnSelections<NullableSetDefaultChildTable>? updateColumns,
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? updateWhere,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.upsertRow<NullableSetDefaultChild>(
|
||||
row,
|
||||
conflictColumns: conflictColumns(NullableSetDefaultChild.t),
|
||||
updateColumns: updateColumns?.call(NullableSetDefaultChild.t),
|
||||
updateWhere: updateWhere?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates all [NullableSetDefaultChild]s in the list and returns the updated rows. If
|
||||
/// [columns] is provided, only those columns will be updated. Defaults to
|
||||
/// all columns.
|
||||
/// This is an atomic operation, meaning that if one of the rows fails to
|
||||
/// update, none of the rows will be updated.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the updated rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<NullableSetDefaultChild>> update(
|
||||
_isd.DatabaseSession session,
|
||||
List<NullableSetDefaultChild> rows, {
|
||||
_isd.ColumnSelections<NullableSetDefaultChildTable>? columns,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.update<NullableSetDefaultChild>(
|
||||
rows,
|
||||
columns: columns?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates a single [NullableSetDefaultChild]. The row needs to have its id set.
|
||||
/// Optionally, a list of [columns] can be provided to only update those
|
||||
/// columns. Defaults to all columns.
|
||||
Future<NullableSetDefaultChild> updateRow(
|
||||
_isd.DatabaseSession session,
|
||||
NullableSetDefaultChild row, {
|
||||
_isd.ColumnSelections<NullableSetDefaultChildTable>? columns,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.updateRow<NullableSetDefaultChild>(
|
||||
row,
|
||||
columns: columns?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates a single [NullableSetDefaultChild] by its [id] with the specified [columnValues].
|
||||
/// Returns the updated row or null if no row with the given id exists.
|
||||
Future<NullableSetDefaultChild?> updateById(
|
||||
_isd.DatabaseSession session,
|
||||
_isc.UuidValue id, {
|
||||
required _isd.ColumnValueListBuilder<NullableSetDefaultChildUpdateTable>
|
||||
columnValues,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.updateById<NullableSetDefaultChild>(
|
||||
id,
|
||||
columnValues: columnValues(NullableSetDefaultChild.t.updateTable),
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates all [NullableSetDefaultChild]s matching the [where] expression with the specified [columnValues].
|
||||
/// Returns the list of updated rows.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the updated rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<NullableSetDefaultChild>> updateWhere(
|
||||
_isd.DatabaseSession session, {
|
||||
required _isd.ColumnValueListBuilder<NullableSetDefaultChildUpdateTable>
|
||||
columnValues,
|
||||
required _isd.WhereExpressionBuilder<NullableSetDefaultChildTable> where,
|
||||
int? limit,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<NullableSetDefaultChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<NullableSetDefaultChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.updateWhere<NullableSetDefaultChild>(
|
||||
columnValues: columnValues(NullableSetDefaultChild.t.updateTable),
|
||||
where: where(NullableSetDefaultChild.t),
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
orderBy: orderBy?.call(NullableSetDefaultChild.t),
|
||||
orderByList: orderByList?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes all [NullableSetDefaultChild]s in the list and returns the deleted rows.
|
||||
///
|
||||
/// To specify the order of the returned rows use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// This is an atomic operation, meaning that if one of the rows fail to
|
||||
/// be deleted, none of the rows will be deleted.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the deleted rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<NullableSetDefaultChild>> delete(
|
||||
_isd.DatabaseSession session,
|
||||
List<NullableSetDefaultChild> rows, {
|
||||
_isd.OrderByBuilder<NullableSetDefaultChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<NullableSetDefaultChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.delete<NullableSetDefaultChild>(
|
||||
rows,
|
||||
orderBy: orderBy?.call(NullableSetDefaultChild.t),
|
||||
orderByList: orderByList?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes a single [NullableSetDefaultChild].
|
||||
Future<NullableSetDefaultChild> deleteRow(
|
||||
_isd.DatabaseSession session,
|
||||
NullableSetDefaultChild row, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.deleteRow<NullableSetDefaultChild>(
|
||||
row,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes all rows matching the [where] expression.
|
||||
///
|
||||
/// To specify the order of the returned rows use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the deleted rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<NullableSetDefaultChild>> deleteWhere(
|
||||
_isd.DatabaseSession session, {
|
||||
required _isd.WhereExpressionBuilder<NullableSetDefaultChildTable> where,
|
||||
_isd.OrderByBuilder<NullableSetDefaultChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<NullableSetDefaultChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.deleteWhere<NullableSetDefaultChild>(
|
||||
where: where(NullableSetDefaultChild.t),
|
||||
orderBy: orderBy?.call(NullableSetDefaultChild.t),
|
||||
orderByList: orderByList?.call(NullableSetDefaultChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Counts the number of rows matching the [where] expression. If omitted,
|
||||
/// will return the count of all rows in the table.
|
||||
Future<int> count(
|
||||
_isd.DatabaseSession session, {
|
||||
_isd.WhereExpressionBuilder<NullableSetDefaultChildTable>? where,
|
||||
int? limit,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.count<NullableSetDefaultChild>(
|
||||
where: where?.call(NullableSetDefaultChild.t),
|
||||
limit: limit,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Acquires row-level locks on [NullableSetDefaultChild] rows matching the [where] expression.
|
||||
Future<void> lockRows(
|
||||
_isd.DatabaseSession session, {
|
||||
required _isd.WhereExpressionBuilder<NullableSetDefaultChildTable> where,
|
||||
required _isd.LockMode lockMode,
|
||||
required _isd.Transaction transaction,
|
||||
_isd.LockBehavior lockBehavior = _isd.LockBehavior.wait,
|
||||
}) async {
|
||||
return session.db.lockRows<NullableSetDefaultChild>(
|
||||
where: where(NullableSetDefaultChild.t),
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildAttachRowRepository {
|
||||
const NullableSetDefaultChildAttachRowRepository._();
|
||||
|
||||
/// Creates a relation between the given [NullableSetDefaultChild] and [Person]
|
||||
/// by setting the [NullableSetDefaultChild]'s foreign key `parentId` to refer to the [Person].
|
||||
Future<void> parent(
|
||||
_isd.DatabaseSession session,
|
||||
NullableSetDefaultChild nullableSetDefaultChild,
|
||||
_iensfz4m.Person parent, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
if (nullableSetDefaultChild.id == null) {
|
||||
throw ArgumentError.notNull('nullableSetDefaultChild.id');
|
||||
}
|
||||
if (parent.id == null) {
|
||||
throw ArgumentError.notNull('parent.id');
|
||||
}
|
||||
|
||||
var $nullableSetDefaultChild = nullableSetDefaultChild.copyWith(
|
||||
parentId: parent.id,
|
||||
);
|
||||
await session.db.updateRow<NullableSetDefaultChild>(
|
||||
$nullableSetDefaultChild,
|
||||
columns: [NullableSetDefaultChild.t.parentId],
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NullableSetDefaultChildDetachRowRepository {
|
||||
const NullableSetDefaultChildDetachRowRepository._();
|
||||
|
||||
/// Detaches the relation between this [NullableSetDefaultChild] and the [Person] set in `parent`
|
||||
/// by setting the [NullableSetDefaultChild]'s foreign key `parentId` to `null`.
|
||||
///
|
||||
/// This removes the association between the two models without deleting
|
||||
/// the related record.
|
||||
Future<void> parent(
|
||||
_isd.DatabaseSession session,
|
||||
NullableSetDefaultChild nullableSetDefaultChild, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
if (nullableSetDefaultChild.id == null) {
|
||||
throw ArgumentError.notNull('nullableSetDefaultChild.id');
|
||||
}
|
||||
|
||||
var $nullableSetDefaultChild = nullableSetDefaultChild.copyWith(
|
||||
parentId: null,
|
||||
);
|
||||
await session.db.updateRow<NullableSetDefaultChild>(
|
||||
$nullableSetDefaultChild,
|
||||
columns: [NullableSetDefaultChild.t.parentId],
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,12 +31,10 @@ import 'fk_chain/set_null_cascade_child.dart' as _ideurard;
|
|||
import 'fk_chain/set_null_middle.dart' as _icv70ksq;
|
||||
import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0;
|
||||
import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw;
|
||||
import 'nullable_set_default_child.dart' as _i6rvg9xd;
|
||||
import 'organization.dart' as _irjtvpke;
|
||||
import 'person.dart' as _iensfz4m;
|
||||
import 'required_cascade_child.dart' as _ivx9jyda;
|
||||
import 'required_no_action_child.dart' as _itlfbi2f;
|
||||
import 'required_set_null_child.dart' as _i1huw131;
|
||||
import 'restrict_child.dart' as _isrf0aof;
|
||||
import 'sync_document.dart' as _ix6xayzv;
|
||||
import 'town.dart' as _iytblq2r;
|
||||
|
|
@ -67,12 +65,10 @@ export 'fk_chain/set_null_cascade_child.dart';
|
|||
export 'fk_chain/set_null_middle.dart';
|
||||
export 'fk_chain/set_null_restrict_child.dart';
|
||||
export 'fk_chain/set_null_set_null_child.dart';
|
||||
export 'nullable_set_default_child.dart';
|
||||
export 'organization.dart';
|
||||
export 'person.dart';
|
||||
export 'required_cascade_child.dart';
|
||||
export 'required_no_action_child.dart';
|
||||
export 'required_set_null_child.dart';
|
||||
export 'restrict_child.dart';
|
||||
export 'sync_document.dart';
|
||||
export 'town.dart';
|
||||
|
|
@ -778,64 +774,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
indexes: [],
|
||||
managed: true,
|
||||
),
|
||||
_isd.TableDefinition(
|
||||
name: 'nullable_set_default_child',
|
||||
dartName: 'NullableSetDefaultChild',
|
||||
schema: 'public',
|
||||
module: 'serverpod_offline_sync_test',
|
||||
columns: [
|
||||
_isd.ColumnDefinition(
|
||||
name: 'id',
|
||||
columnType: _isd.ColumnType.uuid,
|
||||
isNullable: false,
|
||||
dartType: 'UuidValue?',
|
||||
columnDefault: 'random_v7',
|
||||
),
|
||||
_isd.ColumnDefinition(
|
||||
name: 'spaceId',
|
||||
columnType: _isd.ColumnType.bigint,
|
||||
isNullable: true,
|
||||
dartType: 'int?',
|
||||
),
|
||||
_isd.ColumnDefinition(
|
||||
name: 'name',
|
||||
columnType: _isd.ColumnType.text,
|
||||
isNullable: false,
|
||||
dartType: 'String',
|
||||
),
|
||||
_isd.ColumnDefinition(
|
||||
name: 'parentId',
|
||||
columnType: _isd.ColumnType.uuid,
|
||||
isNullable: true,
|
||||
dartType: 'UuidValue?',
|
||||
),
|
||||
],
|
||||
foreignKeys: [
|
||||
_isd.ForeignKeyDefinition(
|
||||
constraintName: 'nullable_set_default_child_fk_0',
|
||||
columns: ['spaceId'],
|
||||
referenceTable: 'offline_sync_spaces',
|
||||
referenceTableSchema: 'public',
|
||||
referenceColumns: ['id'],
|
||||
onUpdate: _isd.ForeignKeyAction.noAction,
|
||||
onDelete: _isd.ForeignKeyAction.cascade,
|
||||
matchType: null,
|
||||
),
|
||||
_isd.ForeignKeyDefinition(
|
||||
constraintName: 'nullable_set_default_child_fk_1',
|
||||
columns: ['parentId'],
|
||||
referenceTable: 'person',
|
||||
referenceTableSchema: 'public',
|
||||
referenceColumns: ['id'],
|
||||
onUpdate: _isd.ForeignKeyAction.noAction,
|
||||
onDelete: _isd.ForeignKeyAction.setDefault,
|
||||
matchType: null,
|
||||
deferrable: _isd.DeferrableConstraint.initiallyDeferred,
|
||||
),
|
||||
],
|
||||
indexes: [],
|
||||
managed: true,
|
||||
),
|
||||
_isd.TableDefinition(
|
||||
name: 'organization',
|
||||
dartName: 'Organization',
|
||||
|
|
@ -1107,64 +1045,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
indexes: [],
|
||||
managed: true,
|
||||
),
|
||||
_isd.TableDefinition(
|
||||
name: 'required_set_null_child',
|
||||
dartName: 'RequiredSetNullChild',
|
||||
schema: 'public',
|
||||
module: 'serverpod_offline_sync_test',
|
||||
columns: [
|
||||
_isd.ColumnDefinition(
|
||||
name: 'id',
|
||||
columnType: _isd.ColumnType.uuid,
|
||||
isNullable: false,
|
||||
dartType: 'UuidValue?',
|
||||
columnDefault: 'random_v7',
|
||||
),
|
||||
_isd.ColumnDefinition(
|
||||
name: 'spaceId',
|
||||
columnType: _isd.ColumnType.bigint,
|
||||
isNullable: true,
|
||||
dartType: 'int?',
|
||||
),
|
||||
_isd.ColumnDefinition(
|
||||
name: 'name',
|
||||
columnType: _isd.ColumnType.text,
|
||||
isNullable: false,
|
||||
dartType: 'String',
|
||||
),
|
||||
_isd.ColumnDefinition(
|
||||
name: 'parentId',
|
||||
columnType: _isd.ColumnType.uuid,
|
||||
isNullable: false,
|
||||
dartType: 'UuidValue',
|
||||
),
|
||||
],
|
||||
foreignKeys: [
|
||||
_isd.ForeignKeyDefinition(
|
||||
constraintName: 'required_set_null_child_fk_0',
|
||||
columns: ['spaceId'],
|
||||
referenceTable: 'offline_sync_spaces',
|
||||
referenceTableSchema: 'public',
|
||||
referenceColumns: ['id'],
|
||||
onUpdate: _isd.ForeignKeyAction.noAction,
|
||||
onDelete: _isd.ForeignKeyAction.cascade,
|
||||
matchType: null,
|
||||
),
|
||||
_isd.ForeignKeyDefinition(
|
||||
constraintName: 'required_set_null_child_fk_1',
|
||||
columns: ['parentId'],
|
||||
referenceTable: 'person',
|
||||
referenceTableSchema: 'public',
|
||||
referenceColumns: ['id'],
|
||||
onUpdate: _isd.ForeignKeyAction.noAction,
|
||||
onDelete: _isd.ForeignKeyAction.setNull,
|
||||
matchType: null,
|
||||
deferrable: _isd.DeferrableConstraint.initiallyDeferred,
|
||||
),
|
||||
],
|
||||
indexes: [],
|
||||
managed: true,
|
||||
),
|
||||
_isd.TableDefinition(
|
||||
name: 'restrict_child',
|
||||
dartName: 'RestrictChild',
|
||||
|
|
@ -2455,9 +2335,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _ihkyqxiw.FkChainSetNullSetNullChild) {
|
||||
return _ihkyqxiw.FkChainSetNullSetNullChild.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i6rvg9xd.NullableSetDefaultChild) {
|
||||
return _i6rvg9xd.NullableSetDefaultChild.fromJson(data) as T;
|
||||
}
|
||||
if (t == _irjtvpke.Organization) {
|
||||
return _irjtvpke.Organization.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -2470,9 +2347,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _itlfbi2f.RequiredNoActionChild) {
|
||||
return _itlfbi2f.RequiredNoActionChild.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i1huw131.RequiredSetNullChild) {
|
||||
return _i1huw131.RequiredSetNullChild.fromJson(data) as T;
|
||||
}
|
||||
if (t == _isrf0aof.RestrictChild) {
|
||||
return _isrf0aof.RestrictChild.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -2587,12 +2461,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i6rvg9xd.NullableSetDefaultChild?>()) {
|
||||
return (data != null
|
||||
? _i6rvg9xd.NullableSetDefaultChild.fromJson(data)
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_irjtvpke.Organization?>()) {
|
||||
return (data != null ? _irjtvpke.Organization.fromJson(data) : null) as T;
|
||||
}
|
||||
|
|
@ -2611,12 +2479,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i1huw131.RequiredSetNullChild?>()) {
|
||||
return (data != null
|
||||
? _i1huw131.RequiredSetNullChild.fromJson(data)
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_isrf0aof.RestrictChild?>()) {
|
||||
return (data != null ? _isrf0aof.RestrictChild.fromJson(data) : null)
|
||||
as T;
|
||||
|
|
@ -2757,12 +2619,10 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
_icv70ksq.FkChainSetNullMiddle => 'FkChainSetNullMiddle',
|
||||
_ix62gjf0.FkChainSetNullRestrictChild => 'FkChainSetNullRestrictChild',
|
||||
_ihkyqxiw.FkChainSetNullSetNullChild => 'FkChainSetNullSetNullChild',
|
||||
_i6rvg9xd.NullableSetDefaultChild => 'NullableSetDefaultChild',
|
||||
_irjtvpke.Organization => 'Organization',
|
||||
_iensfz4m.Person => 'Person',
|
||||
_ivx9jyda.RequiredCascadeChild => 'RequiredCascadeChild',
|
||||
_itlfbi2f.RequiredNoActionChild => 'RequiredNoActionChild',
|
||||
_i1huw131.RequiredSetNullChild => 'RequiredSetNullChild',
|
||||
_isrf0aof.RestrictChild => 'RestrictChild',
|
||||
_ix6xayzv.SyncDocument => 'SyncDocument',
|
||||
_iytblq2r.Town => 'Town',
|
||||
|
|
@ -2822,8 +2682,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
return 'FkChainSetNullRestrictChild';
|
||||
case _ihkyqxiw.FkChainSetNullSetNullChild():
|
||||
return 'FkChainSetNullSetNullChild';
|
||||
case _i6rvg9xd.NullableSetDefaultChild():
|
||||
return 'NullableSetDefaultChild';
|
||||
case _irjtvpke.Organization():
|
||||
return 'Organization';
|
||||
case _iensfz4m.Person():
|
||||
|
|
@ -2832,8 +2690,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
return 'RequiredCascadeChild';
|
||||
case _itlfbi2f.RequiredNoActionChild():
|
||||
return 'RequiredNoActionChild';
|
||||
case _i1huw131.RequiredSetNullChild():
|
||||
return 'RequiredSetNullChild';
|
||||
case _isrf0aof.RestrictChild():
|
||||
return 'RestrictChild';
|
||||
case _ix6xayzv.SyncDocument():
|
||||
|
|
@ -2934,9 +2790,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (dataClassName == 'FkChainSetNullSetNullChild') {
|
||||
return deserialize<_ihkyqxiw.FkChainSetNullSetNullChild>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'NullableSetDefaultChild') {
|
||||
return deserialize<_i6rvg9xd.NullableSetDefaultChild>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Organization') {
|
||||
return deserialize<_irjtvpke.Organization>(data['data']);
|
||||
}
|
||||
|
|
@ -2949,9 +2802,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (dataClassName == 'RequiredNoActionChild') {
|
||||
return deserialize<_itlfbi2f.RequiredNoActionChild>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'RequiredSetNullChild') {
|
||||
return deserialize<_i1huw131.RequiredSetNullChild>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'RestrictChild') {
|
||||
return deserialize<_isrf0aof.RestrictChild>(data['data']);
|
||||
}
|
||||
|
|
@ -3087,8 +2937,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
return _ix62gjf0.FkChainSetNullRestrictChild.t;
|
||||
case _ihkyqxiw.FkChainSetNullSetNullChild:
|
||||
return _ihkyqxiw.FkChainSetNullSetNullChild.t;
|
||||
case _i6rvg9xd.NullableSetDefaultChild:
|
||||
return _i6rvg9xd.NullableSetDefaultChild.t;
|
||||
case _irjtvpke.Organization:
|
||||
return _irjtvpke.Organization.t;
|
||||
case _iensfz4m.Person:
|
||||
|
|
@ -3097,8 +2945,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
return _ivx9jyda.RequiredCascadeChild.t;
|
||||
case _itlfbi2f.RequiredNoActionChild:
|
||||
return _itlfbi2f.RequiredNoActionChild.t;
|
||||
case _i1huw131.RequiredSetNullChild:
|
||||
return _i1huw131.RequiredSetNullChild.t;
|
||||
case _isrf0aof.RestrictChild:
|
||||
return _isrf0aof.RestrictChild.t;
|
||||
case _iytblq2r.Town:
|
||||
|
|
|
|||
|
|
@ -1,725 +0,0 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
// ignore_for_file: dead_code, unnecessary_null_comparison
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import 'package:serverpod_database/serverpod_database.dart' as _isd;
|
||||
import 'package:serverpod_offline_sync_test_client/src/protocol/protocol.dart'
|
||||
as _imkb9kra;
|
||||
import 'person.dart' as _iensfz4m;
|
||||
|
||||
abstract class RequiredSetNullChild
|
||||
implements _isd.TableRow<_isc.UuidValue?>, _isc.ProtocolSerialization {
|
||||
RequiredSetNullChild._({
|
||||
this.id,
|
||||
this.spaceId,
|
||||
required this.name,
|
||||
required this.parentId,
|
||||
this.parent,
|
||||
});
|
||||
|
||||
factory RequiredSetNullChild({
|
||||
_isc.UuidValue? id,
|
||||
int? spaceId,
|
||||
required String name,
|
||||
required _isc.UuidValue parentId,
|
||||
_iensfz4m.Person? parent,
|
||||
}) = _RequiredSetNullChildImpl;
|
||||
|
||||
factory RequiredSetNullChild.fromJson(
|
||||
Map<String, dynamic> jsonSerialization,
|
||||
) {
|
||||
return RequiredSetNullChild(
|
||||
id: jsonSerialization['id'] == null
|
||||
? null
|
||||
: _isc.UuidValueJsonExtension.fromJson(jsonSerialization['id']),
|
||||
spaceId: jsonSerialization['spaceId'] as int?,
|
||||
name: jsonSerialization['name'] as String,
|
||||
parentId: _isc.UuidValueJsonExtension.fromJson(
|
||||
jsonSerialization['parentId'],
|
||||
),
|
||||
parent: jsonSerialization['parent'] == null
|
||||
? null
|
||||
: _imkb9kra.Protocol().deserialize<_iensfz4m.Person>(
|
||||
jsonSerialization['parent'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static final t = RequiredSetNullChildTable();
|
||||
|
||||
static const db = RequiredSetNullChildRepository._();
|
||||
|
||||
@override
|
||||
_isc.UuidValue? id;
|
||||
|
||||
/// The space owning this row. Maintained by the sync engine.
|
||||
int? spaceId;
|
||||
|
||||
String name;
|
||||
|
||||
_isc.UuidValue parentId;
|
||||
|
||||
_iensfz4m.Person? parent;
|
||||
|
||||
@override
|
||||
_isd.Table<_isc.UuidValue?> get table => t;
|
||||
|
||||
/// Returns a shallow copy of this [RequiredSetNullChild]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
RequiredSetNullChild copyWith({
|
||||
_isc.UuidValue? id,
|
||||
int? spaceId,
|
||||
String? name,
|
||||
_isc.UuidValue? parentId,
|
||||
_iensfz4m.Person? parent,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'RequiredSetNullChild',
|
||||
if (id != null) 'id': id?.toJson(),
|
||||
if (spaceId != null) 'spaceId': spaceId,
|
||||
'name': name,
|
||||
'parentId': parentId.toJson(),
|
||||
if (parent != null) 'parent': parent?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'RequiredSetNullChild',
|
||||
if (id != null) 'id': id?.toJson(),
|
||||
if (spaceId != null) 'spaceId': spaceId,
|
||||
'name': name,
|
||||
'parentId': parentId.toJson(),
|
||||
if (parent != null) 'parent': parent?.toJsonForProtocol(),
|
||||
};
|
||||
}
|
||||
|
||||
static RequiredSetNullChildInclude include({
|
||||
_iensfz4m.PersonInclude? parent,
|
||||
}) {
|
||||
return RequiredSetNullChildInclude._(parent: parent);
|
||||
}
|
||||
|
||||
static RequiredSetNullChildIncludeList includeList({
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? where,
|
||||
int? limit,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<RequiredSetNullChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<RequiredSetNullChildTable>? orderByList,
|
||||
RequiredSetNullChildInclude? include,
|
||||
}) {
|
||||
return RequiredSetNullChildIncludeList._(
|
||||
where: where,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
orderBy: orderBy?.call(RequiredSetNullChild.t),
|
||||
orderByList: orderByList?.call(RequiredSetNullChild.t),
|
||||
include: include,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _RequiredSetNullChildImpl extends RequiredSetNullChild {
|
||||
_RequiredSetNullChildImpl({
|
||||
_isc.UuidValue? id,
|
||||
int? spaceId,
|
||||
required String name,
|
||||
required _isc.UuidValue parentId,
|
||||
_iensfz4m.Person? parent,
|
||||
}) : super._(
|
||||
id: id,
|
||||
spaceId: spaceId,
|
||||
name: name,
|
||||
parentId: parentId,
|
||||
parent: parent,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [RequiredSetNullChild]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
RequiredSetNullChild copyWith({
|
||||
Object? id = _Undefined,
|
||||
Object? spaceId = _Undefined,
|
||||
String? name,
|
||||
_isc.UuidValue? parentId,
|
||||
Object? parent = _Undefined,
|
||||
}) {
|
||||
return RequiredSetNullChild(
|
||||
id: id is _isc.UuidValue? ? id : this.id,
|
||||
spaceId: spaceId is int? ? spaceId : this.spaceId,
|
||||
name: name ?? this.name,
|
||||
parentId: parentId ?? this.parentId,
|
||||
parent: parent is _iensfz4m.Person? ? parent : this.parent?.copyWith(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RequiredSetNullChildUpdateTable
|
||||
extends _isd.UpdateTable<RequiredSetNullChildTable> {
|
||||
RequiredSetNullChildUpdateTable(super.table);
|
||||
|
||||
_isd.ColumnValue<int, int> spaceId(int? value) => _isd.ColumnValue(
|
||||
table.spaceId,
|
||||
value,
|
||||
);
|
||||
|
||||
_isd.ColumnValue<String, String> name(String value) => _isd.ColumnValue(
|
||||
table.name,
|
||||
value,
|
||||
);
|
||||
|
||||
_isd.ColumnValue<_isc.UuidValue, _isc.UuidValue> parentId(
|
||||
_isc.UuidValue value,
|
||||
) => _isd.ColumnValue(
|
||||
table.parentId,
|
||||
value,
|
||||
);
|
||||
}
|
||||
|
||||
class RequiredSetNullChildTable extends _isd.Table<_isc.UuidValue?> {
|
||||
RequiredSetNullChildTable({super.tableRelation})
|
||||
: super(tableName: 'required_set_null_child') {
|
||||
updateTable = RequiredSetNullChildUpdateTable(this);
|
||||
spaceId = _isd.ColumnInt(
|
||||
'spaceId',
|
||||
this,
|
||||
);
|
||||
name = _isd.ColumnString(
|
||||
'name',
|
||||
this,
|
||||
);
|
||||
parentId = _isd.ColumnUuid(
|
||||
'parentId',
|
||||
this,
|
||||
);
|
||||
}
|
||||
|
||||
late final RequiredSetNullChildUpdateTable updateTable;
|
||||
|
||||
/// The space owning this row. Maintained by the sync engine.
|
||||
late final _isd.ColumnInt spaceId;
|
||||
|
||||
late final _isd.ColumnString name;
|
||||
|
||||
late final _isd.ColumnUuid parentId;
|
||||
|
||||
_iensfz4m.PersonTable? _parent;
|
||||
|
||||
_iensfz4m.PersonTable get parent {
|
||||
if (_parent != null) return _parent!;
|
||||
_parent = _isd.createRelationTable(
|
||||
relationFieldName: 'parent',
|
||||
field: RequiredSetNullChild.t.parentId,
|
||||
foreignField: _iensfz4m.Person.t.id,
|
||||
tableRelation: tableRelation,
|
||||
createTable: (foreignTableRelation) =>
|
||||
_iensfz4m.PersonTable(tableRelation: foreignTableRelation),
|
||||
);
|
||||
return _parent!;
|
||||
}
|
||||
|
||||
@override
|
||||
List<_isd.Column> get columns => [
|
||||
id,
|
||||
spaceId,
|
||||
name,
|
||||
parentId,
|
||||
];
|
||||
|
||||
@override
|
||||
_isd.Table? getRelationTable(String relationField) {
|
||||
if (relationField == 'parent') {
|
||||
return parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class RequiredSetNullChildInclude extends _isd.IncludeObject {
|
||||
RequiredSetNullChildInclude._({_iensfz4m.PersonInclude? parent}) {
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
_iensfz4m.PersonInclude? _parent;
|
||||
|
||||
@override
|
||||
Map<String, _isd.Include?> get includes => {'parent': _parent};
|
||||
|
||||
@override
|
||||
_isd.Table<_isc.UuidValue?> get table => RequiredSetNullChild.t;
|
||||
}
|
||||
|
||||
class RequiredSetNullChildIncludeList extends _isd.IncludeList {
|
||||
RequiredSetNullChildIncludeList._({
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? where,
|
||||
super.limit,
|
||||
super.offset,
|
||||
super.orderBy,
|
||||
super.orderByList,
|
||||
super.include,
|
||||
}) {
|
||||
super.where = where?.call(RequiredSetNullChild.t);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, _isd.Include?> get includes => include?.includes ?? {};
|
||||
|
||||
@override
|
||||
_isd.Table<_isc.UuidValue?> get table => RequiredSetNullChild.t;
|
||||
}
|
||||
|
||||
class RequiredSetNullChildRepository {
|
||||
const RequiredSetNullChildRepository._();
|
||||
|
||||
final attachRow = const RequiredSetNullChildAttachRowRepository._();
|
||||
|
||||
/// Returns a list of [RequiredSetNullChild]s matching the given query parameters.
|
||||
///
|
||||
/// Use [where] to specify which items to include in the return value.
|
||||
/// If none is specified, all items will be returned.
|
||||
///
|
||||
/// To specify the order of the items use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// The maximum number of items can be set by [limit]. If no limit is set,
|
||||
/// all items matching the query will be returned.
|
||||
///
|
||||
/// [offset] defines how many items to skip, after which [limit] (or all)
|
||||
/// items are read from the database.
|
||||
///
|
||||
/// ```dart
|
||||
/// var persons = await Persons.db.find(
|
||||
/// session,
|
||||
/// where: (t) => t.lastName.equals('Jones'),
|
||||
/// orderBy: (t) => t.firstName,
|
||||
/// limit: 100,
|
||||
/// );
|
||||
/// ```
|
||||
Future<List<RequiredSetNullChild>> find(
|
||||
_isd.DatabaseSession session, {
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? where,
|
||||
int? limit,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<RequiredSetNullChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<RequiredSetNullChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
RequiredSetNullChildInclude? include,
|
||||
_isd.LockMode? lockMode,
|
||||
_isd.LockBehavior? lockBehavior,
|
||||
}) async {
|
||||
return session.db.find<RequiredSetNullChild>(
|
||||
where: where?.call(RequiredSetNullChild.t),
|
||||
orderBy: orderBy?.call(RequiredSetNullChild.t),
|
||||
orderByList: orderByList?.call(RequiredSetNullChild.t),
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
transaction: transaction,
|
||||
include: include,
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns the first matching [RequiredSetNullChild] matching the given query parameters.
|
||||
///
|
||||
/// Use [where] to specify which items to include in the return value.
|
||||
/// If none is specified, all items will be returned.
|
||||
///
|
||||
/// To specify the order use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// [offset] defines how many items to skip, after which the next one will be picked.
|
||||
///
|
||||
/// ```dart
|
||||
/// var youngestPerson = await Persons.db.findFirstRow(
|
||||
/// session,
|
||||
/// where: (t) => t.lastName.equals('Jones'),
|
||||
/// orderBy: (t) => t.age,
|
||||
/// );
|
||||
/// ```
|
||||
Future<RequiredSetNullChild?> findFirstRow(
|
||||
_isd.DatabaseSession session, {
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? where,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<RequiredSetNullChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<RequiredSetNullChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
RequiredSetNullChildInclude? include,
|
||||
_isd.LockMode? lockMode,
|
||||
_isd.LockBehavior? lockBehavior,
|
||||
}) async {
|
||||
return session.db.findFirstRow<RequiredSetNullChild>(
|
||||
where: where?.call(RequiredSetNullChild.t),
|
||||
orderBy: orderBy?.call(RequiredSetNullChild.t),
|
||||
orderByList: orderByList?.call(RequiredSetNullChild.t),
|
||||
offset: offset,
|
||||
transaction: transaction,
|
||||
include: include,
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
);
|
||||
}
|
||||
|
||||
/// Finds a single [RequiredSetNullChild] by its [id] or null if no such row exists.
|
||||
Future<RequiredSetNullChild?> findById(
|
||||
_isd.DatabaseSession session,
|
||||
_isc.UuidValue id, {
|
||||
_isd.Transaction? transaction,
|
||||
RequiredSetNullChildInclude? include,
|
||||
_isd.LockMode? lockMode,
|
||||
_isd.LockBehavior? lockBehavior,
|
||||
}) async {
|
||||
return session.db.findById<RequiredSetNullChild>(
|
||||
id,
|
||||
transaction: transaction,
|
||||
include: include,
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
);
|
||||
}
|
||||
|
||||
/// Inserts all [RequiredSetNullChild]s in the list and returns the inserted rows.
|
||||
///
|
||||
/// The returned [RequiredSetNullChild]s will have their `id` fields set.
|
||||
///
|
||||
/// This is an atomic operation, meaning that if one of the rows fails to
|
||||
/// insert, none of the rows will be inserted.
|
||||
///
|
||||
/// If [ignoreConflicts] is set to `true`, rows that conflict with existing
|
||||
/// rows are silently skipped, and only the successfully inserted rows are
|
||||
/// returned.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the inserted rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<RequiredSetNullChild>> insert(
|
||||
_isd.DatabaseSession session,
|
||||
List<RequiredSetNullChild> rows, {
|
||||
_isd.Transaction? transaction,
|
||||
bool ignoreConflicts = false,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.insert<RequiredSetNullChild>(
|
||||
rows,
|
||||
transaction: transaction,
|
||||
ignoreConflicts: ignoreConflicts,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Inserts a single [RequiredSetNullChild] and returns the inserted row.
|
||||
///
|
||||
/// The returned [RequiredSetNullChild] will have its `id` field set.
|
||||
Future<RequiredSetNullChild> insertRow(
|
||||
_isd.DatabaseSession session,
|
||||
RequiredSetNullChild row, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.insertRow<RequiredSetNullChild>(
|
||||
row,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Upserts all [RequiredSetNullChild]s in the list and returns the resulting rows.
|
||||
///
|
||||
/// If a row conflicts on the given [conflictColumns], the existing row is
|
||||
/// updated with the new values. Otherwise, a new row is inserted.
|
||||
///
|
||||
/// If [updateColumns] is provided, only those columns will be updated on
|
||||
/// conflict. If null, all non-conflict, non-id columns are updated.
|
||||
///
|
||||
/// If [updateWhere] is provided, the update only applies to rows matching the
|
||||
/// given expression. Conflicting rows that don't match are skipped and not
|
||||
/// returned, so the resulting list may be shorter than [rows].
|
||||
///
|
||||
/// The returned [RequiredSetNullChild]s will have their `id` fields set.
|
||||
///
|
||||
/// This is an atomic operation, meaning that if one of the rows fails,
|
||||
/// none of the rows will be affected.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the resulting rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<RequiredSetNullChild>> upsert(
|
||||
_isd.DatabaseSession session,
|
||||
List<RequiredSetNullChild> rows, {
|
||||
required _isd.ColumnSelections<RequiredSetNullChildTable> conflictColumns,
|
||||
_isd.ColumnSelections<RequiredSetNullChildTable>? updateColumns,
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? updateWhere,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.upsert<RequiredSetNullChild>(
|
||||
rows,
|
||||
conflictColumns: conflictColumns(RequiredSetNullChild.t),
|
||||
updateColumns: updateColumns?.call(RequiredSetNullChild.t),
|
||||
updateWhere: updateWhere?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Upserts a single [RequiredSetNullChild] and returns the resulting row.
|
||||
///
|
||||
/// If the row conflicts on the given [conflictColumns], the existing row is
|
||||
/// updated. Otherwise, a new row is inserted.
|
||||
///
|
||||
/// If [updateColumns] is provided, only those columns will be updated on
|
||||
/// conflict. If null, all non-conflict, non-id columns are updated.
|
||||
///
|
||||
/// If [updateWhere] is provided, the update only applies when the existing
|
||||
/// row matches the expression. Returns `null` if no row was affected — for
|
||||
/// example when [updateWhere] does not match the conflicting row.
|
||||
///
|
||||
/// The returned [RequiredSetNullChild] will have its `id` field set.
|
||||
Future<RequiredSetNullChild?> upsertRow(
|
||||
_isd.DatabaseSession session,
|
||||
RequiredSetNullChild row, {
|
||||
required _isd.ColumnSelections<RequiredSetNullChildTable> conflictColumns,
|
||||
_isd.ColumnSelections<RequiredSetNullChildTable>? updateColumns,
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? updateWhere,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.upsertRow<RequiredSetNullChild>(
|
||||
row,
|
||||
conflictColumns: conflictColumns(RequiredSetNullChild.t),
|
||||
updateColumns: updateColumns?.call(RequiredSetNullChild.t),
|
||||
updateWhere: updateWhere?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates all [RequiredSetNullChild]s in the list and returns the updated rows. If
|
||||
/// [columns] is provided, only those columns will be updated. Defaults to
|
||||
/// all columns.
|
||||
/// This is an atomic operation, meaning that if one of the rows fails to
|
||||
/// update, none of the rows will be updated.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the updated rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<RequiredSetNullChild>> update(
|
||||
_isd.DatabaseSession session,
|
||||
List<RequiredSetNullChild> rows, {
|
||||
_isd.ColumnSelections<RequiredSetNullChildTable>? columns,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.update<RequiredSetNullChild>(
|
||||
rows,
|
||||
columns: columns?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates a single [RequiredSetNullChild]. The row needs to have its id set.
|
||||
/// Optionally, a list of [columns] can be provided to only update those
|
||||
/// columns. Defaults to all columns.
|
||||
Future<RequiredSetNullChild> updateRow(
|
||||
_isd.DatabaseSession session,
|
||||
RequiredSetNullChild row, {
|
||||
_isd.ColumnSelections<RequiredSetNullChildTable>? columns,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.updateRow<RequiredSetNullChild>(
|
||||
row,
|
||||
columns: columns?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates a single [RequiredSetNullChild] by its [id] with the specified [columnValues].
|
||||
/// Returns the updated row or null if no row with the given id exists.
|
||||
Future<RequiredSetNullChild?> updateById(
|
||||
_isd.DatabaseSession session,
|
||||
_isc.UuidValue id, {
|
||||
required _isd.ColumnValueListBuilder<RequiredSetNullChildUpdateTable>
|
||||
columnValues,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.updateById<RequiredSetNullChild>(
|
||||
id,
|
||||
columnValues: columnValues(RequiredSetNullChild.t.updateTable),
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates all [RequiredSetNullChild]s matching the [where] expression with the specified [columnValues].
|
||||
/// Returns the list of updated rows.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the updated rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<RequiredSetNullChild>> updateWhere(
|
||||
_isd.DatabaseSession session, {
|
||||
required _isd.ColumnValueListBuilder<RequiredSetNullChildUpdateTable>
|
||||
columnValues,
|
||||
required _isd.WhereExpressionBuilder<RequiredSetNullChildTable> where,
|
||||
int? limit,
|
||||
int? offset,
|
||||
_isd.OrderByBuilder<RequiredSetNullChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<RequiredSetNullChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.updateWhere<RequiredSetNullChild>(
|
||||
columnValues: columnValues(RequiredSetNullChild.t.updateTable),
|
||||
where: where(RequiredSetNullChild.t),
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
orderBy: orderBy?.call(RequiredSetNullChild.t),
|
||||
orderByList: orderByList?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes all [RequiredSetNullChild]s in the list and returns the deleted rows.
|
||||
///
|
||||
/// To specify the order of the returned rows use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// This is an atomic operation, meaning that if one of the rows fail to
|
||||
/// be deleted, none of the rows will be deleted.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the deleted rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<RequiredSetNullChild>> delete(
|
||||
_isd.DatabaseSession session,
|
||||
List<RequiredSetNullChild> rows, {
|
||||
_isd.OrderByBuilder<RequiredSetNullChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<RequiredSetNullChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.delete<RequiredSetNullChild>(
|
||||
rows,
|
||||
orderBy: orderBy?.call(RequiredSetNullChild.t),
|
||||
orderByList: orderByList?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes a single [RequiredSetNullChild].
|
||||
Future<RequiredSetNullChild> deleteRow(
|
||||
_isd.DatabaseSession session,
|
||||
RequiredSetNullChild row, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.deleteRow<RequiredSetNullChild>(
|
||||
row,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes all rows matching the [where] expression.
|
||||
///
|
||||
/// To specify the order of the returned rows use [orderBy] or [orderByList]
|
||||
/// when sorting by multiple columns.
|
||||
///
|
||||
/// If [noReturn] is set to `true`, the deleted rows are not read back from
|
||||
/// the database and an empty list is returned. This avoids the overhead of
|
||||
/// transferring and deserializing the rows when the result is not needed.
|
||||
Future<List<RequiredSetNullChild>> deleteWhere(
|
||||
_isd.DatabaseSession session, {
|
||||
required _isd.WhereExpressionBuilder<RequiredSetNullChildTable> where,
|
||||
_isd.OrderByBuilder<RequiredSetNullChildTable>? orderBy,
|
||||
_isd.OrderByListBuilder<RequiredSetNullChildTable>? orderByList,
|
||||
_isd.Transaction? transaction,
|
||||
bool noReturn = false,
|
||||
}) async {
|
||||
return session.db.deleteWhere<RequiredSetNullChild>(
|
||||
where: where(RequiredSetNullChild.t),
|
||||
orderBy: orderBy?.call(RequiredSetNullChild.t),
|
||||
orderByList: orderByList?.call(RequiredSetNullChild.t),
|
||||
transaction: transaction,
|
||||
noReturn: noReturn,
|
||||
);
|
||||
}
|
||||
|
||||
/// Counts the number of rows matching the [where] expression. If omitted,
|
||||
/// will return the count of all rows in the table.
|
||||
Future<int> count(
|
||||
_isd.DatabaseSession session, {
|
||||
_isd.WhereExpressionBuilder<RequiredSetNullChildTable>? where,
|
||||
int? limit,
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
return session.db.count<RequiredSetNullChild>(
|
||||
where: where?.call(RequiredSetNullChild.t),
|
||||
limit: limit,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
|
||||
/// Acquires row-level locks on [RequiredSetNullChild] rows matching the [where] expression.
|
||||
Future<void> lockRows(
|
||||
_isd.DatabaseSession session, {
|
||||
required _isd.WhereExpressionBuilder<RequiredSetNullChildTable> where,
|
||||
required _isd.LockMode lockMode,
|
||||
required _isd.Transaction transaction,
|
||||
_isd.LockBehavior lockBehavior = _isd.LockBehavior.wait,
|
||||
}) async {
|
||||
return session.db.lockRows<RequiredSetNullChild>(
|
||||
where: where(RequiredSetNullChild.t),
|
||||
lockMode: lockMode,
|
||||
lockBehavior: lockBehavior,
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RequiredSetNullChildAttachRowRepository {
|
||||
const RequiredSetNullChildAttachRowRepository._();
|
||||
|
||||
/// Creates a relation between the given [RequiredSetNullChild] and [Person]
|
||||
/// by setting the [RequiredSetNullChild]'s foreign key `parentId` to refer to the [Person].
|
||||
Future<void> parent(
|
||||
_isd.DatabaseSession session,
|
||||
RequiredSetNullChild requiredSetNullChild,
|
||||
_iensfz4m.Person parent, {
|
||||
_isd.Transaction? transaction,
|
||||
}) async {
|
||||
if (requiredSetNullChild.id == null) {
|
||||
throw ArgumentError.notNull('requiredSetNullChild.id');
|
||||
}
|
||||
if (parent.id == null) {
|
||||
throw ArgumentError.notNull('parent.id');
|
||||
}
|
||||
|
||||
var $requiredSetNullChild = requiredSetNullChild.copyWith(
|
||||
parentId: parent.id,
|
||||
);
|
||||
await session.db.updateRow<RequiredSetNullChild>(
|
||||
$requiredSetNullChild,
|
||||
columns: [RequiredSetNullChild.t.parentId],
|
||||
transaction: transaction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,12 +25,10 @@ import 'fk_chain/set_null_cascade_child.dart' as _ideurard;
|
|||
import 'fk_chain/set_null_middle.dart' as _icv70ksq;
|
||||
import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0;
|
||||
import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw;
|
||||
import 'nullable_set_default_child.dart' as _i6rvg9xd;
|
||||
import 'organization.dart' as _irjtvpke;
|
||||
import 'person.dart' as _iensfz4m;
|
||||
import 'required_cascade_child.dart' as _ivx9jyda;
|
||||
import 'required_no_action_child.dart' as _itlfbi2f;
|
||||
import 'required_set_null_child.dart' as _i1huw131;
|
||||
import 'restrict_child.dart' as _isrf0aof;
|
||||
import 'town.dart' as _iytblq2r;
|
||||
import 'types.dart' as _iwxwszsz;
|
||||
|
|
@ -63,12 +61,10 @@ final List<_isd.Table> syncTables = [
|
|||
_icv70ksq.FkChainSetNullMiddle.t,
|
||||
_ix62gjf0.FkChainSetNullRestrictChild.t,
|
||||
_ihkyqxiw.FkChainSetNullSetNullChild.t,
|
||||
_i6rvg9xd.NullableSetDefaultChild.t,
|
||||
_irjtvpke.Organization.t,
|
||||
_iensfz4m.Person.t,
|
||||
_ivx9jyda.RequiredCascadeChild.t,
|
||||
_itlfbi2f.RequiredNoActionChild.t,
|
||||
_i1huw131.RequiredSetNullChild.t,
|
||||
_isrf0aof.RestrictChild.t,
|
||||
_i2ap9bqs.SharedChild.t,
|
||||
_i2ap9bqs.SharedParent.t,
|
||||
|
|
|
|||
Loading…
Reference in a new issue