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
45 changed files with 21344 additions and 4036 deletions
|
|
@ -111,7 +111,7 @@ dependencies:
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Version `0.0.9` requires Serverpod `^4.0.0`.
|
> The current development version requires Serverpod `>=4.0.4 <4.1.0`.
|
||||||
|
|
||||||
After adding the dependencies, list the `serverpod_offline_sync` module on the
|
After adding the dependencies, list the `serverpod_offline_sync` module on the
|
||||||
`generator.yaml` file and enable the experimental `database: sync` option:
|
`generator.yaml` file and enable the experimental `database: sync` option:
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ dependencies:
|
||||||
benchmark_harness: ^2.4.0
|
benchmark_harness: ^2.4.0
|
||||||
intl: ^0.20.2
|
intl: ^0.20.2
|
||||||
path: ^1.9.1
|
path: ^1.9.1
|
||||||
serverpod_database: ^4.0.0
|
serverpod_database: '>=4.0.4 <4.1.0'
|
||||||
serverpod_offline_sync:
|
serverpod_offline_sync:
|
||||||
path: ../packages/serverpod_offline_sync
|
path: ../packages/serverpod_offline_sync
|
||||||
serverpod_offline_sync_server:
|
serverpod_offline_sync_server:
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ List<Table> get benchmarkSyncTables => [
|
||||||
FkChainSetNullSetNullChild.t,
|
FkChainSetNullSetNullChild.t,
|
||||||
Organization.t,
|
Organization.t,
|
||||||
Person.t,
|
Person.t,
|
||||||
RequiredSetNullChild.t,
|
|
||||||
RestrictChild.t,
|
RestrictChild.t,
|
||||||
Town.t,
|
Town.t,
|
||||||
Types.t,
|
Types.t,
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ not new user field updates emitted opportunistically during merge.
|
||||||
- Supported foreign keys are single-column child references to single-column
|
- Supported foreign keys are single-column child references to single-column
|
||||||
parent references. Schemas with composite foreign keys must fail recorder
|
parent references. Schemas with composite foreign keys must fail recorder
|
||||||
initialization instead of silently bypassing projection.
|
initialization instead of silently bypassing projection.
|
||||||
|
- Serverpod-generated schemas guarantee that `SET NULL` uses nullable columns
|
||||||
|
and `SET DEFAULT` uses columns with declared database defaults.
|
||||||
- Merge input is causally complete relative to the receiver: every merged FK
|
- Merge input is causally complete relative to the receiver: every merged FK
|
||||||
attempt's parent facts must already be committed at the receiver or accompany
|
attempt's parent facts must already be committed at the receiver or accompany
|
||||||
the child fact in the same complete batch. A checkpoint-filtered delta can
|
the child fact in the same complete batch. A checkpoint-filtered delta can
|
||||||
|
|
@ -51,15 +53,15 @@ soft-deleted instead of removed:
|
||||||
- `ON DELETE RESTRICT` and `NO ACTION`: the delete fails if any visible child
|
- `ON DELETE RESTRICT` and `NO ACTION`: the delete fails if any visible child
|
||||||
still references the parent. No parent tombstone is recorded for the failed
|
still references the parent. No parent tombstone is recorded for the failed
|
||||||
operation.
|
operation.
|
||||||
- `ON DELETE SET NULL`: visible child FK columns are updated to `null` when the
|
- `ON DELETE SET NULL`: visible child FK columns are updated to `null`, and
|
||||||
FK is nullable, and those child FK fields receive ordinary CRDT field updates.
|
those child FK fields receive ordinary CRDT field updates.
|
||||||
- `ON DELETE SET DEFAULT`: visible child FK columns are updated to the column
|
- `ON DELETE SET DEFAULT`: visible child FK columns are updated to the column
|
||||||
default when the default is legal, and those child FK fields receive ordinary
|
default when the default is legal, and those child FK fields receive ordinary
|
||||||
CRDT field updates. A nullable null default is legal; a non-null default must
|
CRDT field updates. A concrete UUID default must remain visible in the same
|
||||||
remain visible in the same space after the delete. A default in the same
|
space after the delete. A default in the same delete batch is unavailable.
|
||||||
delete batch is unavailable. If a visible child needs this repair, an invalid
|
If a visible child needs this repair, an invalid default rejects the
|
||||||
default rejects the transaction, including any earlier repairs or tombstones
|
transaction, including any earlier repairs or tombstones in that transaction.
|
||||||
in that transaction. An unused invalid default does not itself block a delete.
|
An unused invalid default does not itself block a delete.
|
||||||
- `ON DELETE CASCADE`: visible cascade descendants receive synced
|
- `ON DELETE CASCADE`: visible cascade descendants receive synced
|
||||||
user-delete tombstones. Local cascade descendants are not hidden only as
|
user-delete tombstones. Local cascade descendants are not hidden only as
|
||||||
`foreignKeyCascade` projection rows.
|
`foreignKeyCascade` projection rows.
|
||||||
|
|
@ -80,9 +82,8 @@ a column.
|
||||||
|
|
||||||
For each child FK whose attempted value points to a hidden or missing parent:
|
For each child FK whose attempted value points to a hidden or missing parent:
|
||||||
|
|
||||||
- `ON DELETE SET NULL`: the visible FK value is `null` when the FK is nullable.
|
- `ON DELETE SET NULL`: the visible FK value is `null`. The schema guarantees
|
||||||
If the FK is non-nullable, this action cannot repair the row and must fall
|
that the FK is nullable.
|
||||||
through to the deterministic blocking policy.
|
|
||||||
- `ON DELETE SET DEFAULT`: the visible FK value is the column default only if
|
- `ON DELETE SET DEFAULT`: the visible FK value is the column default only if
|
||||||
that default points to a visible parent or is a legal nullable default. If the
|
that default points to a visible parent or is a legal nullable default. If the
|
||||||
default target is hidden or missing, this action cannot repair the row and
|
default target is hidden or missing, this action cannot repair the row and
|
||||||
|
|
@ -92,7 +93,7 @@ For each child FK whose attempted value points to a hidden or missing parent:
|
||||||
projection.
|
projection.
|
||||||
- `ON DELETE CASCADE`: the child can be hidden only if the whole cascade closure
|
- `ON DELETE CASCADE`: the child can be hidden only if the whole cascade closure
|
||||||
is valid. If any descendant blocks the cascade through `RESTRICT`, `NO ACTION`,
|
is valid. If any descendant blocks the cascade through `RESTRICT`, `NO ACTION`,
|
||||||
invalid `SET NULL`, or invalid `SET DEFAULT`, the ancestor delete loses and
|
or an unavailable `SET DEFAULT` target, the ancestor delete loses and
|
||||||
the cascade is not partially applied.
|
the cascade is not partially applied.
|
||||||
|
|
||||||
This makes mixed chains atomic for visibility. For example, if deleting `A`
|
This makes mixed chains atomic for visibility. For example, if deleting `A`
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ IconData iconForTable(String table, {required bool hidden}) {
|
||||||
'town' => Icons.map,
|
'town' => Icons.map,
|
||||||
'organization' => Icons.apartment,
|
'organization' => Icons.apartment,
|
||||||
'company' => Icons.business,
|
'company' => Icons.business,
|
||||||
'restrict_child' || 'required_set_null_child' => Icons.link,
|
'restrict_child' => Icons.link,
|
||||||
'unique' || 'unique_uuid' || 'unique_composite' => Icons.key,
|
'unique' || 'unique_uuid' || 'unique_composite' => Icons.key,
|
||||||
'types' => Icons.data_object,
|
'types' => Icons.data_object,
|
||||||
_ when table.startsWith('fk_chain') => Icons.account_tree,
|
_ when table.startsWith('fk_chain') => Icons.account_tree,
|
||||||
|
|
|
||||||
|
|
@ -160,14 +160,6 @@ final Map<String, TableOps> demoTableOps = {
|
||||||
create: (id, label, foreignKeys) =>
|
create: (id, label, foreignKeys) =>
|
||||||
RestrictChild(id: id, name: label, parentId: foreignKeys['parentId']),
|
RestrictChild(id: id, name: label, parentId: foreignKeys['parentId']),
|
||||||
),
|
),
|
||||||
_ops<RequiredSetNullChild>(
|
|
||||||
canCreateRoot: false,
|
|
||||||
create: (id, label, foreignKeys) {
|
|
||||||
final parentId = foreignKeys['parentId'];
|
|
||||||
if (parentId == null) return null;
|
|
||||||
return RequiredSetNullChild(id: id, name: label, parentId: parentId);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
_ops<Unique>(
|
_ops<Unique>(
|
||||||
create: (id, label, foreignKeys) => Unique(id: id, name: label),
|
create: (id, label, foreignKeys) => Unique(id: id, name: label),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ dependencies:
|
||||||
http: ^1.5.0
|
http: ^1.5.0
|
||||||
path: ^1.9.1
|
path: ^1.9.1
|
||||||
path_provider: ^2.1.5
|
path_provider: ^2.1.5
|
||||||
serverpod_database: ^4.0.0
|
serverpod_database: '>=4.0.4 <4.1.0'
|
||||||
serverpod_offline_sync_client:
|
serverpod_offline_sync_client:
|
||||||
path: ../../packages/serverpod_offline_sync_client
|
path: ../../packages/serverpod_offline_sync_client
|
||||||
serverpod_offline_sync_test_client:
|
serverpod_offline_sync_test_client:
|
||||||
|
|
|
||||||
|
|
@ -540,13 +540,11 @@ class CrdtForeignKeyProjector {
|
||||||
|
|
||||||
switch (edge.action) {
|
switch (edge.action) {
|
||||||
case ForeignKeyAction.setNull:
|
case ForeignKeyAction.setNull:
|
||||||
if (edge.childNullable) {
|
|
||||||
safeData[edge.childColumn] = null;
|
safeData[edge.childColumn] = null;
|
||||||
attempts[fieldKey] = (
|
attempts[fieldKey] = (
|
||||||
value: attemptedValue,
|
value: attemptedValue,
|
||||||
reason: CrdtProjectionReason.foreignKeySetNull,
|
reason: CrdtProjectionReason.foreignKeySetNull,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
case ForeignKeyAction.setDefault:
|
case ForeignKeyAction.setDefault:
|
||||||
final defaultProjection = await _defaultProjectionValueFromDatabase(
|
final defaultProjection = await _defaultProjectionValueFromDatabase(
|
||||||
edge,
|
edge,
|
||||||
|
|
@ -1808,7 +1806,7 @@ class CrdtForeignKeyProjector {
|
||||||
) {
|
) {
|
||||||
switch (edge.action) {
|
switch (edge.action) {
|
||||||
case ForeignKeyAction.setNull:
|
case ForeignKeyAction.setNull:
|
||||||
return edge.childNullable;
|
return true;
|
||||||
case ForeignKeyAction.setDefault:
|
case ForeignKeyAction.setDefault:
|
||||||
final defaultValue = edge.defaultValue.toUuidValue();
|
final defaultValue = edge.defaultValue.toUuidValue();
|
||||||
if (defaultValue == null) return edge.childNullable;
|
if (defaultValue == null) return edge.childNullable;
|
||||||
|
|
@ -1893,7 +1891,7 @@ class CrdtForeignKeyProjector {
|
||||||
case ForeignKeyAction.noAction:
|
case ForeignKeyAction.noAction:
|
||||||
return true;
|
return true;
|
||||||
case ForeignKeyAction.setNull:
|
case ForeignKeyAction.setNull:
|
||||||
if (!edge.childNullable) return true;
|
break;
|
||||||
case ForeignKeyAction.setDefault:
|
case ForeignKeyAction.setDefault:
|
||||||
if (!_defaultProjectionValue(edge, state, finalHidden).valid) {
|
if (!_defaultProjectionValue(edge, state, finalHidden).valid) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2124,10 +2122,8 @@ class CrdtForeignKeyProjector {
|
||||||
_targetHiddenOrMissing(edge, attemptedValue, state, finalHidden)) {
|
_targetHiddenOrMissing(edge, attemptedValue, state, finalHidden)) {
|
||||||
switch (edge.action) {
|
switch (edge.action) {
|
||||||
case ForeignKeyAction.setNull:
|
case ForeignKeyAction.setNull:
|
||||||
if (edge.childNullable) {
|
|
||||||
desiredVisibleValue = null;
|
desiredVisibleValue = null;
|
||||||
overrideReason = CrdtProjectionReason.foreignKeySetNull;
|
overrideReason = CrdtProjectionReason.foreignKeySetNull;
|
||||||
}
|
|
||||||
case ForeignKeyAction.setDefault:
|
case ForeignKeyAction.setDefault:
|
||||||
final defaultProjection = _defaultProjectionValue(
|
final defaultProjection = _defaultProjectionValue(
|
||||||
edge,
|
edge,
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ resolution: workspace
|
||||||
dependencies:
|
dependencies:
|
||||||
clock: ^1.1.2
|
clock: ^1.1.2
|
||||||
meta: ^1.18.0
|
meta: ^1.18.0
|
||||||
serverpod_database: ^4.0.0
|
serverpod_database: '>=4.0.4 <4.1.0'
|
||||||
serverpod_serialization: ^4.0.0
|
serverpod_serialization: '>=4.0.4 <4.1.0'
|
||||||
uuid: ^4.5.3
|
uuid: ^4.5.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ environment:
|
||||||
resolution: workspace
|
resolution: workspace
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
serverpod_client: ^4.0.0
|
serverpod_client: '>=4.0.4 <4.1.0'
|
||||||
serverpod_database: ^4.0.0
|
serverpod_database: '>=4.0.4 <4.1.0'
|
||||||
serverpod_offline_sync: 0.0.9
|
serverpod_offline_sync: 0.0.9
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ resolution: workspace
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
meta: ^1.16.0
|
meta: ^1.16.0
|
||||||
serverpod: ^4.0.0
|
serverpod: '>=4.0.4 <4.1.0'
|
||||||
serverpod_database: ^4.0.0
|
serverpod_database: '>=4.0.4 <4.1.0'
|
||||||
serverpod_offline_sync: 0.0.9
|
serverpod_offline_sync: 0.0.9
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: '>=3.0.0 <7.0.0'
|
lints: '>=3.0.0 <7.0.0'
|
||||||
serverpod_cli: ^4.0.0
|
serverpod_cli: '>=4.0.4 <4.1.0'
|
||||||
serverpod_test: ^4.0.0
|
serverpod_test: '>=4.0.4 <4.1.0'
|
||||||
test: ^1.25.5
|
test: ^1.25.5
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ workspace:
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
melos: ^7.5.1
|
melos: ^7.5.1
|
||||||
serverpod_cli: ^4.0.0
|
serverpod_cli: '>=4.0.4 <4.1.0'
|
||||||
|
|
||||||
# dependency_overrides:
|
# dependency_overrides:
|
||||||
# serverpod:
|
# serverpod:
|
||||||
|
|
|
||||||
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 '20260914144112288/migration.dart';
|
||||||
part '20260914165608984/migration.dart';
|
part '20260914165608984/migration.dart';
|
||||||
part '20260930185557154/migration.dart';
|
part '20260930185557154/migration.dart';
|
||||||
|
part '20261007215503877/migration.dart';
|
||||||
|
|
||||||
/// Migration registry for the client-side database.
|
/// Migration registry for the client-side database.
|
||||||
class MigrationRegistry {
|
class MigrationRegistry {
|
||||||
|
|
@ -32,6 +33,7 @@ class MigrationRegistry {
|
||||||
_Migration20260914144112288(),
|
_Migration20260914144112288(),
|
||||||
_Migration20260914165608984(),
|
_Migration20260914165608984(),
|
||||||
_Migration20260930185557154(),
|
_Migration20260930185557154(),
|
||||||
|
_Migration20261007215503877(),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// List of all client-side database migration versions.
|
/// 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_middle.dart' as _icv70ksq;
|
||||||
import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0;
|
import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0;
|
||||||
import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw;
|
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 'organization.dart' as _irjtvpke;
|
||||||
import 'person.dart' as _iensfz4m;
|
import 'person.dart' as _iensfz4m;
|
||||||
import 'required_cascade_child.dart' as _ivx9jyda;
|
import 'required_cascade_child.dart' as _ivx9jyda;
|
||||||
import 'required_no_action_child.dart' as _itlfbi2f;
|
import 'required_no_action_child.dart' as _itlfbi2f;
|
||||||
import 'required_set_null_child.dart' as _i1huw131;
|
|
||||||
import 'restrict_child.dart' as _isrf0aof;
|
import 'restrict_child.dart' as _isrf0aof;
|
||||||
import 'sync_document.dart' as _ix6xayzv;
|
import 'sync_document.dart' as _ix6xayzv;
|
||||||
import 'town.dart' as _iytblq2r;
|
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_middle.dart';
|
||||||
export 'fk_chain/set_null_restrict_child.dart';
|
export 'fk_chain/set_null_restrict_child.dart';
|
||||||
export 'fk_chain/set_null_set_null_child.dart';
|
export 'fk_chain/set_null_set_null_child.dart';
|
||||||
export 'nullable_set_default_child.dart';
|
|
||||||
export 'organization.dart';
|
export 'organization.dart';
|
||||||
export 'person.dart';
|
export 'person.dart';
|
||||||
export 'required_cascade_child.dart';
|
export 'required_cascade_child.dart';
|
||||||
export 'required_no_action_child.dart';
|
export 'required_no_action_child.dart';
|
||||||
export 'required_set_null_child.dart';
|
|
||||||
export 'restrict_child.dart';
|
export 'restrict_child.dart';
|
||||||
export 'sync_document.dart';
|
export 'sync_document.dart';
|
||||||
export 'town.dart';
|
export 'town.dart';
|
||||||
|
|
@ -778,64 +774,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
indexes: [],
|
indexes: [],
|
||||||
managed: true,
|
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(
|
_isd.TableDefinition(
|
||||||
name: 'organization',
|
name: 'organization',
|
||||||
dartName: 'Organization',
|
dartName: 'Organization',
|
||||||
|
|
@ -1107,64 +1045,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
indexes: [],
|
indexes: [],
|
||||||
managed: true,
|
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(
|
_isd.TableDefinition(
|
||||||
name: 'restrict_child',
|
name: 'restrict_child',
|
||||||
dartName: 'RestrictChild',
|
dartName: 'RestrictChild',
|
||||||
|
|
@ -2455,9 +2335,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
if (t == _ihkyqxiw.FkChainSetNullSetNullChild) {
|
if (t == _ihkyqxiw.FkChainSetNullSetNullChild) {
|
||||||
return _ihkyqxiw.FkChainSetNullSetNullChild.fromJson(data) as T;
|
return _ihkyqxiw.FkChainSetNullSetNullChild.fromJson(data) as T;
|
||||||
}
|
}
|
||||||
if (t == _i6rvg9xd.NullableSetDefaultChild) {
|
|
||||||
return _i6rvg9xd.NullableSetDefaultChild.fromJson(data) as T;
|
|
||||||
}
|
|
||||||
if (t == _irjtvpke.Organization) {
|
if (t == _irjtvpke.Organization) {
|
||||||
return _irjtvpke.Organization.fromJson(data) as T;
|
return _irjtvpke.Organization.fromJson(data) as T;
|
||||||
}
|
}
|
||||||
|
|
@ -2470,9 +2347,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
if (t == _itlfbi2f.RequiredNoActionChild) {
|
if (t == _itlfbi2f.RequiredNoActionChild) {
|
||||||
return _itlfbi2f.RequiredNoActionChild.fromJson(data) as T;
|
return _itlfbi2f.RequiredNoActionChild.fromJson(data) as T;
|
||||||
}
|
}
|
||||||
if (t == _i1huw131.RequiredSetNullChild) {
|
|
||||||
return _i1huw131.RequiredSetNullChild.fromJson(data) as T;
|
|
||||||
}
|
|
||||||
if (t == _isrf0aof.RestrictChild) {
|
if (t == _isrf0aof.RestrictChild) {
|
||||||
return _isrf0aof.RestrictChild.fromJson(data) as T;
|
return _isrf0aof.RestrictChild.fromJson(data) as T;
|
||||||
}
|
}
|
||||||
|
|
@ -2587,12 +2461,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
: null)
|
: null)
|
||||||
as T;
|
as T;
|
||||||
}
|
}
|
||||||
if (t == _isc.getType<_i6rvg9xd.NullableSetDefaultChild?>()) {
|
|
||||||
return (data != null
|
|
||||||
? _i6rvg9xd.NullableSetDefaultChild.fromJson(data)
|
|
||||||
: null)
|
|
||||||
as T;
|
|
||||||
}
|
|
||||||
if (t == _isc.getType<_irjtvpke.Organization?>()) {
|
if (t == _isc.getType<_irjtvpke.Organization?>()) {
|
||||||
return (data != null ? _irjtvpke.Organization.fromJson(data) : null) as T;
|
return (data != null ? _irjtvpke.Organization.fromJson(data) : null) as T;
|
||||||
}
|
}
|
||||||
|
|
@ -2611,12 +2479,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
: null)
|
: null)
|
||||||
as T;
|
as T;
|
||||||
}
|
}
|
||||||
if (t == _isc.getType<_i1huw131.RequiredSetNullChild?>()) {
|
|
||||||
return (data != null
|
|
||||||
? _i1huw131.RequiredSetNullChild.fromJson(data)
|
|
||||||
: null)
|
|
||||||
as T;
|
|
||||||
}
|
|
||||||
if (t == _isc.getType<_isrf0aof.RestrictChild?>()) {
|
if (t == _isc.getType<_isrf0aof.RestrictChild?>()) {
|
||||||
return (data != null ? _isrf0aof.RestrictChild.fromJson(data) : null)
|
return (data != null ? _isrf0aof.RestrictChild.fromJson(data) : null)
|
||||||
as T;
|
as T;
|
||||||
|
|
@ -2757,12 +2619,10 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
_icv70ksq.FkChainSetNullMiddle => 'FkChainSetNullMiddle',
|
_icv70ksq.FkChainSetNullMiddle => 'FkChainSetNullMiddle',
|
||||||
_ix62gjf0.FkChainSetNullRestrictChild => 'FkChainSetNullRestrictChild',
|
_ix62gjf0.FkChainSetNullRestrictChild => 'FkChainSetNullRestrictChild',
|
||||||
_ihkyqxiw.FkChainSetNullSetNullChild => 'FkChainSetNullSetNullChild',
|
_ihkyqxiw.FkChainSetNullSetNullChild => 'FkChainSetNullSetNullChild',
|
||||||
_i6rvg9xd.NullableSetDefaultChild => 'NullableSetDefaultChild',
|
|
||||||
_irjtvpke.Organization => 'Organization',
|
_irjtvpke.Organization => 'Organization',
|
||||||
_iensfz4m.Person => 'Person',
|
_iensfz4m.Person => 'Person',
|
||||||
_ivx9jyda.RequiredCascadeChild => 'RequiredCascadeChild',
|
_ivx9jyda.RequiredCascadeChild => 'RequiredCascadeChild',
|
||||||
_itlfbi2f.RequiredNoActionChild => 'RequiredNoActionChild',
|
_itlfbi2f.RequiredNoActionChild => 'RequiredNoActionChild',
|
||||||
_i1huw131.RequiredSetNullChild => 'RequiredSetNullChild',
|
|
||||||
_isrf0aof.RestrictChild => 'RestrictChild',
|
_isrf0aof.RestrictChild => 'RestrictChild',
|
||||||
_ix6xayzv.SyncDocument => 'SyncDocument',
|
_ix6xayzv.SyncDocument => 'SyncDocument',
|
||||||
_iytblq2r.Town => 'Town',
|
_iytblq2r.Town => 'Town',
|
||||||
|
|
@ -2822,8 +2682,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
return 'FkChainSetNullRestrictChild';
|
return 'FkChainSetNullRestrictChild';
|
||||||
case _ihkyqxiw.FkChainSetNullSetNullChild():
|
case _ihkyqxiw.FkChainSetNullSetNullChild():
|
||||||
return 'FkChainSetNullSetNullChild';
|
return 'FkChainSetNullSetNullChild';
|
||||||
case _i6rvg9xd.NullableSetDefaultChild():
|
|
||||||
return 'NullableSetDefaultChild';
|
|
||||||
case _irjtvpke.Organization():
|
case _irjtvpke.Organization():
|
||||||
return 'Organization';
|
return 'Organization';
|
||||||
case _iensfz4m.Person():
|
case _iensfz4m.Person():
|
||||||
|
|
@ -2832,8 +2690,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
return 'RequiredCascadeChild';
|
return 'RequiredCascadeChild';
|
||||||
case _itlfbi2f.RequiredNoActionChild():
|
case _itlfbi2f.RequiredNoActionChild():
|
||||||
return 'RequiredNoActionChild';
|
return 'RequiredNoActionChild';
|
||||||
case _i1huw131.RequiredSetNullChild():
|
|
||||||
return 'RequiredSetNullChild';
|
|
||||||
case _isrf0aof.RestrictChild():
|
case _isrf0aof.RestrictChild():
|
||||||
return 'RestrictChild';
|
return 'RestrictChild';
|
||||||
case _ix6xayzv.SyncDocument():
|
case _ix6xayzv.SyncDocument():
|
||||||
|
|
@ -2934,9 +2790,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
if (dataClassName == 'FkChainSetNullSetNullChild') {
|
if (dataClassName == 'FkChainSetNullSetNullChild') {
|
||||||
return deserialize<_ihkyqxiw.FkChainSetNullSetNullChild>(data['data']);
|
return deserialize<_ihkyqxiw.FkChainSetNullSetNullChild>(data['data']);
|
||||||
}
|
}
|
||||||
if (dataClassName == 'NullableSetDefaultChild') {
|
|
||||||
return deserialize<_i6rvg9xd.NullableSetDefaultChild>(data['data']);
|
|
||||||
}
|
|
||||||
if (dataClassName == 'Organization') {
|
if (dataClassName == 'Organization') {
|
||||||
return deserialize<_irjtvpke.Organization>(data['data']);
|
return deserialize<_irjtvpke.Organization>(data['data']);
|
||||||
}
|
}
|
||||||
|
|
@ -2949,9 +2802,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
if (dataClassName == 'RequiredNoActionChild') {
|
if (dataClassName == 'RequiredNoActionChild') {
|
||||||
return deserialize<_itlfbi2f.RequiredNoActionChild>(data['data']);
|
return deserialize<_itlfbi2f.RequiredNoActionChild>(data['data']);
|
||||||
}
|
}
|
||||||
if (dataClassName == 'RequiredSetNullChild') {
|
|
||||||
return deserialize<_i1huw131.RequiredSetNullChild>(data['data']);
|
|
||||||
}
|
|
||||||
if (dataClassName == 'RestrictChild') {
|
if (dataClassName == 'RestrictChild') {
|
||||||
return deserialize<_isrf0aof.RestrictChild>(data['data']);
|
return deserialize<_isrf0aof.RestrictChild>(data['data']);
|
||||||
}
|
}
|
||||||
|
|
@ -3087,8 +2937,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
return _ix62gjf0.FkChainSetNullRestrictChild.t;
|
return _ix62gjf0.FkChainSetNullRestrictChild.t;
|
||||||
case _ihkyqxiw.FkChainSetNullSetNullChild:
|
case _ihkyqxiw.FkChainSetNullSetNullChild:
|
||||||
return _ihkyqxiw.FkChainSetNullSetNullChild.t;
|
return _ihkyqxiw.FkChainSetNullSetNullChild.t;
|
||||||
case _i6rvg9xd.NullableSetDefaultChild:
|
|
||||||
return _i6rvg9xd.NullableSetDefaultChild.t;
|
|
||||||
case _irjtvpke.Organization:
|
case _irjtvpke.Organization:
|
||||||
return _irjtvpke.Organization.t;
|
return _irjtvpke.Organization.t;
|
||||||
case _iensfz4m.Person:
|
case _iensfz4m.Person:
|
||||||
|
|
@ -3097,8 +2945,6 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
||||||
return _ivx9jyda.RequiredCascadeChild.t;
|
return _ivx9jyda.RequiredCascadeChild.t;
|
||||||
case _itlfbi2f.RequiredNoActionChild:
|
case _itlfbi2f.RequiredNoActionChild:
|
||||||
return _itlfbi2f.RequiredNoActionChild.t;
|
return _itlfbi2f.RequiredNoActionChild.t;
|
||||||
case _i1huw131.RequiredSetNullChild:
|
|
||||||
return _i1huw131.RequiredSetNullChild.t;
|
|
||||||
case _isrf0aof.RestrictChild:
|
case _isrf0aof.RestrictChild:
|
||||||
return _isrf0aof.RestrictChild.t;
|
return _isrf0aof.RestrictChild.t;
|
||||||
case _iytblq2r.Town:
|
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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue