From e12c9dc9f060de7a229c94c27d9827a98ae8c196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelo=20Mendon=C3=A7a=20Soares?= Date: Thu, 8 Oct 2026 18:21:10 -0300 Subject: [PATCH] fix: Drop invalid SetNull and SetDefault test models (#165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor Agent Co-authored-by: Marcelo Mendonça Soares --- README.md | 2 +- benchmark/pubspec.yaml | 2 +- benchmark/utils/tables.dart | 1 - docs/foreign-key-invariants.md | 23 +- .../offline_sync_demo/lib/src/snapshot.dart | 2 +- .../offline_sync_demo/lib/src/table_ops.dart | 8 - example/offline_sync_demo/pubspec.yaml | 2 +- .../merge_utils/foreign_key_projector.dart | 22 +- packages/serverpod_offline_sync/pubspec.yaml | 4 +- .../pubspec.yaml | 4 +- .../pubspec.yaml | 8 +- pubspec.yaml | 2 +- .../20261007215503877/definition.json | 5976 +++++++++++++++++ .../20261007215503877/definition_project.json | 2900 ++++++++ .../20261007215503877/migration.dart | 1429 ++++ .../20261007215503877/migration.json | 34 + .../lib/migrations/migration_registry.dart | 2 + .../protocol/nullable_set_default_child.dart | 757 --- .../lib/src/protocol/protocol.dart | 154 - .../src/protocol/required_set_null_child.dart | 725 -- .../lib/src/protocol/sync_tables.dart | 4 - .../pubspec.yaml | 6 +- .../src/endpoints/demo_debug_endpoint.dart | 1 - .../generated/nullable_set_default_child.dart | 754 --- .../lib/src/generated/protocol.dart | 154 - .../generated/required_set_null_child.dart | 723 -- .../lib/src/generated/sync_tables.dart | 4 - .../nullable_set_default_child.spy.yaml | 6 - .../models/required_set_null_child.spy.yaml | 6 - .../20261007215503877/definition.json | 5976 +++++++++++++++++ .../20261007215503877/definition.sql | 1218 ++++ .../20261007215503877/definition_project.json | 2900 ++++++++ .../20261007215503877/migration.json | 34 + .../20261007215503877/migration.sql | 194 + .../migrations/migration_registry.txt | 1 + .../pubspec.yaml | 8 +- .../test/dst/dst_foreign_key_oracle_test.dart | 547 +- .../test/dst/dst_operations_test.dart | 518 +- .../test/dst/framework/dst_schema.dart | 10 - .../test/dst/framework/dst_snapshot.dart | 19 +- .../test/dst/framework/dst_world.dart | 4 +- .../merge/foreign_key_invariant_test.dart | 142 +- .../test/integration/schema/schema_test.dart | 12 +- ...eign_key_set_default_enforcement_test.dart | 84 - .../pubspec.yaml | 4 +- 45 files changed, 21347 insertions(+), 4039 deletions(-) create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition.json create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition_project.json create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.dart create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.json delete mode 100644 test/serverpod_offline_sync_test_client/lib/src/protocol/nullable_set_default_child.dart delete mode 100644 test/serverpod_offline_sync_test_client/lib/src/protocol/required_set_null_child.dart delete mode 100644 test/serverpod_offline_sync_test_server/lib/src/generated/nullable_set_default_child.dart delete mode 100644 test/serverpod_offline_sync_test_server/lib/src/generated/required_set_null_child.dart delete mode 100644 test/serverpod_offline_sync_test_server/lib/src/models/nullable_set_default_child.spy.yaml delete mode 100644 test/serverpod_offline_sync_test_server/lib/src/models/required_set_null_child.spy.yaml create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.sql create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition_project.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.sql diff --git a/README.md b/README.md index b31d0c5..91b899f 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ dependencies: ``` > [!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 `generator.yaml` file and enable the experimental `database: sync` option: diff --git a/benchmark/pubspec.yaml b/benchmark/pubspec.yaml index 8ac15bf..3f3a349 100644 --- a/benchmark/pubspec.yaml +++ b/benchmark/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: benchmark_harness: ^2.4.0 intl: ^0.20.2 path: ^1.9.1 - serverpod_database: ^4.0.0 + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync: path: ../packages/serverpod_offline_sync serverpod_offline_sync_server: diff --git a/benchmark/utils/tables.dart b/benchmark/utils/tables.dart index b1c3809..2b3c822 100644 --- a/benchmark/utils/tables.dart +++ b/benchmark/utils/tables.dart @@ -19,7 +19,6 @@ List get benchmarkSyncTables => [ FkChainSetNullSetNullChild.t, Organization.t, Person.t, - RequiredSetNullChild.t, RestrictChild.t, Town.t, Types.t, diff --git a/docs/foreign-key-invariants.md b/docs/foreign-key-invariants.md index c7c8347..cf88a31 100644 --- a/docs/foreign-key-invariants.md +++ b/docs/foreign-key-invariants.md @@ -21,6 +21,8 @@ not new user field updates emitted opportunistically during merge. - Supported foreign keys are single-column child references to single-column parent references. Schemas with composite foreign keys must fail recorder 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 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 @@ -51,15 +53,15 @@ soft-deleted instead of removed: - `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 operation. -- `ON DELETE SET NULL`: visible child FK columns are updated to `null` when the - FK is nullable, and those child FK fields receive ordinary CRDT field updates. +- `ON DELETE SET NULL`: visible child FK columns are updated to `null`, and + those child FK fields receive ordinary CRDT field updates. - `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 - CRDT field updates. A nullable null default is legal; a non-null default must - remain visible in the same space after the delete. A default in the same - delete batch is unavailable. If a visible child needs this repair, an invalid - default rejects the transaction, including any earlier repairs or tombstones - in that transaction. An unused invalid default does not itself block a delete. + CRDT field updates. A concrete UUID default must remain visible in the same + space after the delete. A default in the same delete batch is unavailable. + If a visible child needs this repair, an invalid default rejects the + transaction, including any earlier repairs or tombstones in that transaction. + An unused invalid default does not itself block a delete. - `ON DELETE CASCADE`: visible cascade descendants receive synced user-delete tombstones. Local cascade descendants are not hidden only as `foreignKeyCascade` projection rows. @@ -80,9 +82,8 @@ a column. 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. - If the FK is non-nullable, this action cannot repair the row and must fall - through to the deterministic blocking policy. +- `ON DELETE SET NULL`: the visible FK value is `null`. The schema guarantees + that the FK is nullable. - `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 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. - `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`, - 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. This makes mixed chains atomic for visibility. For example, if deleting `A` diff --git a/example/offline_sync_demo/lib/src/snapshot.dart b/example/offline_sync_demo/lib/src/snapshot.dart index 9c38031..3c3c18c 100644 --- a/example/offline_sync_demo/lib/src/snapshot.dart +++ b/example/offline_sync_demo/lib/src/snapshot.dart @@ -319,7 +319,7 @@ IconData iconForTable(String table, {required bool hidden}) { 'town' => Icons.map, 'organization' => Icons.apartment, 'company' => Icons.business, - 'restrict_child' || 'required_set_null_child' => Icons.link, + 'restrict_child' => Icons.link, 'unique' || 'unique_uuid' || 'unique_composite' => Icons.key, 'types' => Icons.data_object, _ when table.startsWith('fk_chain') => Icons.account_tree, diff --git a/example/offline_sync_demo/lib/src/table_ops.dart b/example/offline_sync_demo/lib/src/table_ops.dart index f7620d3..b972835 100644 --- a/example/offline_sync_demo/lib/src/table_ops.dart +++ b/example/offline_sync_demo/lib/src/table_ops.dart @@ -160,14 +160,6 @@ final Map demoTableOps = { create: (id, label, foreignKeys) => RestrictChild(id: id, name: label, parentId: foreignKeys['parentId']), ), - _ops( - canCreateRoot: false, - create: (id, label, foreignKeys) { - final parentId = foreignKeys['parentId']; - if (parentId == null) return null; - return RequiredSetNullChild(id: id, name: label, parentId: parentId); - }, - ), _ops( create: (id, label, foreignKeys) => Unique(id: id, name: label), ), diff --git a/example/offline_sync_demo/pubspec.yaml b/example/offline_sync_demo/pubspec.yaml index 25d1be5..36e6352 100644 --- a/example/offline_sync_demo/pubspec.yaml +++ b/example/offline_sync_demo/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: http: ^1.5.0 path: ^1.9.1 path_provider: ^2.1.5 - serverpod_database: ^4.0.0 + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync_client: path: ../../packages/serverpod_offline_sync_client serverpod_offline_sync_test_client: diff --git a/packages/serverpod_offline_sync/lib/src/database/merge_utils/foreign_key_projector.dart b/packages/serverpod_offline_sync/lib/src/database/merge_utils/foreign_key_projector.dart index 36ecee1..706e62e 100644 --- a/packages/serverpod_offline_sync/lib/src/database/merge_utils/foreign_key_projector.dart +++ b/packages/serverpod_offline_sync/lib/src/database/merge_utils/foreign_key_projector.dart @@ -540,13 +540,11 @@ class CrdtForeignKeyProjector { switch (edge.action) { case ForeignKeyAction.setNull: - if (edge.childNullable) { - safeData[edge.childColumn] = null; - attempts[fieldKey] = ( - value: attemptedValue, - reason: CrdtProjectionReason.foreignKeySetNull, - ); - } + safeData[edge.childColumn] = null; + attempts[fieldKey] = ( + value: attemptedValue, + reason: CrdtProjectionReason.foreignKeySetNull, + ); case ForeignKeyAction.setDefault: final defaultProjection = await _defaultProjectionValueFromDatabase( edge, @@ -1808,7 +1806,7 @@ class CrdtForeignKeyProjector { ) { switch (edge.action) { case ForeignKeyAction.setNull: - return edge.childNullable; + return true; case ForeignKeyAction.setDefault: final defaultValue = edge.defaultValue.toUuidValue(); if (defaultValue == null) return edge.childNullable; @@ -1893,7 +1891,7 @@ class CrdtForeignKeyProjector { case ForeignKeyAction.noAction: return true; case ForeignKeyAction.setNull: - if (!edge.childNullable) return true; + break; case ForeignKeyAction.setDefault: if (!_defaultProjectionValue(edge, state, finalHidden).valid) { return true; @@ -2124,10 +2122,8 @@ class CrdtForeignKeyProjector { _targetHiddenOrMissing(edge, attemptedValue, state, finalHidden)) { switch (edge.action) { case ForeignKeyAction.setNull: - if (edge.childNullable) { - desiredVisibleValue = null; - overrideReason = CrdtProjectionReason.foreignKeySetNull; - } + desiredVisibleValue = null; + overrideReason = CrdtProjectionReason.foreignKeySetNull; case ForeignKeyAction.setDefault: final defaultProjection = _defaultProjectionValue( edge, diff --git a/packages/serverpod_offline_sync/pubspec.yaml b/packages/serverpod_offline_sync/pubspec.yaml index 0d8791b..30aaf0f 100644 --- a/packages/serverpod_offline_sync/pubspec.yaml +++ b/packages/serverpod_offline_sync/pubspec.yaml @@ -11,8 +11,8 @@ resolution: workspace dependencies: clock: ^1.1.2 meta: ^1.18.0 - serverpod_database: ^4.0.0 - serverpod_serialization: ^4.0.0 + serverpod_database: '>=4.0.4 <4.1.0' + serverpod_serialization: '>=4.0.4 <4.1.0' uuid: ^4.5.3 dev_dependencies: diff --git a/packages/serverpod_offline_sync_client/pubspec.yaml b/packages/serverpod_offline_sync_client/pubspec.yaml index e8d3d59..68c76a0 100644 --- a/packages/serverpod_offline_sync_client/pubspec.yaml +++ b/packages/serverpod_offline_sync_client/pubspec.yaml @@ -9,8 +9,8 @@ environment: resolution: workspace dependencies: - serverpod_client: ^4.0.0 - serverpod_database: ^4.0.0 + serverpod_client: '>=4.0.4 <4.1.0' + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync: 0.0.9 dev_dependencies: diff --git a/packages/serverpod_offline_sync_server/pubspec.yaml b/packages/serverpod_offline_sync_server/pubspec.yaml index 3a721ca..e153376 100644 --- a/packages/serverpod_offline_sync_server/pubspec.yaml +++ b/packages/serverpod_offline_sync_server/pubspec.yaml @@ -10,12 +10,12 @@ resolution: workspace dependencies: meta: ^1.16.0 - serverpod: ^4.0.0 - serverpod_database: ^4.0.0 + serverpod: '>=4.0.4 <4.1.0' + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync: 0.0.9 dev_dependencies: lints: '>=3.0.0 <7.0.0' - serverpod_cli: ^4.0.0 - serverpod_test: ^4.0.0 + serverpod_cli: '>=4.0.4 <4.1.0' + serverpod_test: '>=4.0.4 <4.1.0' test: ^1.25.5 diff --git a/pubspec.yaml b/pubspec.yaml index 27cf9f0..7332cd1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ workspace: dev_dependencies: melos: ^7.5.1 - serverpod_cli: ^4.0.0 + serverpod_cli: '>=4.0.4 <4.1.0' # dependency_overrides: # serverpod: diff --git a/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition.json b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition.json new file mode 100644 index 0000000..acc4484 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition.json @@ -0,0 +1,5976 @@ +{ + "__className__": "serverpod.DatabaseDefinition", + "schemaVersion": 2, + "moduleName": "serverpod_offline_sync_test", + "tables": [ + { + "__className__": "serverpod.TableDefinition", + "name": "address", + "dartName": "Address", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "street", + "fieldName": "street", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "inhabitantId", + "fieldName": "inhabitantId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_1", + "columns": [ + "inhabitantId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "address__inhabitantId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "inhabitantId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "city", + "dartName": "City", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "city_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "company", + "dartName": "Company", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "townId", + "fieldName": "townId", + "columnType": 7, + "isNullable": false, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_1", + "columns": [ + "townId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_cascade_middle", + "dartName": "FkChainCascadeMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rootId", + "fieldName": "rootId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_1", + "columns": [ + "rootId" + ], + "referenceTable": "fk_chain_root", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_cascade_child", + "dartName": "FkChainMiddleCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_set_null_child", + "dartName": "FkChainMiddleSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_restrict_blocker", + "dartName": "FkChainRestrictBlocker", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_root", + "dartName": "FkChainRoot", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_root_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_cascade_child", + "dartName": "FkChainSetNullCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_middle", + "dartName": "FkChainSetNullMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_restrict_child", + "dartName": "FkChainSetNullRestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_set_null_child", + "dartName": "FkChainSetNullSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "organization", + "dartName": "Organization", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "person", + "dartName": "Person", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "surname", + "fieldName": "surname", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "organizationId", + "fieldName": "organizationId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "oldCompanyId", + "fieldName": "oldCompanyId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_1", + "columns": [ + "organizationId" + ], + "referenceTable": "organization", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_2", + "columns": [ + "oldCompanyId" + ], + "referenceTable": "company", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_3", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_cascade_child", + "dartName": "RequiredCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_no_action_child", + "dartName": "RequiredNoActionChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "restrict_child", + "dartName": "RestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_child", + "dartName": "SharedChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "flavor", + "fieldName": "flavor", + "columnType": 0, + "isNullable": false, + "columnDefault": "'plain'", + "dartType": "serverpod_offline_sync_test_shared:SharedFlavor" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "shared_parent", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_parent", + "dartName": "SharedParent", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_parent_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "town", + "dartName": "Town", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "mayorId", + "fieldName": "mayorId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_2", + "columns": [ + "mayorId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "types", + "dartName": "Types", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBool", + "fieldName": "aBool", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aDateTime", + "fieldName": "aDateTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aText", + "fieldName": "aText", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt", + "fieldName": "anInt", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt64", + "fieldName": "anInt64", + "columnType": 0, + "isNullable": false, + "dartType": "BigInt" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aReal", + "fieldName": "aReal", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBlob", + "fieldName": "aBlob", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anEnum", + "fieldName": "anEnum", + "columnType": 6, + "isNullable": true, + "dartType": "protocol:TypesEnum?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalText", + "fieldName": "optionalText", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalUuid", + "fieldName": "optionalUuid", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonDocument", + "fieldName": "jsonDocument", + "columnType": 8, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbDocument", + "fieldName": "jsonbDocument", + "columnType": 14, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbNumbers", + "fieldName": "jsonbNumbers", + "columnType": 14, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "types", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "types_a_text_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "aText" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique", + "dartName": "Unique", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_child", + "dartName": "UniqueCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_child__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_reference", + "dartName": "UniqueCascadeReference", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_reference__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_composite", + "dartName": "UniqueComposite", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scope", + "fieldName": "scope", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_composite_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_composite__spaceId__scope__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "scope" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_discriminator", + "dartName": "UniqueDiscriminator", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_discriminator_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_discriminator__spaceId__categoryId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_fk_pair", + "dartName": "UniqueFkPair", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "leftId", + "fieldName": "leftId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rightId", + "fieldName": "rightId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_1", + "columns": [ + "leftId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_2", + "columns": [ + "rightId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_fk_pair_parents", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "leftId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rightId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_mixed_fk", + "dartName": "UniqueMixedFk", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_mixed_fk_name_parent", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_no_release", + "dartName": "UniqueNoRelease", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_no_release_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_no_release__spaceId__categoryId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_nullable", + "dartName": "UniqueNullable", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_nullable_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_nullable__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_overlapping", + "dartName": "UniqueOverlapping", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "first", + "fieldName": "first", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "second", + "fieldName": "second", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "third", + "fieldName": "third", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_overlapping_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_first_second", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "first" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_second_third", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "third" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_default_child", + "dartName": "UniqueSetDefaultChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_null_child", + "dartName": "UniqueSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_null_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_uuid", + "dartName": "UniqueUuid", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_uuid_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_uuid__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_cloud_storage", + "dartName": "CloudStorageEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "addedTime", + "fieldName": "addedTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiration", + "fieldName": "expiration", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "byteData", + "fieldName": "byteData", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "verified", + "fieldName": "verified", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentType", + "fieldName": "contentType", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cacheControl", + "fieldName": "cacheControl", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentDisposition", + "fieldName": "contentDisposition", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentEncoding", + "fieldName": "contentEncoding", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "customMetadata", + "fieldName": "customMetadata", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_path_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "storageId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "path" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_expiration", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "expiration" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_cloud_storage_direct_download", + "dartName": "CloudStorageDirectDownloadEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiration", + "fieldName": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authKey", + "fieldName": "authKey", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "downloadFileName", + "fieldName": "downloadFileName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentType", + "fieldName": "contentType", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_direct_download_auth_key", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "authKey" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_direct_download_expiration", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "expiration" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_cloud_storage_direct_upload", + "dartName": "CloudStorageDirectUploadEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiration", + "fieldName": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authKey", + "fieldName": "authKey", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "maxFileSize", + "fieldName": "maxFileSize", + "columnType": 6, + "isNullable": false, + "columnDefault": "10485760", + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentLength", + "fieldName": "contentLength", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "preventOverwrite", + "fieldName": "preventOverwrite", + "columnType": 1, + "isNullable": false, + "columnDefault": "false", + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentType", + "fieldName": "contentType", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cacheControl", + "fieldName": "cacheControl", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentDisposition", + "fieldName": "contentDisposition", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentEncoding", + "fieldName": "contentEncoding", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "customMetadata", + "fieldName": "customMetadata", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_direct_upload_storage_path", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "storageId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "path" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_future_call", + "dartName": "FutureCallEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "time", + "fieldName": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serializedObject", + "fieldName": "serializedObject", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "identifier", + "fieldName": "identifier", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scheduling", + "fieldName": "scheduling", + "columnType": 8, + "isNullable": true, + "dartType": "protocol:FutureCallScheduling?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_future_call_time_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_future_call_serverId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_future_call_identifier_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "identifier" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_future_call_claim", + "dartName": "FutureCallClaimEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "futureCallId", + "fieldName": "futureCallId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastHeartbeatTime", + "fieldName": "lastHeartbeatTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_future_call_claim_fk_0", + "columns": [ + "futureCallId" + ], + "referenceTable": "serverpod_future_call", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "future_call_unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "futureCallId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_health_connection_info", + "dartName": "ServerHealthConnectionInfo", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "timestamp", + "fieldName": "timestamp", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "active", + "fieldName": "active", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "closing", + "fieldName": "closing", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "idle", + "fieldName": "idle", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "granularity", + "fieldName": "granularity", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_health_connection_info_timestamp_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "timestamp" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "granularity" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_health_metric", + "dartName": "ServerHealthMetric", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "timestamp", + "fieldName": "timestamp", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "isHealthy", + "fieldName": "isHealthy", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "granularity", + "fieldName": "granularity", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_health_metric_timestamp_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "timestamp" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "granularity" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_log", + "dartName": "LogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionLogId", + "fieldName": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageId", + "fieldName": "messageId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "reference", + "fieldName": "reference", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "time", + "fieldName": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logLevel", + "fieldName": "logLevel", + "columnType": 6, + "isNullable": false, + "dartType": "protocol:LogLevel" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "message", + "fieldName": "message", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "order", + "fieldName": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_log_sessionLogId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "sessionLogId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "order" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_message_log", + "dartName": "MessageLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionLogId", + "fieldName": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageId", + "fieldName": "messageId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "endpoint", + "fieldName": "endpoint", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageName", + "fieldName": "messageName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "duration", + "fieldName": "duration", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "slow", + "fieldName": "slow", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "order", + "fieldName": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_message_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_message_log_sessionLogId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "sessionLogId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "order" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_method", + "dartName": "MethodInfo", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "endpoint", + "fieldName": "endpoint", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_method_endpoint_method_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "endpoint" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "method" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_migrations", + "dartName": "DatabaseMigrationVersion", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "module", + "fieldName": "module", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "version", + "fieldName": "version", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "timestamp", + "fieldName": "timestamp", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_migrations_ids", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "module" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_query_log", + "dartName": "QueryLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionLogId", + "fieldName": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageId", + "fieldName": "messageId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "query", + "fieldName": "query", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "duration", + "fieldName": "duration", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "numRows", + "fieldName": "numRows", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "slow", + "fieldName": "slow", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "order", + "fieldName": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_query_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_query_log_sessionLogId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "sessionLogId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "order" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_readwrite_test", + "dartName": "ReadWriteTestEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "number", + "fieldName": "number", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_runtime_settings", + "dartName": "RuntimeSettings", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logSettings", + "fieldName": "logSettings", + "columnType": 8, + "isNullable": false, + "dartType": "protocol:LogSettings" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logSettingsOverrides", + "fieldName": "logSettingsOverrides", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logServiceCalls", + "fieldName": "logServiceCalls", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logMalformedCalls", + "fieldName": "logMalformedCalls", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_session_log", + "dartName": "SessionLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "time", + "fieldName": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "module", + "fieldName": "module", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "endpoint", + "fieldName": "endpoint", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "duration", + "fieldName": "duration", + "columnType": 3, + "isNullable": true, + "dartType": "double?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "numQueries", + "fieldName": "numQueries", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "slow", + "fieldName": "slow", + "columnType": 1, + "isNullable": true, + "dartType": "bool?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authenticatedUserId", + "fieldName": "authenticatedUserId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userId", + "fieldName": "userId", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "isOpen", + "fieldName": "isOpen", + "columnType": 1, + "isNullable": true, + "dartType": "bool?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "touched", + "fieldName": "touched", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_serverid_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_time_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_touched_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "touched" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_isopen_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "isOpen" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_jwt_refresh_token", + "dartName": "RefreshToken", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authUserId", + "fieldName": "authUserId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scopeNames", + "fieldName": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "Set" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "extraClaims", + "fieldName": "extraClaims", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "fixedSecret", + "fieldName": "fixedSecret", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rotatingSecretHash", + "fieldName": "rotatingSecretHash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastUpdatedAt", + "fieldName": "lastUpdatedAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_jwt_refresh_token_fk_0", + "columns": [ + "authUserId" + ], + "referenceTable": "serverpod_auth_core_user", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_auth_core_jwt_refresh_token_last_updated_at", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "lastUpdatedAt" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_profile", + "dartName": "UserProfile", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authUserId", + "fieldName": "authUserId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userName", + "fieldName": "userName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "fullName", + "fieldName": "fullName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "email", + "fieldName": "email", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "imageId", + "fieldName": "imageId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_profile_fk_0", + "columns": [ + "authUserId" + ], + "referenceTable": "serverpod_auth_core_user", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_profile_fk_1", + "columns": [ + "imageId" + ], + "referenceTable": "serverpod_auth_core_profile_image", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_auth_profile_user_profile_email_auth_user_id", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "authUserId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_profile_image", + "dartName": "UserProfileImage", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userProfileId", + "fieldName": "userProfileId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "url", + "fieldName": "url", + "columnType": 0, + "isNullable": false, + "dartType": "Uri" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_profile_image_fk_0", + "columns": [ + "userProfileId" + ], + "referenceTable": "serverpod_auth_core_profile", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_session", + "dartName": "ServerSideSession", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authUserId", + "fieldName": "authUserId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scopeNames", + "fieldName": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "Set" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastUsedAt", + "fieldName": "lastUsedAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiresAt", + "fieldName": "expiresAt", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expireAfterUnusedFor", + "fieldName": "expireAfterUnusedFor", + "columnType": 6, + "isNullable": true, + "dartType": "Duration?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionKeyHash", + "fieldName": "sessionKeyHash", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionKeySalt", + "fieldName": "sessionKeySalt", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_session_fk_0", + "columns": [ + "authUserId" + ], + "referenceTable": "serverpod_auth_core_user", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_user", + "dartName": "AuthUser", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scopeNames", + "fieldName": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "Set" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "blocked", + "fieldName": "blocked", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_attempted_value", + "dartName": "CrdtDataAttemptedValue", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "fieldId", + "fieldName": "fieldId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 14, + "isNullable": false, + "dartType": "dynamic" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "projectionReason", + "fieldName": "projectionReason", + "columnType": 6, + "isNullable": false, + "dartType": "serverpod_offline_sync:CrdtProjectionReason" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_attempted_value_fk_0", + "columns": [ + "fieldId" + ], + "referenceTable": "crdt_data_fields", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_attempted_value__fieldId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "fieldId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_fields", + "dartName": "CrdtDataField", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rowId", + "fieldName": "rowId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "columnId", + "fieldName": "columnId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_fields_fk_0", + "columns": [ + "rowId" + ], + "referenceTable": "crdt_data_rows", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_fields_fk_1", + "columns": [ + "columnId" + ], + "referenceTable": "crdt_schema_columns", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_fields_fk_2", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_fields_row_column_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rowId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "columnId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_rows", + "dartName": "CrdtDataRow", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "tblId", + "fieldName": "tblId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidRowId", + "fieldName": "uuidRowId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "visibility", + "fieldName": "visibility", + "columnType": 6, + "isNullable": false, + "columnDefault": "0", + "dartType": "serverpod_offline_sync:CrdtDataRowVisibility" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_rows_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_rows_fk_1", + "columns": [ + "tblId" + ], + "referenceTable": "crdt_schema_tables", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_rows_fk_2", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_rows_space_tbl_row_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "tblId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidRowId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_tombstone", + "dartName": "CrdtDataDeleted", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rowId", + "fieldName": "rowId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "clFlag", + "fieldName": "clFlag", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "reason", + "fieldName": "reason", + "columnType": 6, + "isNullable": false, + "dartType": "serverpod_offline_sync:CrdtDataDeletedReason" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_tombstone_fk_0", + "columns": [ + "rowId" + ], + "referenceTable": "crdt_data_rows", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_tombstone_fk_1", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_tombstone_row_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rowId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_nodes", + "dartName": "CrdtNode", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidNodeId", + "fieldName": "uuidNodeId", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastHlc", + "fieldName": "lastHlc", + "columnType": 14, + "isNullable": true, + "dartType": "package:serverpod_offline_sync/serverpod_offline_sync.dart:Hlc?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_nodes__uuidNodeId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidNodeId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_schema_columns", + "dartName": "CrdtSchemaColumn", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "tblId", + "fieldName": "tblId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "columnType", + "fieldName": "columnType", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "dartType", + "fieldName": "dartType", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "isNullable", + "fieldName": "isNullable", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_schema_columns_fk_0", + "columns": [ + "tblId" + ], + "referenceTable": "crdt_schema_tables", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_schema_columns_table_column_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "tblId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_schema_tables", + "dartName": "CrdtSchemaTable", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_schema_tables__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_integrity_violations", + "dartName": "OfflineSyncIntegrityViolation", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "type", + "fieldName": "type", + "columnType": 0, + "isNullable": false, + "dartType": "serverpod_offline_sync:OfflineSyncViolationType" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "domainTableName", + "fieldName": "domainTableName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidRowId", + "fieldName": "uuidRowId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "ownerSpaceUuid", + "fieldName": "ownerSpaceUuid", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "incomingSpaceUuid", + "fieldName": "incomingSpaceUuid", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "operation", + "fieldName": "operation", + "columnType": 0, + "isNullable": false, + "dartType": "serverpod_offline_sync:OfflineSyncViolationOperation" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidNodeId", + "fieldName": "uuidNodeId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "crdtDataRowId", + "fieldName": "crdtDataRowId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "firstSeenAt", + "fieldName": "firstSeenAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastSeenAt", + "fieldName": "lastSeenAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "occurrences", + "fieldName": "occurrences", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_integrity_violations_key_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "type" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "operation" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "domainTableName" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidRowId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "ownerSpaceUuid" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "incomingSpaceUuid" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_space_members", + "dartName": "OfflineSyncSpaceMember", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userUuid", + "fieldName": "userUuid", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "role", + "fieldName": "role", + "columnType": 0, + "isNullable": false, + "dartType": "serverpod_offline_sync:OfflineSyncSpaceRole" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_space_members_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_space_member_unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "userUuid" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_space_nodes", + "dartName": "OfflineSyncSpaceNode", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastReceivedHlc", + "fieldName": "lastReceivedHlc", + "columnType": 14, + "isNullable": true, + "dartType": "package:serverpod_offline_sync/serverpod_offline_sync.dart:Hlc?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_space_nodes_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_space_nodes_fk_1", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_space_node_unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "nodeId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_spaces", + "dartName": "OfflineSyncSpace", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidSpaceId", + "fieldName": "uuidSpaceId", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "currentNodeId", + "fieldName": "currentNodeId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_spaces_fk_0", + "columns": [ + "currentNodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_spaces__uuidSpaceId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidSpaceId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + ], + "installedModules": [ + { + "__className__": "serverpod.DatabaseMigrationVersionModel", + "module": "serverpod_offline_sync_test", + "version": "20261007215503877" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod", + "version": "20260824182259319" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_auth_core", + "version": "20260924105232991" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_offline_sync", + "version": "20260914143806119" + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition_project.json b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition_project.json new file mode 100644 index 0000000..73b52d7 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/definition_project.json @@ -0,0 +1,2900 @@ +{ + "__className__": "serverpod.DatabaseDefinition", + "schemaVersion": 2, + "moduleName": "serverpod_offline_sync_test", + "tables": [ + { + "__className__": "serverpod.TableDefinition", + "name": "address", + "dartName": "Address", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "street", + "fieldName": "street", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "inhabitantId", + "fieldName": "inhabitantId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_1", + "columns": [ + "inhabitantId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "address__inhabitantId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "inhabitantId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "city", + "dartName": "City", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "city_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "company", + "dartName": "Company", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "townId", + "fieldName": "townId", + "columnType": 7, + "isNullable": false, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_1", + "columns": [ + "townId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_cascade_middle", + "dartName": "FkChainCascadeMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rootId", + "fieldName": "rootId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_1", + "columns": [ + "rootId" + ], + "referenceTable": "fk_chain_root", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_cascade_child", + "dartName": "FkChainMiddleCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_set_null_child", + "dartName": "FkChainMiddleSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_restrict_blocker", + "dartName": "FkChainRestrictBlocker", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_root", + "dartName": "FkChainRoot", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_root_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_cascade_child", + "dartName": "FkChainSetNullCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_middle", + "dartName": "FkChainSetNullMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_restrict_child", + "dartName": "FkChainSetNullRestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_set_null_child", + "dartName": "FkChainSetNullSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "organization", + "dartName": "Organization", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "person", + "dartName": "Person", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "surname", + "fieldName": "surname", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "organizationId", + "fieldName": "organizationId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "oldCompanyId", + "fieldName": "oldCompanyId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_1", + "columns": [ + "organizationId" + ], + "referenceTable": "organization", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_2", + "columns": [ + "oldCompanyId" + ], + "referenceTable": "company", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_3", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_cascade_child", + "dartName": "RequiredCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_no_action_child", + "dartName": "RequiredNoActionChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "restrict_child", + "dartName": "RestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_child", + "dartName": "SharedChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "flavor", + "fieldName": "flavor", + "columnType": 0, + "isNullable": false, + "columnDefault": "'plain'", + "dartType": "serverpod_offline_sync_test_shared:SharedFlavor" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "shared_parent", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_parent", + "dartName": "SharedParent", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_parent_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "town", + "dartName": "Town", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "mayorId", + "fieldName": "mayorId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_2", + "columns": [ + "mayorId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "types", + "dartName": "Types", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBool", + "fieldName": "aBool", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aDateTime", + "fieldName": "aDateTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aText", + "fieldName": "aText", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt", + "fieldName": "anInt", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt64", + "fieldName": "anInt64", + "columnType": 0, + "isNullable": false, + "dartType": "BigInt" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aReal", + "fieldName": "aReal", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBlob", + "fieldName": "aBlob", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anEnum", + "fieldName": "anEnum", + "columnType": 6, + "isNullable": true, + "dartType": "protocol:TypesEnum?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalText", + "fieldName": "optionalText", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalUuid", + "fieldName": "optionalUuid", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonDocument", + "fieldName": "jsonDocument", + "columnType": 8, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbDocument", + "fieldName": "jsonbDocument", + "columnType": 14, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbNumbers", + "fieldName": "jsonbNumbers", + "columnType": 14, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "types", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "types_a_text_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "aText" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique", + "dartName": "Unique", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_child", + "dartName": "UniqueCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_child__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_reference", + "dartName": "UniqueCascadeReference", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_reference__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_composite", + "dartName": "UniqueComposite", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scope", + "fieldName": "scope", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_composite_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_composite__spaceId__scope__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "scope" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_discriminator", + "dartName": "UniqueDiscriminator", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_discriminator_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_discriminator__spaceId__categoryId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_fk_pair", + "dartName": "UniqueFkPair", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "leftId", + "fieldName": "leftId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rightId", + "fieldName": "rightId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_1", + "columns": [ + "leftId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_2", + "columns": [ + "rightId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_fk_pair_parents", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "leftId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rightId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_mixed_fk", + "dartName": "UniqueMixedFk", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_mixed_fk_name_parent", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_no_release", + "dartName": "UniqueNoRelease", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_no_release_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_no_release__spaceId__categoryId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_nullable", + "dartName": "UniqueNullable", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_nullable_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_nullable__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_overlapping", + "dartName": "UniqueOverlapping", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "first", + "fieldName": "first", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "second", + "fieldName": "second", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "third", + "fieldName": "third", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_overlapping_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_first_second", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "first" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_second_third", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "third" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_default_child", + "dartName": "UniqueSetDefaultChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_null_child", + "dartName": "UniqueSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_null_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_uuid", + "dartName": "UniqueUuid", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_uuid_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_uuid__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + ], + "installedModules": [ + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod", + "version": "20260824182259319" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_auth_core", + "version": "20260924105232991" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_offline_sync", + "version": "20260914143806119" + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.dart b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.dart new file mode 100644 index 0000000..1d07660 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.dart @@ -0,0 +1,1429 @@ +/// AUTOGENERATED BY SERVERPOD create-migration - DO NOT EDIT BY HAND +/// Merging: resolve registry conflicts the same as migration_registry.txt. +part of '../migration_registry.dart'; + +class _Migration20261007215503877 implements MigrationVersionSql { + @override + String get version => '20261007215503877'; + + @override + String get moduleName => 'serverpod_offline_sync_test'; + + @override + String get migrationSql => '''BEGIN; + +-- +-- ACTION DROP TABLE +-- +DROP TABLE "required_set_null_child"; + +-- +-- ACTION DROP TABLE +-- +DROP TABLE "nullable_set_default_child"; + +-- +-- STORE COLUMN TYPES FOR MIGRATIONS +-- +DROP TABLE IF EXISTS "serverpod_sqlite_schema"; + +CREATE TABLE "serverpod_sqlite_schema" ( + "table_name" TEXT NOT NULL, + "column_name" TEXT NOT NULL, + "column_type" TEXT NOT NULL, + "column_vector_dimension" INTEGER, + PRIMARY KEY ("table_name", "column_name") +); + +INSERT INTO "serverpod_sqlite_schema" VALUES + ('address', 'id', 'uuid', NULL), + ('address', 'inhabitantId', 'uuid', NULL), + ('city', 'id', 'uuid', NULL), + ('company', 'id', 'uuid', NULL), + ('company', 'townId', 'uuid', NULL), + ('fk_chain_cascade_middle', 'id', 'uuid', NULL), + ('fk_chain_cascade_middle', 'rootId', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'id', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_root', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_middle', 'id', 'uuid', NULL), + ('fk_chain_set_null_middle', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'setNullMiddleId', 'uuid', NULL), + ('organization', 'id', 'uuid', NULL), + ('organization', 'cityId', 'uuid', NULL), + ('person', 'id', 'uuid', NULL), + ('person', 'organizationId', 'uuid', NULL), + ('person', 'oldCompanyId', 'uuid', NULL), + ('person', 'cityId', 'uuid', NULL), + ('required_cascade_child', 'id', 'uuid', NULL), + ('required_cascade_child', 'parentId', 'uuid', NULL), + ('required_no_action_child', 'id', 'uuid', NULL), + ('required_no_action_child', 'parentId', 'uuid', NULL), + ('restrict_child', 'id', 'uuid', NULL), + ('restrict_child', 'parentId', 'uuid', NULL), + ('shared_child', 'id', 'uuid', NULL), + ('shared_child', 'parentId', 'uuid', NULL), + ('shared_parent', 'id', 'uuid', NULL), + ('town', 'id', 'uuid', NULL), + ('town', 'cityId', 'uuid', NULL), + ('town', 'mayorId', 'uuid', NULL), + ('types', 'id', 'uuid', NULL), + ('types', 'aBool', 'boolean', NULL), + ('types', 'aDateTime', 'timestampWithoutTimeZone', NULL), + ('types', 'optionalUuid', 'uuid', NULL), + ('types', 'parentId', 'uuid', NULL), + ('types', 'jsonDocument', 'json', NULL), + ('types', 'jsonbDocument', 'jsonb', NULL), + ('types', 'jsonbNumbers', 'jsonb', NULL), + ('unique', 'id', 'uuid', NULL), + ('unique_cascade_child', 'id', 'uuid', NULL), + ('unique_cascade_child', 'parentId', 'uuid', NULL), + ('unique_cascade_reference', 'id', 'uuid', NULL), + ('unique_cascade_reference', 'parentId', 'uuid', NULL), + ('unique_composite', 'id', 'uuid', NULL), + ('unique_discriminator', 'id', 'uuid', NULL), + ('unique_fk_pair', 'id', 'uuid', NULL), + ('unique_fk_pair', 'leftId', 'uuid', NULL), + ('unique_fk_pair', 'rightId', 'uuid', NULL), + ('unique_mixed_fk', 'id', 'uuid', NULL), + ('unique_mixed_fk', 'parentId', 'uuid', NULL), + ('unique_no_release', 'id', 'uuid', NULL), + ('unique_nullable', 'id', 'uuid', NULL), + ('unique_overlapping', 'id', 'uuid', NULL), + ('unique_set_default_child', 'id', 'uuid', NULL), + ('unique_set_default_child', 'parentId', 'uuid', NULL), + ('unique_set_null_child', 'id', 'uuid', NULL), + ('unique_set_null_child', 'parentId', 'uuid', NULL), + ('unique_uuid', 'id', 'uuid', NULL), + ('unique_uuid', 'value', 'uuid', NULL), + ('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'verified', 'boolean', NULL), + ('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL), + ('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_future_call', 'scheduling', 'json', NULL), + ('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'isHealthy', 'boolean', NULL), + ('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_message_log', 'slow', 'boolean', NULL), + ('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_query_log', 'slow', 'boolean', NULL), + ('serverpod_runtime_settings', 'logSettings', 'json', NULL), + ('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL), + ('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL), + ('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL), + ('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_session_log', 'slow', 'boolean', NULL), + ('serverpod_session_log', 'isOpen', 'boolean', NULL), + ('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'imageId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'id', 'uuid', NULL), + ('serverpod_auth_core_session', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_session', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'id', 'uuid', NULL), + ('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_user', 'blocked', 'boolean', NULL), + ('crdt_data_attempted_value', 'value', 'jsonb', NULL), + ('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'uuidRowId', 'uuid', NULL), + ('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_nodes', 'uuidNodeId', 'uuid', NULL), + ('crdt_nodes', 'lastHlc', 'jsonb', NULL), + ('crdt_schema_columns', 'isNullable', 'boolean', NULL), + ('offline_sync_integrity_violations', 'uuidRowId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'ownerSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'incomingSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_space_members', 'userUuid', 'uuid', NULL), + ('offline_sync_space_nodes', 'lastReceivedHlc', 'jsonb', NULL), + ('offline_sync_spaces', 'uuidSpaceId', 'uuid', NULL); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync_test +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync_test', '20261007215503877', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261007215503877', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod', '20260824182259319', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260824182259319', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_auth_core +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_auth_core', '20260924105232991', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260924105232991', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync', '20260914143806119', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260914143806119', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + + +COMMIT; +'''; + + @override + String get definitionSql => '''BEGIN; + +-- +-- Class Address as table address +-- +CREATE TABLE "address" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "street" TEXT NOT NULL, + "inhabitantId" BLOB, + CONSTRAINT "address_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "address_fk_1" FOREIGN KEY ("inhabitantId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "address__inhabitantId__unique_idx" ON "address" ("inhabitantId"); + + +-- +-- Class City as table city +-- +CREATE TABLE "city" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "city_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class Company as table company +-- +CREATE TABLE "company" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "townId" BLOB NOT NULL DEFAULT (X'550e8400e29b41d4a716446655440000'), + CONSTRAINT "company_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "company_fk_1" FOREIGN KEY ("townId") REFERENCES "town" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainCascadeMiddle as table fk_chain_cascade_middle +-- +CREATE TABLE "fk_chain_cascade_middle" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "rootId" BLOB, + CONSTRAINT "fk_chain_cascade_middle_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_cascade_middle_fk_1" FOREIGN KEY ("rootId") REFERENCES "fk_chain_root" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainMiddleCascadeChild as table fk_chain_middle_cascade_child +-- +CREATE TABLE "fk_chain_middle_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "restrictBlockerId" BLOB, + CONSTRAINT "fk_chain_middle_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_middle_cascade_child_fk_1" FOREIGN KEY ("restrictBlockerId") REFERENCES "fk_chain_restrict_blocker" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainMiddleSetNullChild as table fk_chain_middle_set_null_child +-- +CREATE TABLE "fk_chain_middle_set_null_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "restrictBlockerId" BLOB, + CONSTRAINT "fk_chain_middle_set_null_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_middle_set_null_child_fk_1" FOREIGN KEY ("restrictBlockerId") REFERENCES "fk_chain_restrict_blocker" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainRestrictBlocker as table fk_chain_restrict_blocker +-- +CREATE TABLE "fk_chain_restrict_blocker" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cascadeMiddleId" BLOB, + CONSTRAINT "fk_chain_restrict_blocker_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_restrict_blocker_fk_1" FOREIGN KEY ("cascadeMiddleId") REFERENCES "fk_chain_cascade_middle" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainRoot as table fk_chain_root +-- +CREATE TABLE "fk_chain_root" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "fk_chain_root_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class FkChainSetNullCascadeChild as table fk_chain_set_null_cascade_child +-- +CREATE TABLE "fk_chain_set_null_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "setNullMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_cascade_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainSetNullMiddle as table fk_chain_set_null_middle +-- +CREATE TABLE "fk_chain_set_null_middle" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cascadeMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_middle_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_middle_fk_1" FOREIGN KEY ("cascadeMiddleId") REFERENCES "fk_chain_cascade_middle" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainSetNullRestrictChild as table fk_chain_set_null_restrict_child +-- +CREATE TABLE "fk_chain_set_null_restrict_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "setNullMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_restrict_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_restrict_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainSetNullSetNullChild as table fk_chain_set_null_set_null_child +-- +CREATE TABLE "fk_chain_set_null_set_null_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "setNullMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_set_null_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_set_null_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class Organization as table organization +-- +CREATE TABLE "organization" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cityId" BLOB, + CONSTRAINT "organization_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "organization_fk_1" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class Person as table person +-- +CREATE TABLE "person" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "surname" TEXT, + "organizationId" BLOB, + "oldCompanyId" BLOB, + "cityId" BLOB, + CONSTRAINT "person_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "person_fk_1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "person_fk_2" FOREIGN KEY ("oldCompanyId") REFERENCES "company" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT "person_fk_3" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class RequiredCascadeChild as table required_cascade_child +-- +CREATE TABLE "required_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB NOT NULL, + CONSTRAINT "required_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "required_cascade_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class RequiredNoActionChild as table required_no_action_child +-- +CREATE TABLE "required_no_action_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB NOT NULL, + CONSTRAINT "required_no_action_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "required_no_action_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class RestrictChild as table restrict_child +-- +CREATE TABLE "restrict_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "restrict_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "restrict_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class SharedChild as table shared_child +-- +CREATE TABLE "shared_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "flavor" TEXT NOT NULL DEFAULT ('plain'), + "parentId" BLOB, + CONSTRAINT "shared_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "shared_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "shared_parent" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class SharedParent as table shared_parent +-- +CREATE TABLE "shared_parent" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "shared_parent_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class Town as table town +-- +CREATE TABLE "town" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cityId" BLOB, + "mayorId" BLOB, + CONSTRAINT "town_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "town_fk_1" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "town_fk_2" FOREIGN KEY ("mayorId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class Types as table types +-- +CREATE TABLE "types" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "aBool" INTEGER NOT NULL, + "aDateTime" INTEGER NOT NULL, + "aText" TEXT NOT NULL, + "anInt" INTEGER NOT NULL, + "anInt64" TEXT NOT NULL, + "aReal" REAL NOT NULL, + "aBlob" BLOB NOT NULL, + "anEnum" INTEGER, + "optionalText" TEXT, + "optionalUuid" BLOB, + "parentId" BLOB, + "jsonDocument" TEXT, + "jsonbDocument" BLOB, + "jsonbNumbers" BLOB, + CONSTRAINT "types_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "types_fk_1" FOREIGN KEY ("parentId") REFERENCES "types" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "types_a_text_idx" ON "types" ("aText"); + + +-- +-- Class Unique as table unique +-- +CREATE TABLE "unique" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "unique_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique__spaceId__name__unique_idx" ON "unique" ("spaceId", "name"); + + +-- +-- Class UniqueCascadeChild as table unique_cascade_child +-- +CREATE TABLE "unique_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_cascade_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_cascade_child__spaceId__name__unique_idx" ON "unique_cascade_child" ("spaceId", "name"); + + +-- +-- Class UniqueCascadeReference as table unique_cascade_reference +-- +CREATE TABLE "unique_cascade_reference" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_cascade_reference_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_cascade_reference_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_cascade_reference__parentId__unique_idx" ON "unique_cascade_reference" ("parentId"); + + +-- +-- Class UniqueComposite as table unique_composite +-- +CREATE TABLE "unique_composite" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "scope" TEXT NOT NULL, + "value" TEXT NOT NULL, + CONSTRAINT "unique_composite_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_composite__spaceId__scope__value__unique_idx" ON "unique_composite" ("spaceId", "scope", "value"); + + +-- +-- Class UniqueDiscriminator as table unique_discriminator +-- +CREATE TABLE "unique_discriminator" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "categoryId" INTEGER NOT NULL, + "name" TEXT NOT NULL, + CONSTRAINT "unique_discriminator_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_discriminator__spaceId__categoryId__name__unique_idx" ON "unique_discriminator" ("spaceId", "categoryId", "name"); + + +-- +-- Class UniqueFkPair as table unique_fk_pair +-- +CREATE TABLE "unique_fk_pair" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "leftId" BLOB, + "rightId" BLOB, + CONSTRAINT "unique_fk_pair_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_fk_pair_fk_1" FOREIGN KEY ("leftId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "unique_fk_pair_fk_2" FOREIGN KEY ("rightId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_fk_pair_parents" ON "unique_fk_pair" ("leftId", "rightId"); + + +-- +-- Class UniqueMixedFk as table unique_mixed_fk +-- +CREATE TABLE "unique_mixed_fk" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_mixed_fk_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_mixed_fk_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_mixed_fk_name_parent" ON "unique_mixed_fk" ("spaceId", "name", "parentId"); + + +-- +-- Class UniqueNoRelease as table unique_no_release +-- +CREATE TABLE "unique_no_release" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "categoryId" INTEGER NOT NULL, + CONSTRAINT "unique_no_release_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_no_release__spaceId__categoryId__unique_idx" ON "unique_no_release" ("spaceId", "categoryId"); + + +-- +-- Class UniqueNullable as table unique_nullable +-- +CREATE TABLE "unique_nullable" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "value" INTEGER, + CONSTRAINT "unique_nullable_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_nullable__spaceId__value__unique_idx" ON "unique_nullable" ("spaceId", "value"); + + +-- +-- Class UniqueOverlapping as table unique_overlapping +-- +CREATE TABLE "unique_overlapping" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "first" TEXT NOT NULL, + "second" TEXT NOT NULL, + "third" TEXT NOT NULL, + CONSTRAINT "unique_overlapping_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_overlapping_first_second" ON "unique_overlapping" ("spaceId", "first", "second"); +CREATE UNIQUE INDEX "unique_overlapping_second_third" ON "unique_overlapping" ("spaceId", "second", "third"); + + +-- +-- Class UniqueSetDefaultChild as table unique_set_default_child +-- +CREATE TABLE "unique_set_default_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB DEFAULT (X'550e8400e29b41d4a716446655440000'), + CONSTRAINT "unique_set_default_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_set_default_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "town" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_set_default_child__parentId__unique_idx" ON "unique_set_default_child" ("parentId"); + + +-- +-- Class UniqueSetNullChild as table unique_set_null_child +-- +CREATE TABLE "unique_set_null_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_set_null_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_set_null_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_set_null_child__parentId__unique_idx" ON "unique_set_null_child" ("parentId"); + + +-- +-- Class UniqueUuid as table unique_uuid +-- +CREATE TABLE "unique_uuid" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "value" BLOB NOT NULL, + CONSTRAINT "unique_uuid_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_uuid__spaceId__value__unique_idx" ON "unique_uuid" ("spaceId", "value"); + + +-- +-- Class CloudStorageEntry as table serverpod_cloud_storage +-- +CREATE TABLE "serverpod_cloud_storage" ( + "id" INTEGER PRIMARY KEY, + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "addedTime" INTEGER NOT NULL, + "expiration" INTEGER, + "byteData" BLOB NOT NULL, + "verified" INTEGER NOT NULL, + "contentType" TEXT, + "cacheControl" TEXT, + "contentDisposition" TEXT, + "contentEncoding" TEXT, + "customMetadata" TEXT +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_path_idx" ON "serverpod_cloud_storage" ("storageId", "path"); +CREATE INDEX "serverpod_cloud_storage_expiration" ON "serverpod_cloud_storage" ("expiration"); + + +-- +-- Class CloudStorageDirectDownloadEntry as table serverpod_cloud_storage_direct_download +-- +CREATE TABLE "serverpod_cloud_storage_direct_download" ( + "id" INTEGER PRIMARY KEY, + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "expiration" INTEGER NOT NULL, + "authKey" TEXT NOT NULL, + "downloadFileName" TEXT, + "contentType" TEXT +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_download_auth_key" ON "serverpod_cloud_storage_direct_download" ("authKey"); +CREATE INDEX "serverpod_cloud_storage_direct_download_expiration" ON "serverpod_cloud_storage_direct_download" ("expiration"); + + +-- +-- Class CloudStorageDirectUploadEntry as table serverpod_cloud_storage_direct_upload +-- +CREATE TABLE "serverpod_cloud_storage_direct_upload" ( + "id" INTEGER PRIMARY KEY, + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "expiration" INTEGER NOT NULL, + "authKey" TEXT NOT NULL, + "maxFileSize" INTEGER NOT NULL DEFAULT (10485760), + "contentLength" INTEGER, + "preventOverwrite" INTEGER NOT NULL DEFAULT (0), + "contentType" TEXT, + "cacheControl" TEXT, + "contentDisposition" TEXT, + "contentEncoding" TEXT, + "customMetadata" TEXT +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" ("storageId", "path"); + + +-- +-- Class FutureCallEntry as table serverpod_future_call +-- +CREATE TABLE "serverpod_future_call" ( + "id" INTEGER PRIMARY KEY, + "name" TEXT NOT NULL, + "time" INTEGER NOT NULL, + "serializedObject" TEXT, + "serverId" TEXT NOT NULL, + "identifier" TEXT, + "scheduling" TEXT +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_future_call_time_idx" ON "serverpod_future_call" ("time"); +CREATE INDEX "serverpod_future_call_serverId_idx" ON "serverpod_future_call" ("serverId"); +CREATE INDEX "serverpod_future_call_identifier_idx" ON "serverpod_future_call" ("identifier"); + + +-- +-- Class FutureCallClaimEntry as table serverpod_future_call_claim +-- +CREATE TABLE "serverpod_future_call_claim" ( + "id" INTEGER PRIMARY KEY, + "futureCallId" INTEGER, + "lastHeartbeatTime" INTEGER NOT NULL, + CONSTRAINT "serverpod_future_call_claim_fk_0" FOREIGN KEY ("futureCallId") REFERENCES "serverpod_future_call" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "future_call_unique_idx" ON "serverpod_future_call_claim" ("futureCallId"); + + +-- +-- Class ServerHealthConnectionInfo as table serverpod_health_connection_info +-- +CREATE TABLE "serverpod_health_connection_info" ( + "id" INTEGER PRIMARY KEY, + "serverId" TEXT NOT NULL, + "timestamp" INTEGER NOT NULL, + "active" INTEGER NOT NULL, + "closing" INTEGER NOT NULL, + "idle" INTEGER NOT NULL, + "granularity" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_health_connection_info_timestamp_idx" ON "serverpod_health_connection_info" ("timestamp", "serverId", "granularity"); + + +-- +-- Class ServerHealthMetric as table serverpod_health_metric +-- +CREATE TABLE "serverpod_health_metric" ( + "id" INTEGER PRIMARY KEY, + "name" TEXT NOT NULL, + "serverId" TEXT NOT NULL, + "timestamp" INTEGER NOT NULL, + "isHealthy" INTEGER NOT NULL, + "value" REAL NOT NULL, + "granularity" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_health_metric_timestamp_idx" ON "serverpod_health_metric" ("timestamp", "serverId", "name", "granularity"); + + +-- +-- Class LogEntry as table serverpod_log +-- +CREATE TABLE "serverpod_log" ( + "id" INTEGER PRIMARY KEY, + "sessionLogId" INTEGER NOT NULL, + "messageId" INTEGER, + "reference" TEXT, + "serverId" TEXT NOT NULL, + "time" INTEGER NOT NULL, + "logLevel" INTEGER NOT NULL, + "message" TEXT NOT NULL, + "error" TEXT, + "stackTrace" TEXT, + "order" INTEGER NOT NULL, + CONSTRAINT "serverpod_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_log_sessionLogId_idx" ON "serverpod_log" ("sessionLogId", "order"); + + +-- +-- Class MessageLogEntry as table serverpod_message_log +-- +CREATE TABLE "serverpod_message_log" ( + "id" INTEGER PRIMARY KEY, + "sessionLogId" INTEGER NOT NULL, + "serverId" TEXT NOT NULL, + "messageId" INTEGER NOT NULL, + "endpoint" TEXT NOT NULL, + "messageName" TEXT NOT NULL, + "duration" REAL NOT NULL, + "error" TEXT, + "stackTrace" TEXT, + "slow" INTEGER NOT NULL, + "order" INTEGER NOT NULL, + CONSTRAINT "serverpod_message_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_message_log_sessionLogId_idx" ON "serverpod_message_log" ("sessionLogId", "order"); + + +-- +-- Class MethodInfo as table serverpod_method +-- +CREATE TABLE "serverpod_method" ( + "id" INTEGER PRIMARY KEY, + "endpoint" TEXT NOT NULL, + "method" TEXT NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_method_endpoint_method_idx" ON "serverpod_method" ("endpoint", "method"); + + +-- +-- Class DatabaseMigrationVersion as table serverpod_migrations +-- +CREATE TABLE "serverpod_migrations" ( + "id" INTEGER PRIMARY KEY, + "module" TEXT NOT NULL, + "version" TEXT NOT NULL, + "timestamp" INTEGER +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_migrations_ids" ON "serverpod_migrations" ("module"); + + +-- +-- Class QueryLogEntry as table serverpod_query_log +-- +CREATE TABLE "serverpod_query_log" ( + "id" INTEGER PRIMARY KEY, + "serverId" TEXT NOT NULL, + "sessionLogId" INTEGER NOT NULL, + "messageId" INTEGER, + "query" TEXT NOT NULL, + "duration" REAL NOT NULL, + "numRows" INTEGER, + "error" TEXT, + "stackTrace" TEXT, + "slow" INTEGER NOT NULL, + "order" INTEGER NOT NULL, + CONSTRAINT "serverpod_query_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_query_log_sessionLogId_idx" ON "serverpod_query_log" ("sessionLogId", "order"); + + +-- +-- Class ReadWriteTestEntry as table serverpod_readwrite_test +-- +CREATE TABLE "serverpod_readwrite_test" ( + "id" INTEGER PRIMARY KEY, + "number" INTEGER NOT NULL +) STRICT; + + +-- +-- Class RuntimeSettings as table serverpod_runtime_settings +-- +CREATE TABLE "serverpod_runtime_settings" ( + "id" INTEGER PRIMARY KEY, + "logSettings" TEXT NOT NULL, + "logSettingsOverrides" TEXT NOT NULL, + "logServiceCalls" INTEGER NOT NULL, + "logMalformedCalls" INTEGER NOT NULL +) STRICT; + + +-- +-- Class SessionLogEntry as table serverpod_session_log +-- +CREATE TABLE "serverpod_session_log" ( + "id" INTEGER PRIMARY KEY, + "serverId" TEXT NOT NULL, + "time" INTEGER NOT NULL, + "module" TEXT, + "endpoint" TEXT, + "method" TEXT, + "duration" REAL, + "numQueries" INTEGER, + "slow" INTEGER, + "error" TEXT, + "stackTrace" TEXT, + "authenticatedUserId" INTEGER, + "userId" TEXT, + "isOpen" INTEGER, + "touched" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_session_log_serverid_idx" ON "serverpod_session_log" ("serverId"); +CREATE INDEX "serverpod_session_log_time_idx" ON "serverpod_session_log" ("time"); +CREATE INDEX "serverpod_session_log_touched_idx" ON "serverpod_session_log" ("touched"); +CREATE INDEX "serverpod_session_log_isopen_idx" ON "serverpod_session_log" ("isOpen"); + + +-- +-- Class RefreshToken as table serverpod_auth_core_jwt_refresh_token +-- +CREATE TABLE "serverpod_auth_core_jwt_refresh_token" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "authUserId" BLOB NOT NULL, + "scopeNames" TEXT NOT NULL, + "extraClaims" TEXT, + "method" TEXT NOT NULL, + "fixedSecret" BLOB NOT NULL, + "rotatingSecretHash" TEXT NOT NULL, + "lastUpdatedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + CONSTRAINT "serverpod_auth_core_jwt_refresh_token_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_auth_core_jwt_refresh_token_last_updated_at" ON "serverpod_auth_core_jwt_refresh_token" ("lastUpdatedAt"); + + +-- +-- Class UserProfile as table serverpod_auth_core_profile +-- +CREATE TABLE "serverpod_auth_core_profile" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "authUserId" BLOB NOT NULL, + "userName" TEXT, + "fullName" TEXT, + "email" TEXT, + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "imageId" BLOB, + CONSTRAINT "serverpod_auth_core_profile_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "serverpod_auth_core_profile_fk_1" FOREIGN KEY ("imageId") REFERENCES "serverpod_auth_core_profile_image" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_auth_profile_user_profile_email_auth_user_id" ON "serverpod_auth_core_profile" ("authUserId"); + + +-- +-- Class UserProfileImage as table serverpod_auth_core_profile_image +-- +CREATE TABLE "serverpod_auth_core_profile_image" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "userProfileId" BLOB NOT NULL, + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "url" TEXT NOT NULL, + CONSTRAINT "serverpod_auth_core_profile_image_fk_0" FOREIGN KEY ("userProfileId") REFERENCES "serverpod_auth_core_profile" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class ServerSideSession as table serverpod_auth_core_session +-- +CREATE TABLE "serverpod_auth_core_session" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "authUserId" BLOB NOT NULL, + "scopeNames" TEXT NOT NULL, + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "lastUsedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "expiresAt" INTEGER, + "expireAfterUnusedFor" INTEGER, + "sessionKeyHash" BLOB NOT NULL, + "sessionKeySalt" BLOB NOT NULL, + "method" TEXT NOT NULL, + CONSTRAINT "serverpod_auth_core_session_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class AuthUser as table serverpod_auth_core_user +-- +CREATE TABLE "serverpod_auth_core_user" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "createdAt" INTEGER NOT NULL, + "scopeNames" TEXT NOT NULL, + "blocked" INTEGER NOT NULL +) STRICT; + + +-- +-- Class CrdtDataAttemptedValue as table crdt_data_attempted_value +-- +CREATE TABLE "crdt_data_attempted_value" ( + "id" INTEGER PRIMARY KEY, + "fieldId" INTEGER NOT NULL, + "value" BLOB NOT NULL, + "projectionReason" INTEGER NOT NULL, + CONSTRAINT "crdt_data_attempted_value_fk_0" FOREIGN KEY ("fieldId") REFERENCES "crdt_data_fields" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_attempted_value__fieldId__unique_idx" ON "crdt_data_attempted_value" ("fieldId"); + + +-- +-- Class CrdtDataField as table crdt_data_fields +-- +CREATE TABLE "crdt_data_fields" ( + "id" INTEGER PRIMARY KEY, + "hlcDatetime" INTEGER NOT NULL, + "hlcCounter" INTEGER NOT NULL, + "rowId" INTEGER NOT NULL, + "columnId" INTEGER NOT NULL, + "nodeId" INTEGER NOT NULL, + CONSTRAINT "crdt_data_fields_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_fields_fk_1" FOREIGN KEY ("columnId") REFERENCES "crdt_schema_columns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_fields_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_fields_row_column_idx" ON "crdt_data_fields" ("rowId", "columnId"); + + +-- +-- Class CrdtDataRow as table crdt_data_rows +-- +CREATE TABLE "crdt_data_rows" ( + "id" INTEGER PRIMARY KEY, + "hlcDatetime" INTEGER NOT NULL, + "hlcCounter" INTEGER NOT NULL, + "spaceId" INTEGER NOT NULL, + "tblId" INTEGER NOT NULL, + "uuidRowId" BLOB NOT NULL, + "nodeId" INTEGER NOT NULL, + "visibility" INTEGER NOT NULL DEFAULT (0), + CONSTRAINT "crdt_data_rows_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_rows_fk_1" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_rows_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_rows_space_tbl_row_idx" ON "crdt_data_rows" ("spaceId", "tblId", "uuidRowId"); + + +-- +-- Class CrdtDataDeleted as table crdt_data_tombstone +-- +CREATE TABLE "crdt_data_tombstone" ( + "id" INTEGER PRIMARY KEY, + "hlcDatetime" INTEGER NOT NULL, + "hlcCounter" INTEGER NOT NULL, + "rowId" INTEGER NOT NULL, + "nodeId" INTEGER NOT NULL, + "clFlag" INTEGER NOT NULL, + "reason" INTEGER NOT NULL, + CONSTRAINT "crdt_data_tombstone_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_tombstone_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_tombstone_row_idx" ON "crdt_data_tombstone" ("rowId"); + + +-- +-- Class CrdtNode as table crdt_nodes +-- +CREATE TABLE "crdt_nodes" ( + "id" INTEGER PRIMARY KEY, + "uuidNodeId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "lastHlc" BLOB +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_nodes__uuidNodeId__unique_idx" ON "crdt_nodes" ("uuidNodeId"); + + +-- +-- Class CrdtSchemaColumn as table crdt_schema_columns +-- +CREATE TABLE "crdt_schema_columns" ( + "id" INTEGER PRIMARY KEY, + "tblId" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "columnType" TEXT NOT NULL, + "dartType" TEXT NOT NULL, + "isNullable" INTEGER NOT NULL, + CONSTRAINT "crdt_schema_columns_fk_0" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_schema_columns_table_column_idx" ON "crdt_schema_columns" ("tblId", "name"); + + +-- +-- Class CrdtSchemaTable as table crdt_schema_tables +-- +CREATE TABLE "crdt_schema_tables" ( + "id" INTEGER PRIMARY KEY, + "name" TEXT NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_schema_tables__name__unique_idx" ON "crdt_schema_tables" ("name"); + + +-- +-- Class OfflineSyncIntegrityViolation as table offline_sync_integrity_violations +-- +CREATE TABLE "offline_sync_integrity_violations" ( + "id" INTEGER PRIMARY KEY, + "type" TEXT NOT NULL, + "domainTableName" TEXT NOT NULL, + "uuidRowId" BLOB NOT NULL, + "ownerSpaceUuid" BLOB, + "incomingSpaceUuid" BLOB NOT NULL, + "operation" TEXT NOT NULL, + "uuidNodeId" BLOB, + "crdtDataRowId" INTEGER, + "hlcDatetime" INTEGER, + "hlcCounter" INTEGER, + "firstSeenAt" INTEGER NOT NULL, + "lastSeenAt" INTEGER NOT NULL, + "occurrences" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_integrity_violations_key_idx" ON "offline_sync_integrity_violations" ("type", "operation", "domainTableName", "uuidRowId", "ownerSpaceUuid", "incomingSpaceUuid"); + + +-- +-- Class OfflineSyncSpaceMember as table offline_sync_space_members +-- +CREATE TABLE "offline_sync_space_members" ( + "id" INTEGER PRIMARY KEY, + "spaceId" INTEGER NOT NULL, + "userUuid" BLOB NOT NULL, + "role" TEXT NOT NULL, + CONSTRAINT "offline_sync_space_members_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_space_member_unique_idx" ON "offline_sync_space_members" ("userUuid", "spaceId"); + + +-- +-- Class OfflineSyncSpaceNode as table offline_sync_space_nodes +-- +CREATE TABLE "offline_sync_space_nodes" ( + "id" INTEGER PRIMARY KEY, + "spaceId" INTEGER NOT NULL, + "nodeId" INTEGER NOT NULL, + "lastReceivedHlc" BLOB, + CONSTRAINT "offline_sync_space_nodes_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "offline_sync_space_nodes_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_space_node_unique_idx" ON "offline_sync_space_nodes" ("spaceId", "nodeId"); + + +-- +-- Class OfflineSyncSpace as table offline_sync_spaces +-- +CREATE TABLE "offline_sync_spaces" ( + "id" INTEGER PRIMARY KEY, + "uuidSpaceId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "currentNodeId" INTEGER, + CONSTRAINT "offline_sync_spaces_fk_0" FOREIGN KEY ("currentNodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_spaces__uuidSpaceId__unique_idx" ON "offline_sync_spaces" ("uuidSpaceId"); + + +-- +-- STORE COLUMN TYPES FOR MIGRATIONS +-- +DROP TABLE IF EXISTS "serverpod_sqlite_schema"; + +CREATE TABLE "serverpod_sqlite_schema" ( + "table_name" TEXT NOT NULL, + "column_name" TEXT NOT NULL, + "column_type" TEXT NOT NULL, + "column_vector_dimension" INTEGER, + PRIMARY KEY ("table_name", "column_name") +); + +INSERT INTO "serverpod_sqlite_schema" VALUES + ('address', 'id', 'uuid', NULL), + ('address', 'inhabitantId', 'uuid', NULL), + ('city', 'id', 'uuid', NULL), + ('company', 'id', 'uuid', NULL), + ('company', 'townId', 'uuid', NULL), + ('fk_chain_cascade_middle', 'id', 'uuid', NULL), + ('fk_chain_cascade_middle', 'rootId', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'id', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_root', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_middle', 'id', 'uuid', NULL), + ('fk_chain_set_null_middle', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'setNullMiddleId', 'uuid', NULL), + ('organization', 'id', 'uuid', NULL), + ('organization', 'cityId', 'uuid', NULL), + ('person', 'id', 'uuid', NULL), + ('person', 'organizationId', 'uuid', NULL), + ('person', 'oldCompanyId', 'uuid', NULL), + ('person', 'cityId', 'uuid', NULL), + ('required_cascade_child', 'id', 'uuid', NULL), + ('required_cascade_child', 'parentId', 'uuid', NULL), + ('required_no_action_child', 'id', 'uuid', NULL), + ('required_no_action_child', 'parentId', 'uuid', NULL), + ('restrict_child', 'id', 'uuid', NULL), + ('restrict_child', 'parentId', 'uuid', NULL), + ('shared_child', 'id', 'uuid', NULL), + ('shared_child', 'parentId', 'uuid', NULL), + ('shared_parent', 'id', 'uuid', NULL), + ('town', 'id', 'uuid', NULL), + ('town', 'cityId', 'uuid', NULL), + ('town', 'mayorId', 'uuid', NULL), + ('types', 'id', 'uuid', NULL), + ('types', 'aBool', 'boolean', NULL), + ('types', 'aDateTime', 'timestampWithoutTimeZone', NULL), + ('types', 'optionalUuid', 'uuid', NULL), + ('types', 'parentId', 'uuid', NULL), + ('types', 'jsonDocument', 'json', NULL), + ('types', 'jsonbDocument', 'jsonb', NULL), + ('types', 'jsonbNumbers', 'jsonb', NULL), + ('unique', 'id', 'uuid', NULL), + ('unique_cascade_child', 'id', 'uuid', NULL), + ('unique_cascade_child', 'parentId', 'uuid', NULL), + ('unique_cascade_reference', 'id', 'uuid', NULL), + ('unique_cascade_reference', 'parentId', 'uuid', NULL), + ('unique_composite', 'id', 'uuid', NULL), + ('unique_discriminator', 'id', 'uuid', NULL), + ('unique_fk_pair', 'id', 'uuid', NULL), + ('unique_fk_pair', 'leftId', 'uuid', NULL), + ('unique_fk_pair', 'rightId', 'uuid', NULL), + ('unique_mixed_fk', 'id', 'uuid', NULL), + ('unique_mixed_fk', 'parentId', 'uuid', NULL), + ('unique_no_release', 'id', 'uuid', NULL), + ('unique_nullable', 'id', 'uuid', NULL), + ('unique_overlapping', 'id', 'uuid', NULL), + ('unique_set_default_child', 'id', 'uuid', NULL), + ('unique_set_default_child', 'parentId', 'uuid', NULL), + ('unique_set_null_child', 'id', 'uuid', NULL), + ('unique_set_null_child', 'parentId', 'uuid', NULL), + ('unique_uuid', 'id', 'uuid', NULL), + ('unique_uuid', 'value', 'uuid', NULL), + ('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'verified', 'boolean', NULL), + ('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL), + ('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_future_call', 'scheduling', 'json', NULL), + ('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'isHealthy', 'boolean', NULL), + ('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_message_log', 'slow', 'boolean', NULL), + ('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_query_log', 'slow', 'boolean', NULL), + ('serverpod_runtime_settings', 'logSettings', 'json', NULL), + ('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL), + ('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL), + ('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL), + ('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_session_log', 'slow', 'boolean', NULL), + ('serverpod_session_log', 'isOpen', 'boolean', NULL), + ('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'imageId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'id', 'uuid', NULL), + ('serverpod_auth_core_session', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_session', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'id', 'uuid', NULL), + ('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_user', 'blocked', 'boolean', NULL), + ('crdt_data_attempted_value', 'value', 'jsonb', NULL), + ('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'uuidRowId', 'uuid', NULL), + ('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_nodes', 'uuidNodeId', 'uuid', NULL), + ('crdt_nodes', 'lastHlc', 'jsonb', NULL), + ('crdt_schema_columns', 'isNullable', 'boolean', NULL), + ('offline_sync_integrity_violations', 'uuidRowId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'ownerSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'incomingSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_space_members', 'userUuid', 'uuid', NULL), + ('offline_sync_space_nodes', 'lastReceivedHlc', 'jsonb', NULL), + ('offline_sync_spaces', 'uuidSpaceId', 'uuid', NULL); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync_test +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync_test', '20261007215503877', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261007215503877', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod', '20260824182259319', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260824182259319', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_auth_core +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_auth_core', '20260924105232991', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260924105232991', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync', '20260914143806119', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260914143806119', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + + +COMMIT; +'''; +} diff --git a/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.json b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.json new file mode 100644 index 0000000..cdaaf13 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261007215503877/migration.json @@ -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 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_client/lib/migrations/migration_registry.dart b/test/serverpod_offline_sync_test_client/lib/migrations/migration_registry.dart index c93a415..19efbe3 100644 --- a/test/serverpod_offline_sync_test_client/lib/migrations/migration_registry.dart +++ b/test/serverpod_offline_sync_test_client/lib/migrations/migration_registry.dart @@ -15,6 +15,7 @@ part '20260907170602693/migration.dart'; part '20260914144112288/migration.dart'; part '20260914165608984/migration.dart'; part '20260930185557154/migration.dart'; +part '20261007215503877/migration.dart'; /// Migration registry for the client-side database. class MigrationRegistry { @@ -32,6 +33,7 @@ class MigrationRegistry { _Migration20260914144112288(), _Migration20260914165608984(), _Migration20260930185557154(), + _Migration20261007215503877(), ]; /// List of all client-side database migration versions. diff --git a/test/serverpod_offline_sync_test_client/lib/src/protocol/nullable_set_default_child.dart b/test/serverpod_offline_sync_test_client/lib/src/protocol/nullable_set_default_child.dart deleted file mode 100644 index cab97dd..0000000 --- a/test/serverpod_offline_sync_test_client/lib/src/protocol/nullable_set_default_child.dart +++ /dev/null @@ -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 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 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 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? where, - int? limit, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? 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 { - NullableSetDefaultChildUpdateTable(super.table); - - _isd.ColumnValue spaceId(int? value) => _isd.ColumnValue( - table.spaceId, - value, - ); - - _isd.ColumnValue 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 get includes => {'parent': _parent}; - - @override - _isd.Table<_isc.UuidValue?> get table => NullableSetDefaultChild.t; -} - -class NullableSetDefaultChildIncludeList extends _isd.IncludeList { - NullableSetDefaultChildIncludeList._({ - _isd.WhereExpressionBuilder? where, - super.limit, - super.offset, - super.orderBy, - super.orderByList, - super.include, - }) { - super.where = where?.call(NullableSetDefaultChild.t); - } - - @override - Map 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> find( - _isd.DatabaseSession session, { - _isd.WhereExpressionBuilder? where, - int? limit, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - NullableSetDefaultChildInclude? include, - _isd.LockMode? lockMode, - _isd.LockBehavior? lockBehavior, - }) async { - return session.db.find( - 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 findFirstRow( - _isd.DatabaseSession session, { - _isd.WhereExpressionBuilder? where, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - NullableSetDefaultChildInclude? include, - _isd.LockMode? lockMode, - _isd.LockBehavior? lockBehavior, - }) async { - return session.db.findFirstRow( - 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 findById( - _isd.DatabaseSession session, - _isc.UuidValue id, { - _isd.Transaction? transaction, - NullableSetDefaultChildInclude? include, - _isd.LockMode? lockMode, - _isd.LockBehavior? lockBehavior, - }) async { - return session.db.findById( - 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> insert( - _isd.DatabaseSession session, - List rows, { - _isd.Transaction? transaction, - bool ignoreConflicts = false, - bool noReturn = false, - }) async { - return session.db.insert( - 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 insertRow( - _isd.DatabaseSession session, - NullableSetDefaultChild row, { - _isd.Transaction? transaction, - }) async { - return session.db.insertRow( - 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> upsert( - _isd.DatabaseSession session, - List rows, { - required _isd.ColumnSelections - conflictColumns, - _isd.ColumnSelections? updateColumns, - _isd.WhereExpressionBuilder? updateWhere, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.upsert( - 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 upsertRow( - _isd.DatabaseSession session, - NullableSetDefaultChild row, { - required _isd.ColumnSelections - conflictColumns, - _isd.ColumnSelections? updateColumns, - _isd.WhereExpressionBuilder? updateWhere, - _isd.Transaction? transaction, - }) async { - return session.db.upsertRow( - 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> update( - _isd.DatabaseSession session, - List rows, { - _isd.ColumnSelections? columns, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.update( - 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 updateRow( - _isd.DatabaseSession session, - NullableSetDefaultChild row, { - _isd.ColumnSelections? columns, - _isd.Transaction? transaction, - }) async { - return session.db.updateRow( - 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 updateById( - _isd.DatabaseSession session, - _isc.UuidValue id, { - required _isd.ColumnValueListBuilder - columnValues, - _isd.Transaction? transaction, - }) async { - return session.db.updateById( - 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> updateWhere( - _isd.DatabaseSession session, { - required _isd.ColumnValueListBuilder - columnValues, - required _isd.WhereExpressionBuilder where, - int? limit, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.updateWhere( - 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> delete( - _isd.DatabaseSession session, - List rows, { - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.delete( - rows, - orderBy: orderBy?.call(NullableSetDefaultChild.t), - orderByList: orderByList?.call(NullableSetDefaultChild.t), - transaction: transaction, - noReturn: noReturn, - ); - } - - /// Deletes a single [NullableSetDefaultChild]. - Future deleteRow( - _isd.DatabaseSession session, - NullableSetDefaultChild row, { - _isd.Transaction? transaction, - }) async { - return session.db.deleteRow( - 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> deleteWhere( - _isd.DatabaseSession session, { - required _isd.WhereExpressionBuilder where, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.deleteWhere( - 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 count( - _isd.DatabaseSession session, { - _isd.WhereExpressionBuilder? where, - int? limit, - _isd.Transaction? transaction, - }) async { - return session.db.count( - where: where?.call(NullableSetDefaultChild.t), - limit: limit, - transaction: transaction, - ); - } - - /// Acquires row-level locks on [NullableSetDefaultChild] rows matching the [where] expression. - Future lockRows( - _isd.DatabaseSession session, { - required _isd.WhereExpressionBuilder where, - required _isd.LockMode lockMode, - required _isd.Transaction transaction, - _isd.LockBehavior lockBehavior = _isd.LockBehavior.wait, - }) async { - return session.db.lockRows( - 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 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, - 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 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, - columns: [NullableSetDefaultChild.t.parentId], - transaction: transaction, - ); - } -} diff --git a/test/serverpod_offline_sync_test_client/lib/src/protocol/protocol.dart b/test/serverpod_offline_sync_test_client/lib/src/protocol/protocol.dart index f729792..a547d1c 100644 --- a/test/serverpod_offline_sync_test_client/lib/src/protocol/protocol.dart +++ b/test/serverpod_offline_sync_test_client/lib/src/protocol/protocol.dart @@ -31,12 +31,10 @@ import 'fk_chain/set_null_cascade_child.dart' as _ideurard; import 'fk_chain/set_null_middle.dart' as _icv70ksq; import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0; import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw; -import 'nullable_set_default_child.dart' as _i6rvg9xd; import 'organization.dart' as _irjtvpke; import 'person.dart' as _iensfz4m; import 'required_cascade_child.dart' as _ivx9jyda; import 'required_no_action_child.dart' as _itlfbi2f; -import 'required_set_null_child.dart' as _i1huw131; import 'restrict_child.dart' as _isrf0aof; import 'sync_document.dart' as _ix6xayzv; import 'town.dart' as _iytblq2r; @@ -67,12 +65,10 @@ export 'fk_chain/set_null_cascade_child.dart'; export 'fk_chain/set_null_middle.dart'; export 'fk_chain/set_null_restrict_child.dart'; export 'fk_chain/set_null_set_null_child.dart'; -export 'nullable_set_default_child.dart'; export 'organization.dart'; export 'person.dart'; export 'required_cascade_child.dart'; export 'required_no_action_child.dart'; -export 'required_set_null_child.dart'; export 'restrict_child.dart'; export 'sync_document.dart'; export 'town.dart'; @@ -778,64 +774,6 @@ class Protocol extends _isd.DatabaseSerializationManager { indexes: [], managed: true, ), - _isd.TableDefinition( - name: 'nullable_set_default_child', - dartName: 'NullableSetDefaultChild', - schema: 'public', - module: 'serverpod_offline_sync_test', - columns: [ - _isd.ColumnDefinition( - name: 'id', - columnType: _isd.ColumnType.uuid, - isNullable: false, - dartType: 'UuidValue?', - columnDefault: 'random_v7', - ), - _isd.ColumnDefinition( - name: 'spaceId', - columnType: _isd.ColumnType.bigint, - isNullable: true, - dartType: 'int?', - ), - _isd.ColumnDefinition( - name: 'name', - columnType: _isd.ColumnType.text, - isNullable: false, - dartType: 'String', - ), - _isd.ColumnDefinition( - name: 'parentId', - columnType: _isd.ColumnType.uuid, - isNullable: true, - dartType: 'UuidValue?', - ), - ], - foreignKeys: [ - _isd.ForeignKeyDefinition( - constraintName: 'nullable_set_default_child_fk_0', - columns: ['spaceId'], - referenceTable: 'offline_sync_spaces', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isd.ForeignKeyAction.noAction, - onDelete: _isd.ForeignKeyAction.cascade, - matchType: null, - ), - _isd.ForeignKeyDefinition( - constraintName: 'nullable_set_default_child_fk_1', - columns: ['parentId'], - referenceTable: 'person', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isd.ForeignKeyAction.noAction, - onDelete: _isd.ForeignKeyAction.setDefault, - matchType: null, - deferrable: _isd.DeferrableConstraint.initiallyDeferred, - ), - ], - indexes: [], - managed: true, - ), _isd.TableDefinition( name: 'organization', dartName: 'Organization', @@ -1107,64 +1045,6 @@ class Protocol extends _isd.DatabaseSerializationManager { indexes: [], managed: true, ), - _isd.TableDefinition( - name: 'required_set_null_child', - dartName: 'RequiredSetNullChild', - schema: 'public', - module: 'serverpod_offline_sync_test', - columns: [ - _isd.ColumnDefinition( - name: 'id', - columnType: _isd.ColumnType.uuid, - isNullable: false, - dartType: 'UuidValue?', - columnDefault: 'random_v7', - ), - _isd.ColumnDefinition( - name: 'spaceId', - columnType: _isd.ColumnType.bigint, - isNullable: true, - dartType: 'int?', - ), - _isd.ColumnDefinition( - name: 'name', - columnType: _isd.ColumnType.text, - isNullable: false, - dartType: 'String', - ), - _isd.ColumnDefinition( - name: 'parentId', - columnType: _isd.ColumnType.uuid, - isNullable: false, - dartType: 'UuidValue', - ), - ], - foreignKeys: [ - _isd.ForeignKeyDefinition( - constraintName: 'required_set_null_child_fk_0', - columns: ['spaceId'], - referenceTable: 'offline_sync_spaces', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isd.ForeignKeyAction.noAction, - onDelete: _isd.ForeignKeyAction.cascade, - matchType: null, - ), - _isd.ForeignKeyDefinition( - constraintName: 'required_set_null_child_fk_1', - columns: ['parentId'], - referenceTable: 'person', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isd.ForeignKeyAction.noAction, - onDelete: _isd.ForeignKeyAction.setNull, - matchType: null, - deferrable: _isd.DeferrableConstraint.initiallyDeferred, - ), - ], - indexes: [], - managed: true, - ), _isd.TableDefinition( name: 'restrict_child', dartName: 'RestrictChild', @@ -2455,9 +2335,6 @@ class Protocol extends _isd.DatabaseSerializationManager { if (t == _ihkyqxiw.FkChainSetNullSetNullChild) { return _ihkyqxiw.FkChainSetNullSetNullChild.fromJson(data) as T; } - if (t == _i6rvg9xd.NullableSetDefaultChild) { - return _i6rvg9xd.NullableSetDefaultChild.fromJson(data) as T; - } if (t == _irjtvpke.Organization) { return _irjtvpke.Organization.fromJson(data) as T; } @@ -2470,9 +2347,6 @@ class Protocol extends _isd.DatabaseSerializationManager { if (t == _itlfbi2f.RequiredNoActionChild) { return _itlfbi2f.RequiredNoActionChild.fromJson(data) as T; } - if (t == _i1huw131.RequiredSetNullChild) { - return _i1huw131.RequiredSetNullChild.fromJson(data) as T; - } if (t == _isrf0aof.RestrictChild) { return _isrf0aof.RestrictChild.fromJson(data) as T; } @@ -2587,12 +2461,6 @@ class Protocol extends _isd.DatabaseSerializationManager { : null) as T; } - if (t == _isc.getType<_i6rvg9xd.NullableSetDefaultChild?>()) { - return (data != null - ? _i6rvg9xd.NullableSetDefaultChild.fromJson(data) - : null) - as T; - } if (t == _isc.getType<_irjtvpke.Organization?>()) { return (data != null ? _irjtvpke.Organization.fromJson(data) : null) as T; } @@ -2611,12 +2479,6 @@ class Protocol extends _isd.DatabaseSerializationManager { : null) as T; } - if (t == _isc.getType<_i1huw131.RequiredSetNullChild?>()) { - return (data != null - ? _i1huw131.RequiredSetNullChild.fromJson(data) - : null) - as T; - } if (t == _isc.getType<_isrf0aof.RestrictChild?>()) { return (data != null ? _isrf0aof.RestrictChild.fromJson(data) : null) as T; @@ -2757,12 +2619,10 @@ class Protocol extends _isd.DatabaseSerializationManager { _icv70ksq.FkChainSetNullMiddle => 'FkChainSetNullMiddle', _ix62gjf0.FkChainSetNullRestrictChild => 'FkChainSetNullRestrictChild', _ihkyqxiw.FkChainSetNullSetNullChild => 'FkChainSetNullSetNullChild', - _i6rvg9xd.NullableSetDefaultChild => 'NullableSetDefaultChild', _irjtvpke.Organization => 'Organization', _iensfz4m.Person => 'Person', _ivx9jyda.RequiredCascadeChild => 'RequiredCascadeChild', _itlfbi2f.RequiredNoActionChild => 'RequiredNoActionChild', - _i1huw131.RequiredSetNullChild => 'RequiredSetNullChild', _isrf0aof.RestrictChild => 'RestrictChild', _ix6xayzv.SyncDocument => 'SyncDocument', _iytblq2r.Town => 'Town', @@ -2822,8 +2682,6 @@ class Protocol extends _isd.DatabaseSerializationManager { return 'FkChainSetNullRestrictChild'; case _ihkyqxiw.FkChainSetNullSetNullChild(): return 'FkChainSetNullSetNullChild'; - case _i6rvg9xd.NullableSetDefaultChild(): - return 'NullableSetDefaultChild'; case _irjtvpke.Organization(): return 'Organization'; case _iensfz4m.Person(): @@ -2832,8 +2690,6 @@ class Protocol extends _isd.DatabaseSerializationManager { return 'RequiredCascadeChild'; case _itlfbi2f.RequiredNoActionChild(): return 'RequiredNoActionChild'; - case _i1huw131.RequiredSetNullChild(): - return 'RequiredSetNullChild'; case _isrf0aof.RestrictChild(): return 'RestrictChild'; case _ix6xayzv.SyncDocument(): @@ -2934,9 +2790,6 @@ class Protocol extends _isd.DatabaseSerializationManager { if (dataClassName == 'FkChainSetNullSetNullChild') { return deserialize<_ihkyqxiw.FkChainSetNullSetNullChild>(data['data']); } - if (dataClassName == 'NullableSetDefaultChild') { - return deserialize<_i6rvg9xd.NullableSetDefaultChild>(data['data']); - } if (dataClassName == 'Organization') { return deserialize<_irjtvpke.Organization>(data['data']); } @@ -2949,9 +2802,6 @@ class Protocol extends _isd.DatabaseSerializationManager { if (dataClassName == 'RequiredNoActionChild') { return deserialize<_itlfbi2f.RequiredNoActionChild>(data['data']); } - if (dataClassName == 'RequiredSetNullChild') { - return deserialize<_i1huw131.RequiredSetNullChild>(data['data']); - } if (dataClassName == 'RestrictChild') { return deserialize<_isrf0aof.RestrictChild>(data['data']); } @@ -3087,8 +2937,6 @@ class Protocol extends _isd.DatabaseSerializationManager { return _ix62gjf0.FkChainSetNullRestrictChild.t; case _ihkyqxiw.FkChainSetNullSetNullChild: return _ihkyqxiw.FkChainSetNullSetNullChild.t; - case _i6rvg9xd.NullableSetDefaultChild: - return _i6rvg9xd.NullableSetDefaultChild.t; case _irjtvpke.Organization: return _irjtvpke.Organization.t; case _iensfz4m.Person: @@ -3097,8 +2945,6 @@ class Protocol extends _isd.DatabaseSerializationManager { return _ivx9jyda.RequiredCascadeChild.t; case _itlfbi2f.RequiredNoActionChild: return _itlfbi2f.RequiredNoActionChild.t; - case _i1huw131.RequiredSetNullChild: - return _i1huw131.RequiredSetNullChild.t; case _isrf0aof.RestrictChild: return _isrf0aof.RestrictChild.t; case _iytblq2r.Town: diff --git a/test/serverpod_offline_sync_test_client/lib/src/protocol/required_set_null_child.dart b/test/serverpod_offline_sync_test_client/lib/src/protocol/required_set_null_child.dart deleted file mode 100644 index d228de0..0000000 --- a/test/serverpod_offline_sync_test_client/lib/src/protocol/required_set_null_child.dart +++ /dev/null @@ -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 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 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 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? where, - int? limit, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? 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 { - RequiredSetNullChildUpdateTable(super.table); - - _isd.ColumnValue spaceId(int? value) => _isd.ColumnValue( - table.spaceId, - value, - ); - - _isd.ColumnValue 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 get includes => {'parent': _parent}; - - @override - _isd.Table<_isc.UuidValue?> get table => RequiredSetNullChild.t; -} - -class RequiredSetNullChildIncludeList extends _isd.IncludeList { - RequiredSetNullChildIncludeList._({ - _isd.WhereExpressionBuilder? where, - super.limit, - super.offset, - super.orderBy, - super.orderByList, - super.include, - }) { - super.where = where?.call(RequiredSetNullChild.t); - } - - @override - Map 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> find( - _isd.DatabaseSession session, { - _isd.WhereExpressionBuilder? where, - int? limit, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - RequiredSetNullChildInclude? include, - _isd.LockMode? lockMode, - _isd.LockBehavior? lockBehavior, - }) async { - return session.db.find( - 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 findFirstRow( - _isd.DatabaseSession session, { - _isd.WhereExpressionBuilder? where, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - RequiredSetNullChildInclude? include, - _isd.LockMode? lockMode, - _isd.LockBehavior? lockBehavior, - }) async { - return session.db.findFirstRow( - 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 findById( - _isd.DatabaseSession session, - _isc.UuidValue id, { - _isd.Transaction? transaction, - RequiredSetNullChildInclude? include, - _isd.LockMode? lockMode, - _isd.LockBehavior? lockBehavior, - }) async { - return session.db.findById( - 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> insert( - _isd.DatabaseSession session, - List rows, { - _isd.Transaction? transaction, - bool ignoreConflicts = false, - bool noReturn = false, - }) async { - return session.db.insert( - 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 insertRow( - _isd.DatabaseSession session, - RequiredSetNullChild row, { - _isd.Transaction? transaction, - }) async { - return session.db.insertRow( - 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> upsert( - _isd.DatabaseSession session, - List rows, { - required _isd.ColumnSelections conflictColumns, - _isd.ColumnSelections? updateColumns, - _isd.WhereExpressionBuilder? updateWhere, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.upsert( - 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 upsertRow( - _isd.DatabaseSession session, - RequiredSetNullChild row, { - required _isd.ColumnSelections conflictColumns, - _isd.ColumnSelections? updateColumns, - _isd.WhereExpressionBuilder? updateWhere, - _isd.Transaction? transaction, - }) async { - return session.db.upsertRow( - 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> update( - _isd.DatabaseSession session, - List rows, { - _isd.ColumnSelections? columns, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.update( - 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 updateRow( - _isd.DatabaseSession session, - RequiredSetNullChild row, { - _isd.ColumnSelections? columns, - _isd.Transaction? transaction, - }) async { - return session.db.updateRow( - 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 updateById( - _isd.DatabaseSession session, - _isc.UuidValue id, { - required _isd.ColumnValueListBuilder - columnValues, - _isd.Transaction? transaction, - }) async { - return session.db.updateById( - 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> updateWhere( - _isd.DatabaseSession session, { - required _isd.ColumnValueListBuilder - columnValues, - required _isd.WhereExpressionBuilder where, - int? limit, - int? offset, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.updateWhere( - 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> delete( - _isd.DatabaseSession session, - List rows, { - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.delete( - rows, - orderBy: orderBy?.call(RequiredSetNullChild.t), - orderByList: orderByList?.call(RequiredSetNullChild.t), - transaction: transaction, - noReturn: noReturn, - ); - } - - /// Deletes a single [RequiredSetNullChild]. - Future deleteRow( - _isd.DatabaseSession session, - RequiredSetNullChild row, { - _isd.Transaction? transaction, - }) async { - return session.db.deleteRow( - 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> deleteWhere( - _isd.DatabaseSession session, { - required _isd.WhereExpressionBuilder where, - _isd.OrderByBuilder? orderBy, - _isd.OrderByListBuilder? orderByList, - _isd.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.deleteWhere( - 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 count( - _isd.DatabaseSession session, { - _isd.WhereExpressionBuilder? where, - int? limit, - _isd.Transaction? transaction, - }) async { - return session.db.count( - where: where?.call(RequiredSetNullChild.t), - limit: limit, - transaction: transaction, - ); - } - - /// Acquires row-level locks on [RequiredSetNullChild] rows matching the [where] expression. - Future lockRows( - _isd.DatabaseSession session, { - required _isd.WhereExpressionBuilder where, - required _isd.LockMode lockMode, - required _isd.Transaction transaction, - _isd.LockBehavior lockBehavior = _isd.LockBehavior.wait, - }) async { - return session.db.lockRows( - 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 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, - columns: [RequiredSetNullChild.t.parentId], - transaction: transaction, - ); - } -} diff --git a/test/serverpod_offline_sync_test_client/lib/src/protocol/sync_tables.dart b/test/serverpod_offline_sync_test_client/lib/src/protocol/sync_tables.dart index 17e89f4..859c9cc 100644 --- a/test/serverpod_offline_sync_test_client/lib/src/protocol/sync_tables.dart +++ b/test/serverpod_offline_sync_test_client/lib/src/protocol/sync_tables.dart @@ -25,12 +25,10 @@ import 'fk_chain/set_null_cascade_child.dart' as _ideurard; import 'fk_chain/set_null_middle.dart' as _icv70ksq; import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0; import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw; -import 'nullable_set_default_child.dart' as _i6rvg9xd; import 'organization.dart' as _irjtvpke; import 'person.dart' as _iensfz4m; import 'required_cascade_child.dart' as _ivx9jyda; import 'required_no_action_child.dart' as _itlfbi2f; -import 'required_set_null_child.dart' as _i1huw131; import 'restrict_child.dart' as _isrf0aof; import 'town.dart' as _iytblq2r; import 'types.dart' as _iwxwszsz; @@ -63,12 +61,10 @@ final List<_isd.Table> syncTables = [ _icv70ksq.FkChainSetNullMiddle.t, _ix62gjf0.FkChainSetNullRestrictChild.t, _ihkyqxiw.FkChainSetNullSetNullChild.t, - _i6rvg9xd.NullableSetDefaultChild.t, _irjtvpke.Organization.t, _iensfz4m.Person.t, _ivx9jyda.RequiredCascadeChild.t, _itlfbi2f.RequiredNoActionChild.t, - _i1huw131.RequiredSetNullChild.t, _isrf0aof.RestrictChild.t, _i2ap9bqs.SharedChild.t, _i2ap9bqs.SharedParent.t, diff --git a/test/serverpod_offline_sync_test_client/pubspec.yaml b/test/serverpod_offline_sync_test_client/pubspec.yaml index 5483891..5c5a4fa 100644 --- a/test/serverpod_offline_sync_test_client/pubspec.yaml +++ b/test/serverpod_offline_sync_test_client/pubspec.yaml @@ -8,9 +8,9 @@ environment: resolution: workspace dependencies: - serverpod_auth_core_client: ^4.0.0 - serverpod_client: ^4.0.0 - serverpod_database: ^4.0.0 + serverpod_auth_core_client: '>=4.0.4 <4.1.0' + serverpod_client: '>=4.0.4 <4.1.0' + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync_client: path: ../../packages/serverpod_offline_sync_client serverpod_offline_sync_test_shared: diff --git a/test/serverpod_offline_sync_test_server/lib/src/endpoints/demo_debug_endpoint.dart b/test/serverpod_offline_sync_test_server/lib/src/endpoints/demo_debug_endpoint.dart index b2c9e34..93814e6 100644 --- a/test/serverpod_offline_sync_test_server/lib/src/endpoints/demo_debug_endpoint.dart +++ b/test/serverpod_offline_sync_test_server/lib/src/endpoints/demo_debug_endpoint.dart @@ -291,7 +291,6 @@ class DemoDebugEndpoint extends Endpoint { await add(); await add(); await add(); - await add(); await add(); await add(); await add(); diff --git a/test/serverpod_offline_sync_test_server/lib/src/generated/nullable_set_default_child.dart b/test/serverpod_offline_sync_test_server/lib/src/generated/nullable_set_default_child.dart deleted file mode 100644 index 465aeef..0000000 --- a/test/serverpod_offline_sync_test_server/lib/src/generated/nullable_set_default_child.dart +++ /dev/null @@ -1,754 +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/serverpod.dart' as _is; -import 'package:serverpod_offline_sync_test_server/src/generated/protocol.dart' - as _ixxccm81; -import 'person.dart' as _iensfz4m; - -abstract class NullableSetDefaultChild - implements _is.TableRow<_is.UuidValue?>, _is.ProtocolSerialization { - NullableSetDefaultChild._({ - this.id, - this.spaceId, - required this.name, - this.parentId, - this.parent, - }); - - factory NullableSetDefaultChild({ - _is.UuidValue? id, - int? spaceId, - required String name, - _is.UuidValue? parentId, - _iensfz4m.Person? parent, - }) = _NullableSetDefaultChildImpl; - - factory NullableSetDefaultChild.fromJson( - Map jsonSerialization, - ) { - return NullableSetDefaultChild( - id: jsonSerialization['id'] == null - ? null - : _is.UuidValueJsonExtension.fromJson(jsonSerialization['id']), - spaceId: jsonSerialization['spaceId'] as int?, - name: jsonSerialization['name'] as String, - parentId: jsonSerialization['parentId'] == null - ? null - : _is.UuidValueJsonExtension.fromJson(jsonSerialization['parentId']), - parent: jsonSerialization['parent'] == null - ? null - : _ixxccm81.Protocol().deserialize<_iensfz4m.Person>( - jsonSerialization['parent'], - ), - ); - } - - static final t = NullableSetDefaultChildTable(); - - static const db = NullableSetDefaultChildRepository._(); - - @override - _is.UuidValue? id; - - /// The space owning this row. Maintained by the sync engine. - int? spaceId; - - String name; - - _is.UuidValue? parentId; - - _iensfz4m.Person? parent; - - @override - _is.Table<_is.UuidValue?> get table => t; - - /// Returns a shallow copy of this [NullableSetDefaultChild] - /// with some or all fields replaced by the given arguments. - @_is.useResult - NullableSetDefaultChild copyWith({ - _is.UuidValue? id, - int? spaceId, - String? name, - _is.UuidValue? parentId, - _iensfz4m.Person? parent, - }); - @override - Map 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 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({ - _is.WhereExpressionBuilder? where, - int? limit, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? 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 _is.SerializationManager.encode(this); - } -} - -class _Undefined {} - -class _NullableSetDefaultChildImpl extends NullableSetDefaultChild { - _NullableSetDefaultChildImpl({ - _is.UuidValue? id, - int? spaceId, - required String name, - _is.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. - @_is.useResult - @override - NullableSetDefaultChild copyWith({ - Object? id = _Undefined, - Object? spaceId = _Undefined, - String? name, - Object? parentId = _Undefined, - Object? parent = _Undefined, - }) { - return NullableSetDefaultChild( - id: id is _is.UuidValue? ? id : this.id, - spaceId: spaceId is int? ? spaceId : this.spaceId, - name: name ?? this.name, - parentId: parentId is _is.UuidValue? ? parentId : this.parentId, - parent: parent is _iensfz4m.Person? ? parent : this.parent?.copyWith(), - ); - } -} - -class NullableSetDefaultChildUpdateTable - extends _is.UpdateTable { - NullableSetDefaultChildUpdateTable(super.table); - - _is.ColumnValue spaceId(int? value) => _is.ColumnValue( - table.spaceId, - value, - ); - - _is.ColumnValue name(String value) => _is.ColumnValue( - table.name, - value, - ); - - _is.ColumnValue<_is.UuidValue, _is.UuidValue> parentId( - _is.UuidValue? value, - ) => _is.ColumnValue( - table.parentId, - value, - ); -} - -class NullableSetDefaultChildTable extends _is.Table<_is.UuidValue?> { - NullableSetDefaultChildTable({super.tableRelation}) - : super(tableName: 'nullable_set_default_child') { - updateTable = NullableSetDefaultChildUpdateTable(this); - spaceId = _is.ColumnInt( - 'spaceId', - this, - ); - name = _is.ColumnString( - 'name', - this, - ); - parentId = _is.ColumnUuid( - 'parentId', - this, - ); - } - - late final NullableSetDefaultChildUpdateTable updateTable; - - /// The space owning this row. Maintained by the sync engine. - late final _is.ColumnInt spaceId; - - late final _is.ColumnString name; - - late final _is.ColumnUuid parentId; - - _iensfz4m.PersonTable? _parent; - - _iensfz4m.PersonTable get parent { - if (_parent != null) return _parent!; - _parent = _is.createRelationTable( - relationFieldName: 'parent', - field: NullableSetDefaultChild.t.parentId, - foreignField: _iensfz4m.Person.t.id, - tableRelation: tableRelation, - createTable: (foreignTableRelation) => - _iensfz4m.PersonTable(tableRelation: foreignTableRelation), - ); - return _parent!; - } - - @override - List<_is.Column> get columns => [ - id, - spaceId, - name, - parentId, - ]; - - @override - _is.Table? getRelationTable(String relationField) { - if (relationField == 'parent') { - return parent; - } - return null; - } -} - -class NullableSetDefaultChildInclude extends _is.IncludeObject { - NullableSetDefaultChildInclude._({_iensfz4m.PersonInclude? parent}) { - _parent = parent; - } - - _iensfz4m.PersonInclude? _parent; - - @override - Map get includes => {'parent': _parent}; - - @override - _is.Table<_is.UuidValue?> get table => NullableSetDefaultChild.t; -} - -class NullableSetDefaultChildIncludeList extends _is.IncludeList { - NullableSetDefaultChildIncludeList._({ - _is.WhereExpressionBuilder? where, - super.limit, - super.offset, - super.orderBy, - super.orderByList, - super.include, - }) { - super.where = where?.call(NullableSetDefaultChild.t); - } - - @override - Map get includes => include?.includes ?? {}; - - @override - _is.Table<_is.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> find( - _is.DatabaseSession session, { - _is.WhereExpressionBuilder? where, - int? limit, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - NullableSetDefaultChildInclude? include, - _is.LockMode? lockMode, - _is.LockBehavior? lockBehavior, - }) async { - return session.db.find( - 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 findFirstRow( - _is.DatabaseSession session, { - _is.WhereExpressionBuilder? where, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - NullableSetDefaultChildInclude? include, - _is.LockMode? lockMode, - _is.LockBehavior? lockBehavior, - }) async { - return session.db.findFirstRow( - 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 findById( - _is.DatabaseSession session, - _is.UuidValue id, { - _is.Transaction? transaction, - NullableSetDefaultChildInclude? include, - _is.LockMode? lockMode, - _is.LockBehavior? lockBehavior, - }) async { - return session.db.findById( - 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> insert( - _is.DatabaseSession session, - List rows, { - _is.Transaction? transaction, - bool ignoreConflicts = false, - bool noReturn = false, - }) async { - return session.db.insert( - 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 insertRow( - _is.DatabaseSession session, - NullableSetDefaultChild row, { - _is.Transaction? transaction, - }) async { - return session.db.insertRow( - 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> upsert( - _is.DatabaseSession session, - List rows, { - required _is.ColumnSelections conflictColumns, - _is.ColumnSelections? updateColumns, - _is.WhereExpressionBuilder? updateWhere, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.upsert( - 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 upsertRow( - _is.DatabaseSession session, - NullableSetDefaultChild row, { - required _is.ColumnSelections conflictColumns, - _is.ColumnSelections? updateColumns, - _is.WhereExpressionBuilder? updateWhere, - _is.Transaction? transaction, - }) async { - return session.db.upsertRow( - 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> update( - _is.DatabaseSession session, - List rows, { - _is.ColumnSelections? columns, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.update( - 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 updateRow( - _is.DatabaseSession session, - NullableSetDefaultChild row, { - _is.ColumnSelections? columns, - _is.Transaction? transaction, - }) async { - return session.db.updateRow( - 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 updateById( - _is.DatabaseSession session, - _is.UuidValue id, { - required _is.ColumnValueListBuilder - columnValues, - _is.Transaction? transaction, - }) async { - return session.db.updateById( - 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> updateWhere( - _is.DatabaseSession session, { - required _is.ColumnValueListBuilder - columnValues, - required _is.WhereExpressionBuilder where, - int? limit, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.updateWhere( - 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> delete( - _is.DatabaseSession session, - List rows, { - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.delete( - rows, - orderBy: orderBy?.call(NullableSetDefaultChild.t), - orderByList: orderByList?.call(NullableSetDefaultChild.t), - transaction: transaction, - noReturn: noReturn, - ); - } - - /// Deletes a single [NullableSetDefaultChild]. - Future deleteRow( - _is.DatabaseSession session, - NullableSetDefaultChild row, { - _is.Transaction? transaction, - }) async { - return session.db.deleteRow( - 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> deleteWhere( - _is.DatabaseSession session, { - required _is.WhereExpressionBuilder where, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.deleteWhere( - 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 count( - _is.DatabaseSession session, { - _is.WhereExpressionBuilder? where, - int? limit, - _is.Transaction? transaction, - }) async { - return session.db.count( - where: where?.call(NullableSetDefaultChild.t), - limit: limit, - transaction: transaction, - ); - } - - /// Acquires row-level locks on [NullableSetDefaultChild] rows matching the [where] expression. - Future lockRows( - _is.DatabaseSession session, { - required _is.WhereExpressionBuilder where, - required _is.LockMode lockMode, - required _is.Transaction transaction, - _is.LockBehavior lockBehavior = _is.LockBehavior.wait, - }) async { - return session.db.lockRows( - 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 parent( - _is.DatabaseSession session, - NullableSetDefaultChild nullableSetDefaultChild, - _iensfz4m.Person parent, { - _is.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, - 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 parent( - _is.DatabaseSession session, - NullableSetDefaultChild nullableSetDefaultChild, { - _is.Transaction? transaction, - }) async { - if (nullableSetDefaultChild.id == null) { - throw ArgumentError.notNull('nullableSetDefaultChild.id'); - } - - var $nullableSetDefaultChild = nullableSetDefaultChild.copyWith( - parentId: null, - ); - await session.db.updateRow( - $nullableSetDefaultChild, - columns: [NullableSetDefaultChild.t.parentId], - transaction: transaction, - ); - } -} diff --git a/test/serverpod_offline_sync_test_server/lib/src/generated/protocol.dart b/test/serverpod_offline_sync_test_server/lib/src/generated/protocol.dart index ef4aaa6..3791d62 100644 --- a/test/serverpod_offline_sync_test_server/lib/src/generated/protocol.dart +++ b/test/serverpod_offline_sync_test_server/lib/src/generated/protocol.dart @@ -31,12 +31,10 @@ import 'fk_chain/set_null_cascade_child.dart' as _ideurard; import 'fk_chain/set_null_middle.dart' as _icv70ksq; import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0; import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw; -import 'nullable_set_default_child.dart' as _i6rvg9xd; import 'organization.dart' as _irjtvpke; import 'person.dart' as _iensfz4m; import 'required_cascade_child.dart' as _ivx9jyda; import 'required_no_action_child.dart' as _itlfbi2f; -import 'required_set_null_child.dart' as _i1huw131; import 'restrict_child.dart' as _isrf0aof; import 'sync_document.dart' as _ix6xayzv; import 'town.dart' as _iytblq2r; @@ -67,12 +65,10 @@ export 'fk_chain/set_null_cascade_child.dart'; export 'fk_chain/set_null_middle.dart'; export 'fk_chain/set_null_restrict_child.dart'; export 'fk_chain/set_null_set_null_child.dart'; -export 'nullable_set_default_child.dart'; export 'organization.dart'; export 'person.dart'; export 'required_cascade_child.dart'; export 'required_no_action_child.dart'; -export 'required_set_null_child.dart'; export 'restrict_child.dart'; export 'sync_document.dart'; export 'town.dart'; @@ -777,64 +773,6 @@ class Protocol extends _is.DatabaseSerializationManager { indexes: [], managed: true, ), - _isp.TableDefinition( - name: 'nullable_set_default_child', - dartName: 'NullableSetDefaultChild', - schema: 'public', - module: 'serverpod_offline_sync_test', - columns: [ - _isp.ColumnDefinition( - name: 'id', - columnType: _isp.ColumnType.uuid, - isNullable: false, - dartType: 'UuidValue?', - columnDefault: 'random_v7', - ), - _isp.ColumnDefinition( - name: 'spaceId', - columnType: _isp.ColumnType.bigint, - isNullable: true, - dartType: 'int?', - ), - _isp.ColumnDefinition( - name: 'name', - columnType: _isp.ColumnType.text, - isNullable: false, - dartType: 'String', - ), - _isp.ColumnDefinition( - name: 'parentId', - columnType: _isp.ColumnType.uuid, - isNullable: true, - dartType: 'UuidValue?', - ), - ], - foreignKeys: [ - _isp.ForeignKeyDefinition( - constraintName: 'nullable_set_default_child_fk_0', - columns: ['spaceId'], - referenceTable: 'offline_sync_spaces', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isp.ForeignKeyAction.noAction, - onDelete: _isp.ForeignKeyAction.cascade, - matchType: null, - ), - _isp.ForeignKeyDefinition( - constraintName: 'nullable_set_default_child_fk_1', - columns: ['parentId'], - referenceTable: 'person', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isp.ForeignKeyAction.noAction, - onDelete: _isp.ForeignKeyAction.setDefault, - matchType: null, - deferrable: _isp.DeferrableConstraint.initiallyDeferred, - ), - ], - indexes: [], - managed: true, - ), _isp.TableDefinition( name: 'organization', dartName: 'Organization', @@ -1106,64 +1044,6 @@ class Protocol extends _is.DatabaseSerializationManager { indexes: [], managed: true, ), - _isp.TableDefinition( - name: 'required_set_null_child', - dartName: 'RequiredSetNullChild', - schema: 'public', - module: 'serverpod_offline_sync_test', - columns: [ - _isp.ColumnDefinition( - name: 'id', - columnType: _isp.ColumnType.uuid, - isNullable: false, - dartType: 'UuidValue?', - columnDefault: 'random_v7', - ), - _isp.ColumnDefinition( - name: 'spaceId', - columnType: _isp.ColumnType.bigint, - isNullable: true, - dartType: 'int?', - ), - _isp.ColumnDefinition( - name: 'name', - columnType: _isp.ColumnType.text, - isNullable: false, - dartType: 'String', - ), - _isp.ColumnDefinition( - name: 'parentId', - columnType: _isp.ColumnType.uuid, - isNullable: false, - dartType: 'UuidValue', - ), - ], - foreignKeys: [ - _isp.ForeignKeyDefinition( - constraintName: 'required_set_null_child_fk_0', - columns: ['spaceId'], - referenceTable: 'offline_sync_spaces', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isp.ForeignKeyAction.noAction, - onDelete: _isp.ForeignKeyAction.cascade, - matchType: null, - ), - _isp.ForeignKeyDefinition( - constraintName: 'required_set_null_child_fk_1', - columns: ['parentId'], - referenceTable: 'person', - referenceTableSchema: 'public', - referenceColumns: ['id'], - onUpdate: _isp.ForeignKeyAction.noAction, - onDelete: _isp.ForeignKeyAction.setNull, - matchType: null, - deferrable: _isp.DeferrableConstraint.initiallyDeferred, - ), - ], - indexes: [], - managed: true, - ), _isp.TableDefinition( name: 'restrict_child', dartName: 'RestrictChild', @@ -2449,9 +2329,6 @@ class Protocol extends _is.DatabaseSerializationManager { if (t == _ihkyqxiw.FkChainSetNullSetNullChild) { return _ihkyqxiw.FkChainSetNullSetNullChild.fromJson(data) as T; } - if (t == _i6rvg9xd.NullableSetDefaultChild) { - return _i6rvg9xd.NullableSetDefaultChild.fromJson(data) as T; - } if (t == _irjtvpke.Organization) { return _irjtvpke.Organization.fromJson(data) as T; } @@ -2464,9 +2341,6 @@ class Protocol extends _is.DatabaseSerializationManager { if (t == _itlfbi2f.RequiredNoActionChild) { return _itlfbi2f.RequiredNoActionChild.fromJson(data) as T; } - if (t == _i1huw131.RequiredSetNullChild) { - return _i1huw131.RequiredSetNullChild.fromJson(data) as T; - } if (t == _isrf0aof.RestrictChild) { return _isrf0aof.RestrictChild.fromJson(data) as T; } @@ -2581,12 +2455,6 @@ class Protocol extends _is.DatabaseSerializationManager { : null) as T; } - if (t == _is.getType<_i6rvg9xd.NullableSetDefaultChild?>()) { - return (data != null - ? _i6rvg9xd.NullableSetDefaultChild.fromJson(data) - : null) - as T; - } if (t == _is.getType<_irjtvpke.Organization?>()) { return (data != null ? _irjtvpke.Organization.fromJson(data) : null) as T; } @@ -2605,12 +2473,6 @@ class Protocol extends _is.DatabaseSerializationManager { : null) as T; } - if (t == _is.getType<_i1huw131.RequiredSetNullChild?>()) { - return (data != null - ? _i1huw131.RequiredSetNullChild.fromJson(data) - : null) - as T; - } if (t == _is.getType<_isrf0aof.RestrictChild?>()) { return (data != null ? _isrf0aof.RestrictChild.fromJson(data) : null) as T; @@ -2754,12 +2616,10 @@ class Protocol extends _is.DatabaseSerializationManager { _icv70ksq.FkChainSetNullMiddle => 'FkChainSetNullMiddle', _ix62gjf0.FkChainSetNullRestrictChild => 'FkChainSetNullRestrictChild', _ihkyqxiw.FkChainSetNullSetNullChild => 'FkChainSetNullSetNullChild', - _i6rvg9xd.NullableSetDefaultChild => 'NullableSetDefaultChild', _irjtvpke.Organization => 'Organization', _iensfz4m.Person => 'Person', _ivx9jyda.RequiredCascadeChild => 'RequiredCascadeChild', _itlfbi2f.RequiredNoActionChild => 'RequiredNoActionChild', - _i1huw131.RequiredSetNullChild => 'RequiredSetNullChild', _isrf0aof.RestrictChild => 'RestrictChild', _ix6xayzv.SyncDocument => 'SyncDocument', _iytblq2r.Town => 'Town', @@ -2819,8 +2679,6 @@ class Protocol extends _is.DatabaseSerializationManager { return 'FkChainSetNullRestrictChild'; case _ihkyqxiw.FkChainSetNullSetNullChild(): return 'FkChainSetNullSetNullChild'; - case _i6rvg9xd.NullableSetDefaultChild(): - return 'NullableSetDefaultChild'; case _irjtvpke.Organization(): return 'Organization'; case _iensfz4m.Person(): @@ -2829,8 +2687,6 @@ class Protocol extends _is.DatabaseSerializationManager { return 'RequiredCascadeChild'; case _itlfbi2f.RequiredNoActionChild(): return 'RequiredNoActionChild'; - case _i1huw131.RequiredSetNullChild(): - return 'RequiredSetNullChild'; case _isrf0aof.RestrictChild(): return 'RestrictChild'; case _ix6xayzv.SyncDocument(): @@ -2935,9 +2791,6 @@ class Protocol extends _is.DatabaseSerializationManager { if (dataClassName == 'FkChainSetNullSetNullChild') { return deserialize<_ihkyqxiw.FkChainSetNullSetNullChild>(data['data']); } - if (dataClassName == 'NullableSetDefaultChild') { - return deserialize<_i6rvg9xd.NullableSetDefaultChild>(data['data']); - } if (dataClassName == 'Organization') { return deserialize<_irjtvpke.Organization>(data['data']); } @@ -2950,9 +2803,6 @@ class Protocol extends _is.DatabaseSerializationManager { if (dataClassName == 'RequiredNoActionChild') { return deserialize<_itlfbi2f.RequiredNoActionChild>(data['data']); } - if (dataClassName == 'RequiredSetNullChild') { - return deserialize<_i1huw131.RequiredSetNullChild>(data['data']); - } if (dataClassName == 'RestrictChild') { return deserialize<_isrf0aof.RestrictChild>(data['data']); } @@ -3092,8 +2942,6 @@ class Protocol extends _is.DatabaseSerializationManager { return _ix62gjf0.FkChainSetNullRestrictChild.t; case _ihkyqxiw.FkChainSetNullSetNullChild: return _ihkyqxiw.FkChainSetNullSetNullChild.t; - case _i6rvg9xd.NullableSetDefaultChild: - return _i6rvg9xd.NullableSetDefaultChild.t; case _irjtvpke.Organization: return _irjtvpke.Organization.t; case _iensfz4m.Person: @@ -3102,8 +2950,6 @@ class Protocol extends _is.DatabaseSerializationManager { return _ivx9jyda.RequiredCascadeChild.t; case _itlfbi2f.RequiredNoActionChild: return _itlfbi2f.RequiredNoActionChild.t; - case _i1huw131.RequiredSetNullChild: - return _i1huw131.RequiredSetNullChild.t; case _isrf0aof.RestrictChild: return _isrf0aof.RestrictChild.t; case _iytblq2r.Town: diff --git a/test/serverpod_offline_sync_test_server/lib/src/generated/required_set_null_child.dart b/test/serverpod_offline_sync_test_server/lib/src/generated/required_set_null_child.dart deleted file mode 100644 index ba0d109..0000000 --- a/test/serverpod_offline_sync_test_server/lib/src/generated/required_set_null_child.dart +++ /dev/null @@ -1,723 +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/serverpod.dart' as _is; -import 'package:serverpod_offline_sync_test_server/src/generated/protocol.dart' - as _ixxccm81; -import 'person.dart' as _iensfz4m; - -abstract class RequiredSetNullChild - implements _is.TableRow<_is.UuidValue?>, _is.ProtocolSerialization { - RequiredSetNullChild._({ - this.id, - this.spaceId, - required this.name, - required this.parentId, - this.parent, - }); - - factory RequiredSetNullChild({ - _is.UuidValue? id, - int? spaceId, - required String name, - required _is.UuidValue parentId, - _iensfz4m.Person? parent, - }) = _RequiredSetNullChildImpl; - - factory RequiredSetNullChild.fromJson( - Map jsonSerialization, - ) { - return RequiredSetNullChild( - id: jsonSerialization['id'] == null - ? null - : _is.UuidValueJsonExtension.fromJson(jsonSerialization['id']), - spaceId: jsonSerialization['spaceId'] as int?, - name: jsonSerialization['name'] as String, - parentId: _is.UuidValueJsonExtension.fromJson( - jsonSerialization['parentId'], - ), - parent: jsonSerialization['parent'] == null - ? null - : _ixxccm81.Protocol().deserialize<_iensfz4m.Person>( - jsonSerialization['parent'], - ), - ); - } - - static final t = RequiredSetNullChildTable(); - - static const db = RequiredSetNullChildRepository._(); - - @override - _is.UuidValue? id; - - /// The space owning this row. Maintained by the sync engine. - int? spaceId; - - String name; - - _is.UuidValue parentId; - - _iensfz4m.Person? parent; - - @override - _is.Table<_is.UuidValue?> get table => t; - - /// Returns a shallow copy of this [RequiredSetNullChild] - /// with some or all fields replaced by the given arguments. - @_is.useResult - RequiredSetNullChild copyWith({ - _is.UuidValue? id, - int? spaceId, - String? name, - _is.UuidValue? parentId, - _iensfz4m.Person? parent, - }); - @override - Map 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 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({ - _is.WhereExpressionBuilder? where, - int? limit, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? 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 _is.SerializationManager.encode(this); - } -} - -class _Undefined {} - -class _RequiredSetNullChildImpl extends RequiredSetNullChild { - _RequiredSetNullChildImpl({ - _is.UuidValue? id, - int? spaceId, - required String name, - required _is.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. - @_is.useResult - @override - RequiredSetNullChild copyWith({ - Object? id = _Undefined, - Object? spaceId = _Undefined, - String? name, - _is.UuidValue? parentId, - Object? parent = _Undefined, - }) { - return RequiredSetNullChild( - id: id is _is.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 _is.UpdateTable { - RequiredSetNullChildUpdateTable(super.table); - - _is.ColumnValue spaceId(int? value) => _is.ColumnValue( - table.spaceId, - value, - ); - - _is.ColumnValue name(String value) => _is.ColumnValue( - table.name, - value, - ); - - _is.ColumnValue<_is.UuidValue, _is.UuidValue> parentId(_is.UuidValue value) => - _is.ColumnValue( - table.parentId, - value, - ); -} - -class RequiredSetNullChildTable extends _is.Table<_is.UuidValue?> { - RequiredSetNullChildTable({super.tableRelation}) - : super(tableName: 'required_set_null_child') { - updateTable = RequiredSetNullChildUpdateTable(this); - spaceId = _is.ColumnInt( - 'spaceId', - this, - ); - name = _is.ColumnString( - 'name', - this, - ); - parentId = _is.ColumnUuid( - 'parentId', - this, - ); - } - - late final RequiredSetNullChildUpdateTable updateTable; - - /// The space owning this row. Maintained by the sync engine. - late final _is.ColumnInt spaceId; - - late final _is.ColumnString name; - - late final _is.ColumnUuid parentId; - - _iensfz4m.PersonTable? _parent; - - _iensfz4m.PersonTable get parent { - if (_parent != null) return _parent!; - _parent = _is.createRelationTable( - relationFieldName: 'parent', - field: RequiredSetNullChild.t.parentId, - foreignField: _iensfz4m.Person.t.id, - tableRelation: tableRelation, - createTable: (foreignTableRelation) => - _iensfz4m.PersonTable(tableRelation: foreignTableRelation), - ); - return _parent!; - } - - @override - List<_is.Column> get columns => [ - id, - spaceId, - name, - parentId, - ]; - - @override - _is.Table? getRelationTable(String relationField) { - if (relationField == 'parent') { - return parent; - } - return null; - } -} - -class RequiredSetNullChildInclude extends _is.IncludeObject { - RequiredSetNullChildInclude._({_iensfz4m.PersonInclude? parent}) { - _parent = parent; - } - - _iensfz4m.PersonInclude? _parent; - - @override - Map get includes => {'parent': _parent}; - - @override - _is.Table<_is.UuidValue?> get table => RequiredSetNullChild.t; -} - -class RequiredSetNullChildIncludeList extends _is.IncludeList { - RequiredSetNullChildIncludeList._({ - _is.WhereExpressionBuilder? where, - super.limit, - super.offset, - super.orderBy, - super.orderByList, - super.include, - }) { - super.where = where?.call(RequiredSetNullChild.t); - } - - @override - Map get includes => include?.includes ?? {}; - - @override - _is.Table<_is.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> find( - _is.DatabaseSession session, { - _is.WhereExpressionBuilder? where, - int? limit, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - RequiredSetNullChildInclude? include, - _is.LockMode? lockMode, - _is.LockBehavior? lockBehavior, - }) async { - return session.db.find( - 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 findFirstRow( - _is.DatabaseSession session, { - _is.WhereExpressionBuilder? where, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - RequiredSetNullChildInclude? include, - _is.LockMode? lockMode, - _is.LockBehavior? lockBehavior, - }) async { - return session.db.findFirstRow( - 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 findById( - _is.DatabaseSession session, - _is.UuidValue id, { - _is.Transaction? transaction, - RequiredSetNullChildInclude? include, - _is.LockMode? lockMode, - _is.LockBehavior? lockBehavior, - }) async { - return session.db.findById( - 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> insert( - _is.DatabaseSession session, - List rows, { - _is.Transaction? transaction, - bool ignoreConflicts = false, - bool noReturn = false, - }) async { - return session.db.insert( - 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 insertRow( - _is.DatabaseSession session, - RequiredSetNullChild row, { - _is.Transaction? transaction, - }) async { - return session.db.insertRow( - 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> upsert( - _is.DatabaseSession session, - List rows, { - required _is.ColumnSelections conflictColumns, - _is.ColumnSelections? updateColumns, - _is.WhereExpressionBuilder? updateWhere, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.upsert( - 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 upsertRow( - _is.DatabaseSession session, - RequiredSetNullChild row, { - required _is.ColumnSelections conflictColumns, - _is.ColumnSelections? updateColumns, - _is.WhereExpressionBuilder? updateWhere, - _is.Transaction? transaction, - }) async { - return session.db.upsertRow( - 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> update( - _is.DatabaseSession session, - List rows, { - _is.ColumnSelections? columns, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.update( - 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 updateRow( - _is.DatabaseSession session, - RequiredSetNullChild row, { - _is.ColumnSelections? columns, - _is.Transaction? transaction, - }) async { - return session.db.updateRow( - 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 updateById( - _is.DatabaseSession session, - _is.UuidValue id, { - required _is.ColumnValueListBuilder - columnValues, - _is.Transaction? transaction, - }) async { - return session.db.updateById( - 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> updateWhere( - _is.DatabaseSession session, { - required _is.ColumnValueListBuilder - columnValues, - required _is.WhereExpressionBuilder where, - int? limit, - int? offset, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.updateWhere( - 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> delete( - _is.DatabaseSession session, - List rows, { - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.delete( - rows, - orderBy: orderBy?.call(RequiredSetNullChild.t), - orderByList: orderByList?.call(RequiredSetNullChild.t), - transaction: transaction, - noReturn: noReturn, - ); - } - - /// Deletes a single [RequiredSetNullChild]. - Future deleteRow( - _is.DatabaseSession session, - RequiredSetNullChild row, { - _is.Transaction? transaction, - }) async { - return session.db.deleteRow( - 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> deleteWhere( - _is.DatabaseSession session, { - required _is.WhereExpressionBuilder where, - _is.OrderByBuilder? orderBy, - _is.OrderByListBuilder? orderByList, - _is.Transaction? transaction, - bool noReturn = false, - }) async { - return session.db.deleteWhere( - 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 count( - _is.DatabaseSession session, { - _is.WhereExpressionBuilder? where, - int? limit, - _is.Transaction? transaction, - }) async { - return session.db.count( - where: where?.call(RequiredSetNullChild.t), - limit: limit, - transaction: transaction, - ); - } - - /// Acquires row-level locks on [RequiredSetNullChild] rows matching the [where] expression. - Future lockRows( - _is.DatabaseSession session, { - required _is.WhereExpressionBuilder where, - required _is.LockMode lockMode, - required _is.Transaction transaction, - _is.LockBehavior lockBehavior = _is.LockBehavior.wait, - }) async { - return session.db.lockRows( - 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 parent( - _is.DatabaseSession session, - RequiredSetNullChild requiredSetNullChild, - _iensfz4m.Person parent, { - _is.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, - columns: [RequiredSetNullChild.t.parentId], - transaction: transaction, - ); - } -} diff --git a/test/serverpod_offline_sync_test_server/lib/src/generated/sync_tables.dart b/test/serverpod_offline_sync_test_server/lib/src/generated/sync_tables.dart index dd68fea..de8c696 100644 --- a/test/serverpod_offline_sync_test_server/lib/src/generated/sync_tables.dart +++ b/test/serverpod_offline_sync_test_server/lib/src/generated/sync_tables.dart @@ -25,12 +25,10 @@ import 'fk_chain/set_null_cascade_child.dart' as _ideurard; import 'fk_chain/set_null_middle.dart' as _icv70ksq; import 'fk_chain/set_null_restrict_child.dart' as _ix62gjf0; import 'fk_chain/set_null_set_null_child.dart' as _ihkyqxiw; -import 'nullable_set_default_child.dart' as _i6rvg9xd; import 'organization.dart' as _irjtvpke; import 'person.dart' as _iensfz4m; import 'required_cascade_child.dart' as _ivx9jyda; import 'required_no_action_child.dart' as _itlfbi2f; -import 'required_set_null_child.dart' as _i1huw131; import 'restrict_child.dart' as _isrf0aof; import 'town.dart' as _iytblq2r; import 'types.dart' as _iwxwszsz; @@ -63,12 +61,10 @@ final List<_is.Table> syncTables = [ _icv70ksq.FkChainSetNullMiddle.t, _ix62gjf0.FkChainSetNullRestrictChild.t, _ihkyqxiw.FkChainSetNullSetNullChild.t, - _i6rvg9xd.NullableSetDefaultChild.t, _irjtvpke.Organization.t, _iensfz4m.Person.t, _ivx9jyda.RequiredCascadeChild.t, _itlfbi2f.RequiredNoActionChild.t, - _i1huw131.RequiredSetNullChild.t, _isrf0aof.RestrictChild.t, _i2ap9bqs.SharedChild.t, _i2ap9bqs.SharedParent.t, diff --git a/test/serverpod_offline_sync_test_server/lib/src/models/nullable_set_default_child.spy.yaml b/test/serverpod_offline_sync_test_server/lib/src/models/nullable_set_default_child.spy.yaml deleted file mode 100644 index 5e29c97..0000000 --- a/test/serverpod_offline_sync_test_server/lib/src/models/nullable_set_default_child.spy.yaml +++ /dev/null @@ -1,6 +0,0 @@ -class: NullableSetDefaultChild -table: nullable_set_default_child -database: sync -fields: - name: String - parent: Person?, relation(fk, optional, onDelete=SetDefault, deferred) diff --git a/test/serverpod_offline_sync_test_server/lib/src/models/required_set_null_child.spy.yaml b/test/serverpod_offline_sync_test_server/lib/src/models/required_set_null_child.spy.yaml deleted file mode 100644 index 1e0bb4f..0000000 --- a/test/serverpod_offline_sync_test_server/lib/src/models/required_set_null_child.spy.yaml +++ /dev/null @@ -1,6 +0,0 @@ -class: RequiredSetNullChild -table: required_set_null_child -database: sync -fields: - name: String - parent: Person?, relation(fk, onDelete=SetNull, deferred) diff --git a/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.json b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.json new file mode 100644 index 0000000..acc4484 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.json @@ -0,0 +1,5976 @@ +{ + "__className__": "serverpod.DatabaseDefinition", + "schemaVersion": 2, + "moduleName": "serverpod_offline_sync_test", + "tables": [ + { + "__className__": "serverpod.TableDefinition", + "name": "address", + "dartName": "Address", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "street", + "fieldName": "street", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "inhabitantId", + "fieldName": "inhabitantId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_1", + "columns": [ + "inhabitantId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "address__inhabitantId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "inhabitantId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "city", + "dartName": "City", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "city_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "company", + "dartName": "Company", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "townId", + "fieldName": "townId", + "columnType": 7, + "isNullable": false, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_1", + "columns": [ + "townId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_cascade_middle", + "dartName": "FkChainCascadeMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rootId", + "fieldName": "rootId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_1", + "columns": [ + "rootId" + ], + "referenceTable": "fk_chain_root", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_cascade_child", + "dartName": "FkChainMiddleCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_set_null_child", + "dartName": "FkChainMiddleSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_restrict_blocker", + "dartName": "FkChainRestrictBlocker", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_root", + "dartName": "FkChainRoot", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_root_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_cascade_child", + "dartName": "FkChainSetNullCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_middle", + "dartName": "FkChainSetNullMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_restrict_child", + "dartName": "FkChainSetNullRestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_set_null_child", + "dartName": "FkChainSetNullSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "organization", + "dartName": "Organization", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "person", + "dartName": "Person", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "surname", + "fieldName": "surname", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "organizationId", + "fieldName": "organizationId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "oldCompanyId", + "fieldName": "oldCompanyId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_1", + "columns": [ + "organizationId" + ], + "referenceTable": "organization", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_2", + "columns": [ + "oldCompanyId" + ], + "referenceTable": "company", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_3", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_cascade_child", + "dartName": "RequiredCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_no_action_child", + "dartName": "RequiredNoActionChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "restrict_child", + "dartName": "RestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_child", + "dartName": "SharedChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "flavor", + "fieldName": "flavor", + "columnType": 0, + "isNullable": false, + "columnDefault": "'plain'", + "dartType": "serverpod_offline_sync_test_shared:SharedFlavor" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "shared_parent", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_parent", + "dartName": "SharedParent", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_parent_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "town", + "dartName": "Town", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "mayorId", + "fieldName": "mayorId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_2", + "columns": [ + "mayorId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "types", + "dartName": "Types", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBool", + "fieldName": "aBool", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aDateTime", + "fieldName": "aDateTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aText", + "fieldName": "aText", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt", + "fieldName": "anInt", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt64", + "fieldName": "anInt64", + "columnType": 0, + "isNullable": false, + "dartType": "BigInt" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aReal", + "fieldName": "aReal", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBlob", + "fieldName": "aBlob", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anEnum", + "fieldName": "anEnum", + "columnType": 6, + "isNullable": true, + "dartType": "protocol:TypesEnum?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalText", + "fieldName": "optionalText", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalUuid", + "fieldName": "optionalUuid", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonDocument", + "fieldName": "jsonDocument", + "columnType": 8, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbDocument", + "fieldName": "jsonbDocument", + "columnType": 14, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbNumbers", + "fieldName": "jsonbNumbers", + "columnType": 14, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "types", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "types_a_text_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "aText" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique", + "dartName": "Unique", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_child", + "dartName": "UniqueCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_child__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_reference", + "dartName": "UniqueCascadeReference", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_reference__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_composite", + "dartName": "UniqueComposite", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scope", + "fieldName": "scope", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_composite_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_composite__spaceId__scope__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "scope" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_discriminator", + "dartName": "UniqueDiscriminator", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_discriminator_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_discriminator__spaceId__categoryId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_fk_pair", + "dartName": "UniqueFkPair", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "leftId", + "fieldName": "leftId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rightId", + "fieldName": "rightId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_1", + "columns": [ + "leftId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_2", + "columns": [ + "rightId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_fk_pair_parents", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "leftId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rightId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_mixed_fk", + "dartName": "UniqueMixedFk", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_mixed_fk_name_parent", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_no_release", + "dartName": "UniqueNoRelease", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_no_release_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_no_release__spaceId__categoryId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_nullable", + "dartName": "UniqueNullable", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_nullable_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_nullable__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_overlapping", + "dartName": "UniqueOverlapping", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "first", + "fieldName": "first", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "second", + "fieldName": "second", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "third", + "fieldName": "third", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_overlapping_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_first_second", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "first" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_second_third", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "third" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_default_child", + "dartName": "UniqueSetDefaultChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_null_child", + "dartName": "UniqueSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_null_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_uuid", + "dartName": "UniqueUuid", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_uuid_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_uuid__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_cloud_storage", + "dartName": "CloudStorageEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "addedTime", + "fieldName": "addedTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiration", + "fieldName": "expiration", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "byteData", + "fieldName": "byteData", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "verified", + "fieldName": "verified", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentType", + "fieldName": "contentType", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cacheControl", + "fieldName": "cacheControl", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentDisposition", + "fieldName": "contentDisposition", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentEncoding", + "fieldName": "contentEncoding", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "customMetadata", + "fieldName": "customMetadata", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_path_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "storageId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "path" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_expiration", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "expiration" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_cloud_storage_direct_download", + "dartName": "CloudStorageDirectDownloadEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiration", + "fieldName": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authKey", + "fieldName": "authKey", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "downloadFileName", + "fieldName": "downloadFileName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentType", + "fieldName": "contentType", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_direct_download_auth_key", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "authKey" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_direct_download_expiration", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "expiration" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_cloud_storage_direct_upload", + "dartName": "CloudStorageDirectUploadEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiration", + "fieldName": "expiration", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authKey", + "fieldName": "authKey", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "maxFileSize", + "fieldName": "maxFileSize", + "columnType": 6, + "isNullable": false, + "columnDefault": "10485760", + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentLength", + "fieldName": "contentLength", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "preventOverwrite", + "fieldName": "preventOverwrite", + "columnType": 1, + "isNullable": false, + "columnDefault": "false", + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentType", + "fieldName": "contentType", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cacheControl", + "fieldName": "cacheControl", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentDisposition", + "fieldName": "contentDisposition", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "contentEncoding", + "fieldName": "contentEncoding", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "customMetadata", + "fieldName": "customMetadata", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_cloud_storage_direct_upload_storage_path", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "storageId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "path" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_future_call", + "dartName": "FutureCallEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "time", + "fieldName": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serializedObject", + "fieldName": "serializedObject", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "identifier", + "fieldName": "identifier", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scheduling", + "fieldName": "scheduling", + "columnType": 8, + "isNullable": true, + "dartType": "protocol:FutureCallScheduling?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_future_call_time_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_future_call_serverId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_future_call_identifier_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "identifier" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_future_call_claim", + "dartName": "FutureCallClaimEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "futureCallId", + "fieldName": "futureCallId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastHeartbeatTime", + "fieldName": "lastHeartbeatTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_future_call_claim_fk_0", + "columns": [ + "futureCallId" + ], + "referenceTable": "serverpod_future_call", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "future_call_unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "futureCallId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_health_connection_info", + "dartName": "ServerHealthConnectionInfo", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "timestamp", + "fieldName": "timestamp", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "active", + "fieldName": "active", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "closing", + "fieldName": "closing", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "idle", + "fieldName": "idle", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "granularity", + "fieldName": "granularity", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_health_connection_info_timestamp_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "timestamp" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "granularity" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_health_metric", + "dartName": "ServerHealthMetric", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "timestamp", + "fieldName": "timestamp", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "isHealthy", + "fieldName": "isHealthy", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "granularity", + "fieldName": "granularity", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_health_metric_timestamp_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "timestamp" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "granularity" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_log", + "dartName": "LogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionLogId", + "fieldName": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageId", + "fieldName": "messageId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "reference", + "fieldName": "reference", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "time", + "fieldName": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logLevel", + "fieldName": "logLevel", + "columnType": 6, + "isNullable": false, + "dartType": "protocol:LogLevel" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "message", + "fieldName": "message", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "order", + "fieldName": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_log_sessionLogId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "sessionLogId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "order" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_message_log", + "dartName": "MessageLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionLogId", + "fieldName": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageId", + "fieldName": "messageId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "endpoint", + "fieldName": "endpoint", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageName", + "fieldName": "messageName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "duration", + "fieldName": "duration", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "slow", + "fieldName": "slow", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "order", + "fieldName": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_message_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_message_log_sessionLogId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "sessionLogId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "order" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_method", + "dartName": "MethodInfo", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "endpoint", + "fieldName": "endpoint", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_method_endpoint_method_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "endpoint" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "method" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_migrations", + "dartName": "DatabaseMigrationVersion", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "module", + "fieldName": "module", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "version", + "fieldName": "version", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "timestamp", + "fieldName": "timestamp", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_migrations_ids", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "module" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_query_log", + "dartName": "QueryLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionLogId", + "fieldName": "sessionLogId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "messageId", + "fieldName": "messageId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "query", + "fieldName": "query", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "duration", + "fieldName": "duration", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "numRows", + "fieldName": "numRows", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "slow", + "fieldName": "slow", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "order", + "fieldName": "order", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_query_log_fk_0", + "columns": [ + "sessionLogId" + ], + "referenceTable": "serverpod_session_log", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_query_log_sessionLogId_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "sessionLogId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "order" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_readwrite_test", + "dartName": "ReadWriteTestEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "number", + "fieldName": "number", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_runtime_settings", + "dartName": "RuntimeSettings", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logSettings", + "fieldName": "logSettings", + "columnType": 8, + "isNullable": false, + "dartType": "protocol:LogSettings" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logSettingsOverrides", + "fieldName": "logSettingsOverrides", + "columnType": 8, + "isNullable": false, + "dartType": "List" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logServiceCalls", + "fieldName": "logServiceCalls", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "logMalformedCalls", + "fieldName": "logMalformedCalls", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_session_log", + "dartName": "SessionLogEntry", + "module": "serverpod", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "serverId", + "fieldName": "serverId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "time", + "fieldName": "time", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "module", + "fieldName": "module", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "endpoint", + "fieldName": "endpoint", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "duration", + "fieldName": "duration", + "columnType": 3, + "isNullable": true, + "dartType": "double?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "numQueries", + "fieldName": "numQueries", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "slow", + "fieldName": "slow", + "columnType": 1, + "isNullable": true, + "dartType": "bool?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "error", + "fieldName": "error", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "stackTrace", + "fieldName": "stackTrace", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authenticatedUserId", + "fieldName": "authenticatedUserId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userId", + "fieldName": "userId", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "isOpen", + "fieldName": "isOpen", + "columnType": 1, + "isNullable": true, + "dartType": "bool?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "touched", + "fieldName": "touched", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_serverid_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "serverId" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_time_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "time" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_touched_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "touched" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_session_log_isopen_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "isOpen" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_jwt_refresh_token", + "dartName": "RefreshToken", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authUserId", + "fieldName": "authUserId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scopeNames", + "fieldName": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "Set" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "extraClaims", + "fieldName": "extraClaims", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "fixedSecret", + "fieldName": "fixedSecret", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rotatingSecretHash", + "fieldName": "rotatingSecretHash", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastUpdatedAt", + "fieldName": "lastUpdatedAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_jwt_refresh_token_fk_0", + "columns": [ + "authUserId" + ], + "referenceTable": "serverpod_auth_core_user", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_auth_core_jwt_refresh_token_last_updated_at", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "lastUpdatedAt" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_profile", + "dartName": "UserProfile", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authUserId", + "fieldName": "authUserId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userName", + "fieldName": "userName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "fullName", + "fieldName": "fullName", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "email", + "fieldName": "email", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "imageId", + "fieldName": "imageId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_profile_fk_0", + "columns": [ + "authUserId" + ], + "referenceTable": "serverpod_auth_core_user", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_profile_fk_1", + "columns": [ + "imageId" + ], + "referenceTable": "serverpod_auth_core_profile_image", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "serverpod_auth_profile_user_profile_email_auth_user_id", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "authUserId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_profile_image", + "dartName": "UserProfileImage", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userProfileId", + "fieldName": "userProfileId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "storageId", + "fieldName": "storageId", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "path", + "fieldName": "path", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "url", + "fieldName": "url", + "columnType": 0, + "isNullable": false, + "dartType": "Uri" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_profile_image_fk_0", + "columns": [ + "userProfileId" + ], + "referenceTable": "serverpod_auth_core_profile", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_session", + "dartName": "ServerSideSession", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "authUserId", + "fieldName": "authUserId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scopeNames", + "fieldName": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "Set" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastUsedAt", + "fieldName": "lastUsedAt", + "columnType": 4, + "isNullable": false, + "columnDefault": "now", + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expiresAt", + "fieldName": "expiresAt", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "expireAfterUnusedFor", + "fieldName": "expireAfterUnusedFor", + "columnType": 6, + "isNullable": true, + "dartType": "Duration?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionKeyHash", + "fieldName": "sessionKeyHash", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "sessionKeySalt", + "fieldName": "sessionKeySalt", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "method", + "fieldName": "method", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "serverpod_auth_core_session_fk_0", + "columns": [ + "authUserId" + ], + "referenceTable": "serverpod_auth_core_user", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "serverpod_auth_core_user", + "dartName": "AuthUser", + "module": "serverpod_auth_core", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "createdAt", + "fieldName": "createdAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scopeNames", + "fieldName": "scopeNames", + "columnType": 8, + "isNullable": false, + "dartType": "Set" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "blocked", + "fieldName": "blocked", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_attempted_value", + "dartName": "CrdtDataAttemptedValue", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "fieldId", + "fieldName": "fieldId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 14, + "isNullable": false, + "dartType": "dynamic" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "projectionReason", + "fieldName": "projectionReason", + "columnType": 6, + "isNullable": false, + "dartType": "serverpod_offline_sync:CrdtProjectionReason" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_attempted_value_fk_0", + "columns": [ + "fieldId" + ], + "referenceTable": "crdt_data_fields", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_attempted_value__fieldId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "fieldId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_fields", + "dartName": "CrdtDataField", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rowId", + "fieldName": "rowId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "columnId", + "fieldName": "columnId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_fields_fk_0", + "columns": [ + "rowId" + ], + "referenceTable": "crdt_data_rows", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_fields_fk_1", + "columns": [ + "columnId" + ], + "referenceTable": "crdt_schema_columns", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_fields_fk_2", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_fields_row_column_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rowId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "columnId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_rows", + "dartName": "CrdtDataRow", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "tblId", + "fieldName": "tblId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidRowId", + "fieldName": "uuidRowId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "visibility", + "fieldName": "visibility", + "columnType": 6, + "isNullable": false, + "columnDefault": "0", + "dartType": "serverpod_offline_sync:CrdtDataRowVisibility" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_rows_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_rows_fk_1", + "columns": [ + "tblId" + ], + "referenceTable": "crdt_schema_tables", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_rows_fk_2", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_rows_space_tbl_row_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "tblId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidRowId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_data_tombstone", + "dartName": "CrdtDataDeleted", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rowId", + "fieldName": "rowId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "clFlag", + "fieldName": "clFlag", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "reason", + "fieldName": "reason", + "columnType": 6, + "isNullable": false, + "dartType": "serverpod_offline_sync:CrdtDataDeletedReason" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_tombstone_fk_0", + "columns": [ + "rowId" + ], + "referenceTable": "crdt_data_rows", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_data_tombstone_fk_1", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_data_tombstone_row_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rowId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_nodes", + "dartName": "CrdtNode", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidNodeId", + "fieldName": "uuidNodeId", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastHlc", + "fieldName": "lastHlc", + "columnType": 14, + "isNullable": true, + "dartType": "package:serverpod_offline_sync/serverpod_offline_sync.dart:Hlc?" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_nodes__uuidNodeId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidNodeId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_schema_columns", + "dartName": "CrdtSchemaColumn", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "tblId", + "fieldName": "tblId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "columnType", + "fieldName": "columnType", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "dartType", + "fieldName": "dartType", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "isNullable", + "fieldName": "isNullable", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "crdt_schema_columns_fk_0", + "columns": [ + "tblId" + ], + "referenceTable": "crdt_schema_tables", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_schema_columns_table_column_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "tblId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "crdt_schema_tables", + "dartName": "CrdtSchemaTable", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "crdt_schema_tables__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_integrity_violations", + "dartName": "OfflineSyncIntegrityViolation", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "type", + "fieldName": "type", + "columnType": 0, + "isNullable": false, + "dartType": "serverpod_offline_sync:OfflineSyncViolationType" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "domainTableName", + "fieldName": "domainTableName", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidRowId", + "fieldName": "uuidRowId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "ownerSpaceUuid", + "fieldName": "ownerSpaceUuid", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "incomingSpaceUuid", + "fieldName": "incomingSpaceUuid", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "operation", + "fieldName": "operation", + "columnType": 0, + "isNullable": false, + "dartType": "serverpod_offline_sync:OfflineSyncViolationOperation" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidNodeId", + "fieldName": "uuidNodeId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "crdtDataRowId", + "fieldName": "crdtDataRowId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcDatetime", + "fieldName": "hlcDatetime", + "columnType": 4, + "isNullable": true, + "dartType": "DateTime?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "hlcCounter", + "fieldName": "hlcCounter", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "firstSeenAt", + "fieldName": "firstSeenAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastSeenAt", + "fieldName": "lastSeenAt", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "occurrences", + "fieldName": "occurrences", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_integrity_violations_key_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "type" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "operation" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "domainTableName" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidRowId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "ownerSpaceUuid" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "incomingSpaceUuid" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_space_members", + "dartName": "OfflineSyncSpaceMember", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "userUuid", + "fieldName": "userUuid", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "role", + "fieldName": "role", + "columnType": 0, + "isNullable": false, + "dartType": "serverpod_offline_sync:OfflineSyncSpaceRole" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_space_members_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_space_member_unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "userUuid" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_space_nodes", + "dartName": "OfflineSyncSpaceNode", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "nodeId", + "fieldName": "nodeId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "lastReceivedHlc", + "fieldName": "lastReceivedHlc", + "columnType": 14, + "isNullable": true, + "dartType": "package:serverpod_offline_sync/serverpod_offline_sync.dart:Hlc?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_space_nodes_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_space_nodes_fk_1", + "columns": [ + "nodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_space_node_unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "nodeId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "offline_sync_spaces", + "dartName": "OfflineSyncSpace", + "module": "serverpod_offline_sync", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 6, + "isNullable": false, + "columnDefault": "serial", + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "uuidSpaceId", + "fieldName": "uuidSpaceId", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "currentNodeId", + "fieldName": "currentNodeId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "offline_sync_spaces_fk_0", + "columns": [ + "currentNodeId" + ], + "referenceTable": "crdt_nodes", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "offline_sync_spaces__uuidSpaceId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "uuidSpaceId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + ], + "installedModules": [ + { + "__className__": "serverpod.DatabaseMigrationVersionModel", + "module": "serverpod_offline_sync_test", + "version": "20261007215503877" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod", + "version": "20260824182259319" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_auth_core", + "version": "20260924105232991" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_offline_sync", + "version": "20260914143806119" + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.sql b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.sql new file mode 100644 index 0000000..c596ceb --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition.sql @@ -0,0 +1,1218 @@ +BEGIN; + +-- +-- Class Address as table address +-- +CREATE TABLE "address" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "street" TEXT NOT NULL, + "inhabitantId" BLOB, + CONSTRAINT "address_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "address_fk_1" FOREIGN KEY ("inhabitantId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "address__inhabitantId__unique_idx" ON "address" ("inhabitantId"); + + +-- +-- Class City as table city +-- +CREATE TABLE "city" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "city_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class Company as table company +-- +CREATE TABLE "company" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "townId" BLOB NOT NULL DEFAULT (X'550e8400e29b41d4a716446655440000'), + CONSTRAINT "company_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "company_fk_1" FOREIGN KEY ("townId") REFERENCES "town" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainCascadeMiddle as table fk_chain_cascade_middle +-- +CREATE TABLE "fk_chain_cascade_middle" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "rootId" BLOB, + CONSTRAINT "fk_chain_cascade_middle_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_cascade_middle_fk_1" FOREIGN KEY ("rootId") REFERENCES "fk_chain_root" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainMiddleCascadeChild as table fk_chain_middle_cascade_child +-- +CREATE TABLE "fk_chain_middle_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "restrictBlockerId" BLOB, + CONSTRAINT "fk_chain_middle_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_middle_cascade_child_fk_1" FOREIGN KEY ("restrictBlockerId") REFERENCES "fk_chain_restrict_blocker" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainMiddleSetNullChild as table fk_chain_middle_set_null_child +-- +CREATE TABLE "fk_chain_middle_set_null_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "restrictBlockerId" BLOB, + CONSTRAINT "fk_chain_middle_set_null_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_middle_set_null_child_fk_1" FOREIGN KEY ("restrictBlockerId") REFERENCES "fk_chain_restrict_blocker" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainRestrictBlocker as table fk_chain_restrict_blocker +-- +CREATE TABLE "fk_chain_restrict_blocker" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cascadeMiddleId" BLOB, + CONSTRAINT "fk_chain_restrict_blocker_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_restrict_blocker_fk_1" FOREIGN KEY ("cascadeMiddleId") REFERENCES "fk_chain_cascade_middle" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainRoot as table fk_chain_root +-- +CREATE TABLE "fk_chain_root" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "fk_chain_root_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class FkChainSetNullCascadeChild as table fk_chain_set_null_cascade_child +-- +CREATE TABLE "fk_chain_set_null_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "setNullMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_cascade_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainSetNullMiddle as table fk_chain_set_null_middle +-- +CREATE TABLE "fk_chain_set_null_middle" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cascadeMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_middle_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_middle_fk_1" FOREIGN KEY ("cascadeMiddleId") REFERENCES "fk_chain_cascade_middle" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainSetNullRestrictChild as table fk_chain_set_null_restrict_child +-- +CREATE TABLE "fk_chain_set_null_restrict_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "setNullMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_restrict_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_restrict_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class FkChainSetNullSetNullChild as table fk_chain_set_null_set_null_child +-- +CREATE TABLE "fk_chain_set_null_set_null_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "setNullMiddleId" BLOB, + CONSTRAINT "fk_chain_set_null_set_null_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "fk_chain_set_null_set_null_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class Organization as table organization +-- +CREATE TABLE "organization" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cityId" BLOB, + CONSTRAINT "organization_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "organization_fk_1" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class Person as table person +-- +CREATE TABLE "person" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "surname" TEXT, + "organizationId" BLOB, + "oldCompanyId" BLOB, + "cityId" BLOB, + CONSTRAINT "person_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "person_fk_1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "person_fk_2" FOREIGN KEY ("oldCompanyId") REFERENCES "company" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT "person_fk_3" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class RequiredCascadeChild as table required_cascade_child +-- +CREATE TABLE "required_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB NOT NULL, + CONSTRAINT "required_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "required_cascade_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class RequiredNoActionChild as table required_no_action_child +-- +CREATE TABLE "required_no_action_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB NOT NULL, + CONSTRAINT "required_no_action_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "required_no_action_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class RestrictChild as table restrict_child +-- +CREATE TABLE "restrict_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "restrict_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "restrict_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class SharedChild as table shared_child +-- +CREATE TABLE "shared_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "flavor" TEXT NOT NULL DEFAULT ('plain'), + "parentId" BLOB, + CONSTRAINT "shared_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "shared_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "shared_parent" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class SharedParent as table shared_parent +-- +CREATE TABLE "shared_parent" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "shared_parent_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class Town as table town +-- +CREATE TABLE "town" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "cityId" BLOB, + "mayorId" BLOB, + CONSTRAINT "town_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "town_fk_1" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "town_fk_2" FOREIGN KEY ("mayorId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + + +-- +-- Class Types as table types +-- +CREATE TABLE "types" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "aBool" INTEGER NOT NULL, + "aDateTime" INTEGER NOT NULL, + "aText" TEXT NOT NULL, + "anInt" INTEGER NOT NULL, + "anInt64" TEXT NOT NULL, + "aReal" REAL NOT NULL, + "aBlob" BLOB NOT NULL, + "anEnum" INTEGER, + "optionalText" TEXT, + "optionalUuid" BLOB, + "parentId" BLOB, + "jsonDocument" TEXT, + "jsonbDocument" BLOB, + "jsonbNumbers" BLOB, + CONSTRAINT "types_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "types_fk_1" FOREIGN KEY ("parentId") REFERENCES "types" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "types_a_text_idx" ON "types" ("aText"); + + +-- +-- Class Unique as table unique +-- +CREATE TABLE "unique" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + CONSTRAINT "unique_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique__spaceId__name__unique_idx" ON "unique" ("spaceId", "name"); + + +-- +-- Class UniqueCascadeChild as table unique_cascade_child +-- +CREATE TABLE "unique_cascade_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_cascade_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_cascade_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_cascade_child__spaceId__name__unique_idx" ON "unique_cascade_child" ("spaceId", "name"); + + +-- +-- Class UniqueCascadeReference as table unique_cascade_reference +-- +CREATE TABLE "unique_cascade_reference" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_cascade_reference_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_cascade_reference_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_cascade_reference__parentId__unique_idx" ON "unique_cascade_reference" ("parentId"); + + +-- +-- Class UniqueComposite as table unique_composite +-- +CREATE TABLE "unique_composite" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "scope" TEXT NOT NULL, + "value" TEXT NOT NULL, + CONSTRAINT "unique_composite_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_composite__spaceId__scope__value__unique_idx" ON "unique_composite" ("spaceId", "scope", "value"); + + +-- +-- Class UniqueDiscriminator as table unique_discriminator +-- +CREATE TABLE "unique_discriminator" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "categoryId" INTEGER NOT NULL, + "name" TEXT NOT NULL, + CONSTRAINT "unique_discriminator_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_discriminator__spaceId__categoryId__name__unique_idx" ON "unique_discriminator" ("spaceId", "categoryId", "name"); + + +-- +-- Class UniqueFkPair as table unique_fk_pair +-- +CREATE TABLE "unique_fk_pair" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "leftId" BLOB, + "rightId" BLOB, + CONSTRAINT "unique_fk_pair_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_fk_pair_fk_1" FOREIGN KEY ("leftId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "unique_fk_pair_fk_2" FOREIGN KEY ("rightId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_fk_pair_parents" ON "unique_fk_pair" ("leftId", "rightId"); + + +-- +-- Class UniqueMixedFk as table unique_mixed_fk +-- +CREATE TABLE "unique_mixed_fk" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_mixed_fk_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_mixed_fk_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_mixed_fk_name_parent" ON "unique_mixed_fk" ("spaceId", "name", "parentId"); + + +-- +-- Class UniqueNoRelease as table unique_no_release +-- +CREATE TABLE "unique_no_release" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "categoryId" INTEGER NOT NULL, + CONSTRAINT "unique_no_release_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_no_release__spaceId__categoryId__unique_idx" ON "unique_no_release" ("spaceId", "categoryId"); + + +-- +-- Class UniqueNullable as table unique_nullable +-- +CREATE TABLE "unique_nullable" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "value" INTEGER, + CONSTRAINT "unique_nullable_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_nullable__spaceId__value__unique_idx" ON "unique_nullable" ("spaceId", "value"); + + +-- +-- Class UniqueOverlapping as table unique_overlapping +-- +CREATE TABLE "unique_overlapping" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "first" TEXT NOT NULL, + "second" TEXT NOT NULL, + "third" TEXT NOT NULL, + CONSTRAINT "unique_overlapping_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_overlapping_first_second" ON "unique_overlapping" ("spaceId", "first", "second"); +CREATE UNIQUE INDEX "unique_overlapping_second_third" ON "unique_overlapping" ("spaceId", "second", "third"); + + +-- +-- Class UniqueSetDefaultChild as table unique_set_default_child +-- +CREATE TABLE "unique_set_default_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB DEFAULT (X'550e8400e29b41d4a716446655440000'), + CONSTRAINT "unique_set_default_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_set_default_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "town" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_set_default_child__parentId__unique_idx" ON "unique_set_default_child" ("parentId"); + + +-- +-- Class UniqueSetNullChild as table unique_set_null_child +-- +CREATE TABLE "unique_set_null_child" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "name" TEXT NOT NULL, + "parentId" BLOB, + CONSTRAINT "unique_set_null_child_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "unique_set_null_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_set_null_child__parentId__unique_idx" ON "unique_set_null_child" ("parentId"); + + +-- +-- Class UniqueUuid as table unique_uuid +-- +CREATE TABLE "unique_uuid" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "spaceId" INTEGER, + "value" BLOB NOT NULL, + CONSTRAINT "unique_uuid_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "unique_uuid__spaceId__value__unique_idx" ON "unique_uuid" ("spaceId", "value"); + + +-- +-- Class CloudStorageEntry as table serverpod_cloud_storage +-- +CREATE TABLE "serverpod_cloud_storage" ( + "id" INTEGER PRIMARY KEY, + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "addedTime" INTEGER NOT NULL, + "expiration" INTEGER, + "byteData" BLOB NOT NULL, + "verified" INTEGER NOT NULL, + "contentType" TEXT, + "cacheControl" TEXT, + "contentDisposition" TEXT, + "contentEncoding" TEXT, + "customMetadata" TEXT +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_path_idx" ON "serverpod_cloud_storage" ("storageId", "path"); +CREATE INDEX "serverpod_cloud_storage_expiration" ON "serverpod_cloud_storage" ("expiration"); + + +-- +-- Class CloudStorageDirectDownloadEntry as table serverpod_cloud_storage_direct_download +-- +CREATE TABLE "serverpod_cloud_storage_direct_download" ( + "id" INTEGER PRIMARY KEY, + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "expiration" INTEGER NOT NULL, + "authKey" TEXT NOT NULL, + "downloadFileName" TEXT, + "contentType" TEXT +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_download_auth_key" ON "serverpod_cloud_storage_direct_download" ("authKey"); +CREATE INDEX "serverpod_cloud_storage_direct_download_expiration" ON "serverpod_cloud_storage_direct_download" ("expiration"); + + +-- +-- Class CloudStorageDirectUploadEntry as table serverpod_cloud_storage_direct_upload +-- +CREATE TABLE "serverpod_cloud_storage_direct_upload" ( + "id" INTEGER PRIMARY KEY, + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "expiration" INTEGER NOT NULL, + "authKey" TEXT NOT NULL, + "maxFileSize" INTEGER NOT NULL DEFAULT (10485760), + "contentLength" INTEGER, + "preventOverwrite" INTEGER NOT NULL DEFAULT (0), + "contentType" TEXT, + "cacheControl" TEXT, + "contentDisposition" TEXT, + "contentEncoding" TEXT, + "customMetadata" TEXT +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" ("storageId", "path"); + + +-- +-- Class FutureCallEntry as table serverpod_future_call +-- +CREATE TABLE "serverpod_future_call" ( + "id" INTEGER PRIMARY KEY, + "name" TEXT NOT NULL, + "time" INTEGER NOT NULL, + "serializedObject" TEXT, + "serverId" TEXT NOT NULL, + "identifier" TEXT, + "scheduling" TEXT +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_future_call_time_idx" ON "serverpod_future_call" ("time"); +CREATE INDEX "serverpod_future_call_serverId_idx" ON "serverpod_future_call" ("serverId"); +CREATE INDEX "serverpod_future_call_identifier_idx" ON "serverpod_future_call" ("identifier"); + + +-- +-- Class FutureCallClaimEntry as table serverpod_future_call_claim +-- +CREATE TABLE "serverpod_future_call_claim" ( + "id" INTEGER PRIMARY KEY, + "futureCallId" INTEGER, + "lastHeartbeatTime" INTEGER NOT NULL, + CONSTRAINT "serverpod_future_call_claim_fk_0" FOREIGN KEY ("futureCallId") REFERENCES "serverpod_future_call" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "future_call_unique_idx" ON "serverpod_future_call_claim" ("futureCallId"); + + +-- +-- Class ServerHealthConnectionInfo as table serverpod_health_connection_info +-- +CREATE TABLE "serverpod_health_connection_info" ( + "id" INTEGER PRIMARY KEY, + "serverId" TEXT NOT NULL, + "timestamp" INTEGER NOT NULL, + "active" INTEGER NOT NULL, + "closing" INTEGER NOT NULL, + "idle" INTEGER NOT NULL, + "granularity" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_health_connection_info_timestamp_idx" ON "serverpod_health_connection_info" ("timestamp", "serverId", "granularity"); + + +-- +-- Class ServerHealthMetric as table serverpod_health_metric +-- +CREATE TABLE "serverpod_health_metric" ( + "id" INTEGER PRIMARY KEY, + "name" TEXT NOT NULL, + "serverId" TEXT NOT NULL, + "timestamp" INTEGER NOT NULL, + "isHealthy" INTEGER NOT NULL, + "value" REAL NOT NULL, + "granularity" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_health_metric_timestamp_idx" ON "serverpod_health_metric" ("timestamp", "serverId", "name", "granularity"); + + +-- +-- Class LogEntry as table serverpod_log +-- +CREATE TABLE "serverpod_log" ( + "id" INTEGER PRIMARY KEY, + "sessionLogId" INTEGER NOT NULL, + "messageId" INTEGER, + "reference" TEXT, + "serverId" TEXT NOT NULL, + "time" INTEGER NOT NULL, + "logLevel" INTEGER NOT NULL, + "message" TEXT NOT NULL, + "error" TEXT, + "stackTrace" TEXT, + "order" INTEGER NOT NULL, + CONSTRAINT "serverpod_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_log_sessionLogId_idx" ON "serverpod_log" ("sessionLogId", "order"); + + +-- +-- Class MessageLogEntry as table serverpod_message_log +-- +CREATE TABLE "serverpod_message_log" ( + "id" INTEGER PRIMARY KEY, + "sessionLogId" INTEGER NOT NULL, + "serverId" TEXT NOT NULL, + "messageId" INTEGER NOT NULL, + "endpoint" TEXT NOT NULL, + "messageName" TEXT NOT NULL, + "duration" REAL NOT NULL, + "error" TEXT, + "stackTrace" TEXT, + "slow" INTEGER NOT NULL, + "order" INTEGER NOT NULL, + CONSTRAINT "serverpod_message_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_message_log_sessionLogId_idx" ON "serverpod_message_log" ("sessionLogId", "order"); + + +-- +-- Class MethodInfo as table serverpod_method +-- +CREATE TABLE "serverpod_method" ( + "id" INTEGER PRIMARY KEY, + "endpoint" TEXT NOT NULL, + "method" TEXT NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_method_endpoint_method_idx" ON "serverpod_method" ("endpoint", "method"); + + +-- +-- Class DatabaseMigrationVersion as table serverpod_migrations +-- +CREATE TABLE "serverpod_migrations" ( + "id" INTEGER PRIMARY KEY, + "module" TEXT NOT NULL, + "version" TEXT NOT NULL, + "timestamp" INTEGER +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_migrations_ids" ON "serverpod_migrations" ("module"); + + +-- +-- Class QueryLogEntry as table serverpod_query_log +-- +CREATE TABLE "serverpod_query_log" ( + "id" INTEGER PRIMARY KEY, + "serverId" TEXT NOT NULL, + "sessionLogId" INTEGER NOT NULL, + "messageId" INTEGER, + "query" TEXT NOT NULL, + "duration" REAL NOT NULL, + "numRows" INTEGER, + "error" TEXT, + "stackTrace" TEXT, + "slow" INTEGER NOT NULL, + "order" INTEGER NOT NULL, + CONSTRAINT "serverpod_query_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_query_log_sessionLogId_idx" ON "serverpod_query_log" ("sessionLogId", "order"); + + +-- +-- Class ReadWriteTestEntry as table serverpod_readwrite_test +-- +CREATE TABLE "serverpod_readwrite_test" ( + "id" INTEGER PRIMARY KEY, + "number" INTEGER NOT NULL +) STRICT; + + +-- +-- Class RuntimeSettings as table serverpod_runtime_settings +-- +CREATE TABLE "serverpod_runtime_settings" ( + "id" INTEGER PRIMARY KEY, + "logSettings" TEXT NOT NULL, + "logSettingsOverrides" TEXT NOT NULL, + "logServiceCalls" INTEGER NOT NULL, + "logMalformedCalls" INTEGER NOT NULL +) STRICT; + + +-- +-- Class SessionLogEntry as table serverpod_session_log +-- +CREATE TABLE "serverpod_session_log" ( + "id" INTEGER PRIMARY KEY, + "serverId" TEXT NOT NULL, + "time" INTEGER NOT NULL, + "module" TEXT, + "endpoint" TEXT, + "method" TEXT, + "duration" REAL, + "numQueries" INTEGER, + "slow" INTEGER, + "error" TEXT, + "stackTrace" TEXT, + "authenticatedUserId" INTEGER, + "userId" TEXT, + "isOpen" INTEGER, + "touched" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_session_log_serverid_idx" ON "serverpod_session_log" ("serverId"); +CREATE INDEX "serverpod_session_log_time_idx" ON "serverpod_session_log" ("time"); +CREATE INDEX "serverpod_session_log_touched_idx" ON "serverpod_session_log" ("touched"); +CREATE INDEX "serverpod_session_log_isopen_idx" ON "serverpod_session_log" ("isOpen"); + + +-- +-- Class RefreshToken as table serverpod_auth_core_jwt_refresh_token +-- +CREATE TABLE "serverpod_auth_core_jwt_refresh_token" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "authUserId" BLOB NOT NULL, + "scopeNames" TEXT NOT NULL, + "extraClaims" TEXT, + "method" TEXT NOT NULL, + "fixedSecret" BLOB NOT NULL, + "rotatingSecretHash" TEXT NOT NULL, + "lastUpdatedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + CONSTRAINT "serverpod_auth_core_jwt_refresh_token_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE INDEX "serverpod_auth_core_jwt_refresh_token_last_updated_at" ON "serverpod_auth_core_jwt_refresh_token" ("lastUpdatedAt"); + + +-- +-- Class UserProfile as table serverpod_auth_core_profile +-- +CREATE TABLE "serverpod_auth_core_profile" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "authUserId" BLOB NOT NULL, + "userName" TEXT, + "fullName" TEXT, + "email" TEXT, + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "imageId" BLOB, + CONSTRAINT "serverpod_auth_core_profile_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "serverpod_auth_core_profile_fk_1" FOREIGN KEY ("imageId") REFERENCES "serverpod_auth_core_profile_image" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "serverpod_auth_profile_user_profile_email_auth_user_id" ON "serverpod_auth_core_profile" ("authUserId"); + + +-- +-- Class UserProfileImage as table serverpod_auth_core_profile_image +-- +CREATE TABLE "serverpod_auth_core_profile_image" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "userProfileId" BLOB NOT NULL, + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "storageId" TEXT NOT NULL, + "path" TEXT NOT NULL, + "url" TEXT NOT NULL, + CONSTRAINT "serverpod_auth_core_profile_image_fk_0" FOREIGN KEY ("userProfileId") REFERENCES "serverpod_auth_core_profile" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class ServerSideSession as table serverpod_auth_core_session +-- +CREATE TABLE "serverpod_auth_core_session" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "authUserId" BLOB NOT NULL, + "scopeNames" TEXT NOT NULL, + "createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "lastUsedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)), + "expiresAt" INTEGER, + "expireAfterUnusedFor" INTEGER, + "sessionKeyHash" BLOB NOT NULL, + "sessionKeySalt" BLOB NOT NULL, + "method" TEXT NOT NULL, + CONSTRAINT "serverpod_auth_core_session_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + + +-- +-- Class AuthUser as table serverpod_auth_core_user +-- +CREATE TABLE "serverpod_auth_core_user" ( + "id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "createdAt" INTEGER NOT NULL, + "scopeNames" TEXT NOT NULL, + "blocked" INTEGER NOT NULL +) STRICT; + + +-- +-- Class CrdtDataAttemptedValue as table crdt_data_attempted_value +-- +CREATE TABLE "crdt_data_attempted_value" ( + "id" INTEGER PRIMARY KEY, + "fieldId" INTEGER NOT NULL, + "value" BLOB NOT NULL, + "projectionReason" INTEGER NOT NULL, + CONSTRAINT "crdt_data_attempted_value_fk_0" FOREIGN KEY ("fieldId") REFERENCES "crdt_data_fields" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_attempted_value__fieldId__unique_idx" ON "crdt_data_attempted_value" ("fieldId"); + + +-- +-- Class CrdtDataField as table crdt_data_fields +-- +CREATE TABLE "crdt_data_fields" ( + "id" INTEGER PRIMARY KEY, + "hlcDatetime" INTEGER NOT NULL, + "hlcCounter" INTEGER NOT NULL, + "rowId" INTEGER NOT NULL, + "columnId" INTEGER NOT NULL, + "nodeId" INTEGER NOT NULL, + CONSTRAINT "crdt_data_fields_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_fields_fk_1" FOREIGN KEY ("columnId") REFERENCES "crdt_schema_columns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_fields_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_fields_row_column_idx" ON "crdt_data_fields" ("rowId", "columnId"); + + +-- +-- Class CrdtDataRow as table crdt_data_rows +-- +CREATE TABLE "crdt_data_rows" ( + "id" INTEGER PRIMARY KEY, + "hlcDatetime" INTEGER NOT NULL, + "hlcCounter" INTEGER NOT NULL, + "spaceId" INTEGER NOT NULL, + "tblId" INTEGER NOT NULL, + "uuidRowId" BLOB NOT NULL, + "nodeId" INTEGER NOT NULL, + "visibility" INTEGER NOT NULL DEFAULT (0), + CONSTRAINT "crdt_data_rows_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_rows_fk_1" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_rows_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_rows_space_tbl_row_idx" ON "crdt_data_rows" ("spaceId", "tblId", "uuidRowId"); + + +-- +-- Class CrdtDataDeleted as table crdt_data_tombstone +-- +CREATE TABLE "crdt_data_tombstone" ( + "id" INTEGER PRIMARY KEY, + "hlcDatetime" INTEGER NOT NULL, + "hlcCounter" INTEGER NOT NULL, + "rowId" INTEGER NOT NULL, + "nodeId" INTEGER NOT NULL, + "clFlag" INTEGER NOT NULL, + "reason" INTEGER NOT NULL, + CONSTRAINT "crdt_data_tombstone_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "crdt_data_tombstone_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_data_tombstone_row_idx" ON "crdt_data_tombstone" ("rowId"); + + +-- +-- Class CrdtNode as table crdt_nodes +-- +CREATE TABLE "crdt_nodes" ( + "id" INTEGER PRIMARY KEY, + "uuidNodeId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "lastHlc" BLOB +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_nodes__uuidNodeId__unique_idx" ON "crdt_nodes" ("uuidNodeId"); + + +-- +-- Class CrdtSchemaColumn as table crdt_schema_columns +-- +CREATE TABLE "crdt_schema_columns" ( + "id" INTEGER PRIMARY KEY, + "tblId" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "columnType" TEXT NOT NULL, + "dartType" TEXT NOT NULL, + "isNullable" INTEGER NOT NULL, + CONSTRAINT "crdt_schema_columns_fk_0" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_schema_columns_table_column_idx" ON "crdt_schema_columns" ("tblId", "name"); + + +-- +-- Class CrdtSchemaTable as table crdt_schema_tables +-- +CREATE TABLE "crdt_schema_tables" ( + "id" INTEGER PRIMARY KEY, + "name" TEXT NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "crdt_schema_tables__name__unique_idx" ON "crdt_schema_tables" ("name"); + + +-- +-- Class OfflineSyncIntegrityViolation as table offline_sync_integrity_violations +-- +CREATE TABLE "offline_sync_integrity_violations" ( + "id" INTEGER PRIMARY KEY, + "type" TEXT NOT NULL, + "domainTableName" TEXT NOT NULL, + "uuidRowId" BLOB NOT NULL, + "ownerSpaceUuid" BLOB, + "incomingSpaceUuid" BLOB NOT NULL, + "operation" TEXT NOT NULL, + "uuidNodeId" BLOB, + "crdtDataRowId" INTEGER, + "hlcDatetime" INTEGER, + "hlcCounter" INTEGER, + "firstSeenAt" INTEGER NOT NULL, + "lastSeenAt" INTEGER NOT NULL, + "occurrences" INTEGER NOT NULL +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_integrity_violations_key_idx" ON "offline_sync_integrity_violations" ("type", "operation", "domainTableName", "uuidRowId", "ownerSpaceUuid", "incomingSpaceUuid"); + + +-- +-- Class OfflineSyncSpaceMember as table offline_sync_space_members +-- +CREATE TABLE "offline_sync_space_members" ( + "id" INTEGER PRIMARY KEY, + "spaceId" INTEGER NOT NULL, + "userUuid" BLOB NOT NULL, + "role" TEXT NOT NULL, + CONSTRAINT "offline_sync_space_members_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_space_member_unique_idx" ON "offline_sync_space_members" ("userUuid", "spaceId"); + + +-- +-- Class OfflineSyncSpaceNode as table offline_sync_space_nodes +-- +CREATE TABLE "offline_sync_space_nodes" ( + "id" INTEGER PRIMARY KEY, + "spaceId" INTEGER NOT NULL, + "nodeId" INTEGER NOT NULL, + "lastReceivedHlc" BLOB, + CONSTRAINT "offline_sync_space_nodes_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT "offline_sync_space_nodes_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_space_node_unique_idx" ON "offline_sync_space_nodes" ("spaceId", "nodeId"); + + +-- +-- Class OfflineSyncSpace as table offline_sync_spaces +-- +CREATE TABLE "offline_sync_spaces" ( + "id" INTEGER PRIMARY KEY, + "uuidSpaceId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))), + "currentNodeId" INTEGER, + CONSTRAINT "offline_sync_spaces_fk_0" FOREIGN KEY ("currentNodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +) STRICT; + +-- Indexes +CREATE UNIQUE INDEX "offline_sync_spaces__uuidSpaceId__unique_idx" ON "offline_sync_spaces" ("uuidSpaceId"); + + +-- +-- STORE COLUMN TYPES FOR MIGRATIONS +-- +DROP TABLE IF EXISTS "serverpod_sqlite_schema"; + +CREATE TABLE "serverpod_sqlite_schema" ( + "table_name" TEXT NOT NULL, + "column_name" TEXT NOT NULL, + "column_type" TEXT NOT NULL, + "column_vector_dimension" INTEGER, + PRIMARY KEY ("table_name", "column_name") +); + +INSERT INTO "serverpod_sqlite_schema" VALUES + ('address', 'id', 'uuid', NULL), + ('address', 'inhabitantId', 'uuid', NULL), + ('city', 'id', 'uuid', NULL), + ('company', 'id', 'uuid', NULL), + ('company', 'townId', 'uuid', NULL), + ('fk_chain_cascade_middle', 'id', 'uuid', NULL), + ('fk_chain_cascade_middle', 'rootId', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'id', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_root', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_middle', 'id', 'uuid', NULL), + ('fk_chain_set_null_middle', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'setNullMiddleId', 'uuid', NULL), + ('organization', 'id', 'uuid', NULL), + ('organization', 'cityId', 'uuid', NULL), + ('person', 'id', 'uuid', NULL), + ('person', 'organizationId', 'uuid', NULL), + ('person', 'oldCompanyId', 'uuid', NULL), + ('person', 'cityId', 'uuid', NULL), + ('required_cascade_child', 'id', 'uuid', NULL), + ('required_cascade_child', 'parentId', 'uuid', NULL), + ('required_no_action_child', 'id', 'uuid', NULL), + ('required_no_action_child', 'parentId', 'uuid', NULL), + ('restrict_child', 'id', 'uuid', NULL), + ('restrict_child', 'parentId', 'uuid', NULL), + ('shared_child', 'id', 'uuid', NULL), + ('shared_child', 'parentId', 'uuid', NULL), + ('shared_parent', 'id', 'uuid', NULL), + ('town', 'id', 'uuid', NULL), + ('town', 'cityId', 'uuid', NULL), + ('town', 'mayorId', 'uuid', NULL), + ('types', 'id', 'uuid', NULL), + ('types', 'aBool', 'boolean', NULL), + ('types', 'aDateTime', 'timestampWithoutTimeZone', NULL), + ('types', 'optionalUuid', 'uuid', NULL), + ('types', 'parentId', 'uuid', NULL), + ('types', 'jsonDocument', 'json', NULL), + ('types', 'jsonbDocument', 'jsonb', NULL), + ('types', 'jsonbNumbers', 'jsonb', NULL), + ('unique', 'id', 'uuid', NULL), + ('unique_cascade_child', 'id', 'uuid', NULL), + ('unique_cascade_child', 'parentId', 'uuid', NULL), + ('unique_cascade_reference', 'id', 'uuid', NULL), + ('unique_cascade_reference', 'parentId', 'uuid', NULL), + ('unique_composite', 'id', 'uuid', NULL), + ('unique_discriminator', 'id', 'uuid', NULL), + ('unique_fk_pair', 'id', 'uuid', NULL), + ('unique_fk_pair', 'leftId', 'uuid', NULL), + ('unique_fk_pair', 'rightId', 'uuid', NULL), + ('unique_mixed_fk', 'id', 'uuid', NULL), + ('unique_mixed_fk', 'parentId', 'uuid', NULL), + ('unique_no_release', 'id', 'uuid', NULL), + ('unique_nullable', 'id', 'uuid', NULL), + ('unique_overlapping', 'id', 'uuid', NULL), + ('unique_set_default_child', 'id', 'uuid', NULL), + ('unique_set_default_child', 'parentId', 'uuid', NULL), + ('unique_set_null_child', 'id', 'uuid', NULL), + ('unique_set_null_child', 'parentId', 'uuid', NULL), + ('unique_uuid', 'id', 'uuid', NULL), + ('unique_uuid', 'value', 'uuid', NULL), + ('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'verified', 'boolean', NULL), + ('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL), + ('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_future_call', 'scheduling', 'json', NULL), + ('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'isHealthy', 'boolean', NULL), + ('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_message_log', 'slow', 'boolean', NULL), + ('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_query_log', 'slow', 'boolean', NULL), + ('serverpod_runtime_settings', 'logSettings', 'json', NULL), + ('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL), + ('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL), + ('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL), + ('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_session_log', 'slow', 'boolean', NULL), + ('serverpod_session_log', 'isOpen', 'boolean', NULL), + ('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'imageId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'id', 'uuid', NULL), + ('serverpod_auth_core_session', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_session', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'id', 'uuid', NULL), + ('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_user', 'blocked', 'boolean', NULL), + ('crdt_data_attempted_value', 'value', 'jsonb', NULL), + ('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'uuidRowId', 'uuid', NULL), + ('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_nodes', 'uuidNodeId', 'uuid', NULL), + ('crdt_nodes', 'lastHlc', 'jsonb', NULL), + ('crdt_schema_columns', 'isNullable', 'boolean', NULL), + ('offline_sync_integrity_violations', 'uuidRowId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'ownerSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'incomingSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_space_members', 'userUuid', 'uuid', NULL), + ('offline_sync_space_nodes', 'lastReceivedHlc', 'jsonb', NULL), + ('offline_sync_spaces', 'uuidSpaceId', 'uuid', NULL); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync_test +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync_test', '20261007215503877', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261007215503877', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod', '20260824182259319', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260824182259319', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_auth_core +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_auth_core', '20260924105232991', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260924105232991', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync', '20260914143806119', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260914143806119', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + + +COMMIT; diff --git a/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition_project.json b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition_project.json new file mode 100644 index 0000000..73b52d7 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/definition_project.json @@ -0,0 +1,2900 @@ +{ + "__className__": "serverpod.DatabaseDefinition", + "schemaVersion": 2, + "moduleName": "serverpod_offline_sync_test", + "tables": [ + { + "__className__": "serverpod.TableDefinition", + "name": "address", + "dartName": "Address", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "street", + "fieldName": "street", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "inhabitantId", + "fieldName": "inhabitantId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "address_fk_1", + "columns": [ + "inhabitantId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "address__inhabitantId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "inhabitantId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "city", + "dartName": "City", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "city_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "company", + "dartName": "Company", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "townId", + "fieldName": "townId", + "columnType": 7, + "isNullable": false, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "company_fk_1", + "columns": [ + "townId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_cascade_middle", + "dartName": "FkChainCascadeMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rootId", + "fieldName": "rootId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_cascade_middle_fk_1", + "columns": [ + "rootId" + ], + "referenceTable": "fk_chain_root", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_cascade_child", + "dartName": "FkChainMiddleCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_cascade_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_middle_set_null_child", + "dartName": "FkChainMiddleSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "restrictBlockerId", + "fieldName": "restrictBlockerId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_middle_set_null_child_fk_1", + "columns": [ + "restrictBlockerId" + ], + "referenceTable": "fk_chain_restrict_blocker", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_restrict_blocker", + "dartName": "FkChainRestrictBlocker", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_restrict_blocker_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_root", + "dartName": "FkChainRoot", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_root_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_cascade_child", + "dartName": "FkChainSetNullCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_cascade_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_middle", + "dartName": "FkChainSetNullMiddle", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cascadeMiddleId", + "fieldName": "cascadeMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_middle_fk_1", + "columns": [ + "cascadeMiddleId" + ], + "referenceTable": "fk_chain_cascade_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_restrict_child", + "dartName": "FkChainSetNullRestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_restrict_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "fk_chain_set_null_set_null_child", + "dartName": "FkChainSetNullSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "setNullMiddleId", + "fieldName": "setNullMiddleId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "fk_chain_set_null_set_null_child_fk_1", + "columns": [ + "setNullMiddleId" + ], + "referenceTable": "fk_chain_set_null_middle", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "organization", + "dartName": "Organization", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "organization_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "person", + "dartName": "Person", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "surname", + "fieldName": "surname", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "organizationId", + "fieldName": "organizationId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "oldCompanyId", + "fieldName": "oldCompanyId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_1", + "columns": [ + "organizationId" + ], + "referenceTable": "organization", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_2", + "columns": [ + "oldCompanyId" + ], + "referenceTable": "company", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "person_fk_3", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_cascade_child", + "dartName": "RequiredCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "required_no_action_child", + "dartName": "RequiredNoActionChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "required_no_action_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "restrict_child", + "dartName": "RestrictChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "restrict_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_child", + "dartName": "SharedChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "flavor", + "fieldName": "flavor", + "columnType": 0, + "isNullable": false, + "columnDefault": "'plain'", + "dartType": "serverpod_offline_sync_test_shared:SharedFlavor" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "shared_parent", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "shared_parent", + "dartName": "SharedParent", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "shared_parent_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "town", + "dartName": "Town", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "cityId", + "fieldName": "cityId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "mayorId", + "fieldName": "mayorId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_1", + "columns": [ + "cityId" + ], + "referenceTable": "city", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "town_fk_2", + "columns": [ + "mayorId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "types", + "dartName": "Types", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBool", + "fieldName": "aBool", + "columnType": 1, + "isNullable": false, + "dartType": "bool" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aDateTime", + "fieldName": "aDateTime", + "columnType": 4, + "isNullable": false, + "dartType": "DateTime" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aText", + "fieldName": "aText", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt", + "fieldName": "anInt", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anInt64", + "fieldName": "anInt64", + "columnType": 0, + "isNullable": false, + "dartType": "BigInt" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aReal", + "fieldName": "aReal", + "columnType": 3, + "isNullable": false, + "dartType": "double" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "aBlob", + "fieldName": "aBlob", + "columnType": 5, + "isNullable": false, + "dartType": "dart:typed_data:ByteData" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "anEnum", + "fieldName": "anEnum", + "columnType": 6, + "isNullable": true, + "dartType": "protocol:TypesEnum?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalText", + "fieldName": "optionalText", + "columnType": 0, + "isNullable": true, + "dartType": "String?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "optionalUuid", + "fieldName": "optionalUuid", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonDocument", + "fieldName": "jsonDocument", + "columnType": 8, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbDocument", + "fieldName": "jsonbDocument", + "columnType": 14, + "isNullable": true, + "dartType": "protocol:SyncDocument?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "jsonbNumbers", + "fieldName": "jsonbNumbers", + "columnType": 14, + "isNullable": true, + "dartType": "List?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "types_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "types", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "types_a_text_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "aText" + } + ], + "type": "btree", + "isUnique": false, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique", + "dartName": "Unique", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_child", + "dartName": "UniqueCascadeChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_child__spaceId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_cascade_reference", + "dartName": "UniqueCascadeReference", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_cascade_reference_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_cascade_reference__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_composite", + "dartName": "UniqueComposite", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "scope", + "fieldName": "scope", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_composite_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_composite__spaceId__scope__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "scope" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_discriminator", + "dartName": "UniqueDiscriminator", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_discriminator_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_discriminator__spaceId__categoryId__name__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_fk_pair", + "dartName": "UniqueFkPair", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "leftId", + "fieldName": "leftId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "rightId", + "fieldName": "rightId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_1", + "columns": [ + "leftId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 3, + "deferrable": "initiallyDeferred" + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_fk_pair_fk_2", + "columns": [ + "rightId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_fk_pair_parents", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "leftId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "rightId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_mixed_fk", + "dartName": "UniqueMixedFk", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_mixed_fk_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_mixed_fk_name_parent", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_no_release", + "dartName": "UniqueNoRelease", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "categoryId", + "fieldName": "categoryId", + "columnType": 6, + "isNullable": false, + "dartType": "int" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_no_release_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_no_release__spaceId__categoryId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "categoryId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_nullable", + "dartName": "UniqueNullable", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_nullable_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_nullable__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_overlapping", + "dartName": "UniqueOverlapping", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "first", + "fieldName": "first", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "second", + "fieldName": "second", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "third", + "fieldName": "third", + "columnType": 0, + "isNullable": false, + "dartType": "String" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_overlapping_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_first_second", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "first" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_overlapping_second_third", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "second" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "third" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_default_child", + "dartName": "UniqueSetDefaultChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "columnDefault": "'550e8400-e29b-41d4-a716-446655440000'", + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_default_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "town", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 1, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_set_null_child", + "dartName": "UniqueSetNullChild", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "name", + "fieldName": "name", + "columnType": 0, + "isNullable": false, + "dartType": "String" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "parentId", + "fieldName": "parentId", + "columnType": 7, + "isNullable": true, + "dartType": "UuidValue?" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + }, + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_set_null_child_fk_1", + "columns": [ + "parentId" + ], + "referenceTable": "person", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 0, + "deferrable": "initiallyDeferred" + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_null_child__parentId__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "parentId" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + }, + { + "__className__": "serverpod.TableDefinition", + "name": "unique_uuid", + "dartName": "UniqueUuid", + "module": "serverpod_offline_sync_test", + "schema": "public", + "columns": [ + { + "__className__": "serverpod.ColumnDefinition", + "name": "id", + "fieldName": "id", + "columnType": 7, + "isNullable": false, + "columnDefault": "random_v7", + "dartType": "UuidValue?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "spaceId", + "fieldName": "spaceId", + "columnType": 6, + "isNullable": true, + "dartType": "int?" + }, + { + "__className__": "serverpod.ColumnDefinition", + "name": "value", + "fieldName": "value", + "columnType": 7, + "isNullable": false, + "dartType": "UuidValue" + } + ], + "foreignKeys": [ + { + "__className__": "serverpod.ForeignKeyDefinition", + "constraintName": "unique_uuid_fk_0", + "columns": [ + "spaceId" + ], + "referenceTable": "offline_sync_spaces", + "referenceTableSchema": "public", + "referenceColumns": [ + "id" + ], + "onUpdate": 3, + "onDelete": 4 + } + ], + "indexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_uuid__spaceId__value__unique_idx", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "value" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "managed": true + } + ], + "installedModules": [ + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod", + "version": "20260824182259319" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_auth_core", + "version": "20260924105232991" + }, + { + "__className__": "serverpod.DatabaseMigrationVersion", + "module": "serverpod_offline_sync", + "version": "20260914143806119" + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.json b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.json new file mode 100644 index 0000000..cdaaf13 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.json @@ -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 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.sql b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.sql new file mode 100644 index 0000000..db03f91 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261007215503877/migration.sql @@ -0,0 +1,194 @@ +BEGIN; + +-- +-- ACTION DROP TABLE +-- +DROP TABLE "required_set_null_child"; + +-- +-- ACTION DROP TABLE +-- +DROP TABLE "nullable_set_default_child"; + +-- +-- STORE COLUMN TYPES FOR MIGRATIONS +-- +DROP TABLE IF EXISTS "serverpod_sqlite_schema"; + +CREATE TABLE "serverpod_sqlite_schema" ( + "table_name" TEXT NOT NULL, + "column_name" TEXT NOT NULL, + "column_type" TEXT NOT NULL, + "column_vector_dimension" INTEGER, + PRIMARY KEY ("table_name", "column_name") +); + +INSERT INTO "serverpod_sqlite_schema" VALUES + ('address', 'id', 'uuid', NULL), + ('address', 'inhabitantId', 'uuid', NULL), + ('city', 'id', 'uuid', NULL), + ('company', 'id', 'uuid', NULL), + ('company', 'townId', 'uuid', NULL), + ('fk_chain_cascade_middle', 'id', 'uuid', NULL), + ('fk_chain_cascade_middle', 'rootId', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_middle_cascade_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_middle_set_null_child', 'restrictBlockerId', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'id', 'uuid', NULL), + ('fk_chain_restrict_blocker', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_root', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_cascade_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_middle', 'id', 'uuid', NULL), + ('fk_chain_set_null_middle', 'cascadeMiddleId', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_restrict_child', 'setNullMiddleId', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'id', 'uuid', NULL), + ('fk_chain_set_null_set_null_child', 'setNullMiddleId', 'uuid', NULL), + ('organization', 'id', 'uuid', NULL), + ('organization', 'cityId', 'uuid', NULL), + ('person', 'id', 'uuid', NULL), + ('person', 'organizationId', 'uuid', NULL), + ('person', 'oldCompanyId', 'uuid', NULL), + ('person', 'cityId', 'uuid', NULL), + ('required_cascade_child', 'id', 'uuid', NULL), + ('required_cascade_child', 'parentId', 'uuid', NULL), + ('required_no_action_child', 'id', 'uuid', NULL), + ('required_no_action_child', 'parentId', 'uuid', NULL), + ('restrict_child', 'id', 'uuid', NULL), + ('restrict_child', 'parentId', 'uuid', NULL), + ('shared_child', 'id', 'uuid', NULL), + ('shared_child', 'parentId', 'uuid', NULL), + ('shared_parent', 'id', 'uuid', NULL), + ('town', 'id', 'uuid', NULL), + ('town', 'cityId', 'uuid', NULL), + ('town', 'mayorId', 'uuid', NULL), + ('types', 'id', 'uuid', NULL), + ('types', 'aBool', 'boolean', NULL), + ('types', 'aDateTime', 'timestampWithoutTimeZone', NULL), + ('types', 'optionalUuid', 'uuid', NULL), + ('types', 'parentId', 'uuid', NULL), + ('types', 'jsonDocument', 'json', NULL), + ('types', 'jsonbDocument', 'jsonb', NULL), + ('types', 'jsonbNumbers', 'jsonb', NULL), + ('unique', 'id', 'uuid', NULL), + ('unique_cascade_child', 'id', 'uuid', NULL), + ('unique_cascade_child', 'parentId', 'uuid', NULL), + ('unique_cascade_reference', 'id', 'uuid', NULL), + ('unique_cascade_reference', 'parentId', 'uuid', NULL), + ('unique_composite', 'id', 'uuid', NULL), + ('unique_discriminator', 'id', 'uuid', NULL), + ('unique_fk_pair', 'id', 'uuid', NULL), + ('unique_fk_pair', 'leftId', 'uuid', NULL), + ('unique_fk_pair', 'rightId', 'uuid', NULL), + ('unique_mixed_fk', 'id', 'uuid', NULL), + ('unique_mixed_fk', 'parentId', 'uuid', NULL), + ('unique_no_release', 'id', 'uuid', NULL), + ('unique_nullable', 'id', 'uuid', NULL), + ('unique_overlapping', 'id', 'uuid', NULL), + ('unique_set_default_child', 'id', 'uuid', NULL), + ('unique_set_default_child', 'parentId', 'uuid', NULL), + ('unique_set_null_child', 'id', 'uuid', NULL), + ('unique_set_null_child', 'parentId', 'uuid', NULL), + ('unique_uuid', 'id', 'uuid', NULL), + ('unique_uuid', 'value', 'uuid', NULL), + ('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage', 'verified', 'boolean', NULL), + ('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL), + ('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL), + ('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_future_call', 'scheduling', 'json', NULL), + ('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_health_metric', 'isHealthy', 'boolean', NULL), + ('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_message_log', 'slow', 'boolean', NULL), + ('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL), + ('serverpod_query_log', 'slow', 'boolean', NULL), + ('serverpod_runtime_settings', 'logSettings', 'json', NULL), + ('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL), + ('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL), + ('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL), + ('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL), + ('serverpod_session_log', 'slow', 'boolean', NULL), + ('serverpod_session_log', 'isOpen', 'boolean', NULL), + ('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_profile', 'imageId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'id', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL), + ('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'id', 'uuid', NULL), + ('serverpod_auth_core_session', 'authUserId', 'uuid', NULL), + ('serverpod_auth_core_session', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'id', 'uuid', NULL), + ('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL), + ('serverpod_auth_core_user', 'scopeNames', 'json', NULL), + ('serverpod_auth_core_user', 'blocked', 'boolean', NULL), + ('crdt_data_attempted_value', 'value', 'jsonb', NULL), + ('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_data_rows', 'uuidRowId', 'uuid', NULL), + ('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('crdt_nodes', 'uuidNodeId', 'uuid', NULL), + ('crdt_nodes', 'lastHlc', 'jsonb', NULL), + ('crdt_schema_columns', 'isNullable', 'boolean', NULL), + ('offline_sync_integrity_violations', 'uuidRowId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'ownerSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'incomingSpaceUuid', 'uuid', NULL), + ('offline_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL), + ('offline_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL), + ('offline_sync_space_members', 'userUuid', 'uuid', NULL), + ('offline_sync_space_nodes', 'lastReceivedHlc', 'jsonb', NULL), + ('offline_sync_spaces', 'uuidSpaceId', 'uuid', NULL); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync_test +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync_test', '20261007215503877', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261007215503877', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod', '20260824182259319', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260824182259319', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_auth_core +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_auth_core', '20260924105232991', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260924105232991', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + +-- +-- MIGRATION VERSION FOR serverpod_offline_sync +-- +INSERT INTO "serverpod_migrations" ("module", "version", "timestamp") + VALUES ('serverpod_offline_sync', '20260914143806119', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20260914143806119', "timestamp" = (unixepoch('now', 'subsecond') * 1000); + + +COMMIT; diff --git a/test/serverpod_offline_sync_test_server/migrations/migration_registry.txt b/test/serverpod_offline_sync_test_server/migrations/migration_registry.txt index 4681ffc..0a2f583 100644 --- a/test/serverpod_offline_sync_test_server/migrations/migration_registry.txt +++ b/test/serverpod_offline_sync_test_server/migrations/migration_registry.txt @@ -15,3 +15,4 @@ 20260914144112288 20260914165608984 20260930185557154 +20261007215503877 diff --git a/test/serverpod_offline_sync_test_server/pubspec.yaml b/test/serverpod_offline_sync_test_server/pubspec.yaml index 6e66900..91bdc32 100644 --- a/test/serverpod_offline_sync_test_server/pubspec.yaml +++ b/test/serverpod_offline_sync_test_server/pubspec.yaml @@ -8,8 +8,8 @@ environment: resolution: workspace dependencies: - serverpod: ^4.0.0 - serverpod_auth_core_server: ^4.0.0 + serverpod: '>=4.0.4 <4.1.0' + serverpod_auth_core_server: '>=4.0.4 <4.1.0' serverpod_offline_sync: path: ../../packages/serverpod_offline_sync serverpod_offline_sync_server: @@ -21,12 +21,12 @@ dev_dependencies: clock: ^1.1.2 lints: '>=3.0.0 <7.0.0' path: ^1.9.1 - serverpod_database: ^4.0.0 + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync_client: path: ../../packages/serverpod_offline_sync_client serverpod_offline_sync_test_client: path: ../serverpod_offline_sync_test_client - serverpod_test: ^4.0.0 + serverpod_test: '>=4.0.4 <4.1.0' test: ^1.25.5 uuid: ^4.5.3 diff --git a/test/serverpod_offline_sync_test_server/test/dst/dst_foreign_key_oracle_test.dart b/test/serverpod_offline_sync_test_server/test/dst/dst_foreign_key_oracle_test.dart index ee5561b..125ffb9 100644 --- a/test/serverpod_offline_sync_test_server/test/dst/dst_foreign_key_oracle_test.dart +++ b/test/serverpod_offline_sync_test_server/test/dst/dst_foreign_key_oracle_test.dart @@ -1,4 +1,3 @@ -import 'package:serverpod_offline_sync_server/serverpod_offline_sync_server.dart'; import 'package:serverpod_offline_sync_test_client/serverpod_offline_sync_test_client.dart'; import 'package:test/test.dart'; @@ -8,23 +7,25 @@ import 'framework/dst_snapshot.dart'; import 'framework/dst_world.dart'; void main() { - initTestClientSession(); + initTestClientSession(createSessionPerTest: false); - test( - 'Given a unique nullable set-default child referencing its default town, ' - 'when the child is deleted and its released field is read back, ' - 'then the hidden row retains null while the schema retains its non-null default.', - () async { + group('Given a unique nullable set-default child referencing its default town,', () { + late DstReplica replica; + late UuidValue space; + late Town parent; + late UniqueSetDefaultChild child; + + setUpAll(() async { final ids = DstIds(DstRandom(118)); - final space = ids.next(); - final replica = await DstReplica.create( + space = ids.next(); + replica = await DstReplica.create( name: 'replica', spaceUuids: [space], nodeUuid: ids.next(), clock: DstClock().clock, ); - final parent = Town(id: dstDefaultTownId, name: 'default'); - final child = UniqueSetDefaultChild( + parent = Town(id: dstDefaultTownId, name: 'default'); + child = UniqueSetDefaultChild( id: ids.next(), name: 'child', parentId: parent.id, @@ -39,30 +40,44 @@ void main() { ); }), ); + }); - await replica.withReplicaClock( - () => replica.session.db.transactionForUser(space, (tx) async { - await UniqueSetDefaultChild.db.deleteRow( - replica.session, - child, - transaction: tx, - ); - }), - ); - final snapshot = await DstSnapshot.capture(replica); + group('when the child is deleted and its released field is read back,', () { + late DstSnapshot snapshot; - final hidden = snapshot.rows['unique_set_default_child']![child.id]!; - expect(hidden.visible, isFalse); - expect(hidden.columns['parentId'], isNull); - expect( - dstForeignKeys - .singleWhere((edge) => edge.child == DstTable.uniqueSetDefaultChild) - .defaultValue, - parent.id, - ); - expect(DstOracle.invariants(snapshot), isEmpty); - }, - ); + setUpAll(() async { + await replica.withReplicaClock( + () => replica.session.db.transactionForUser(space, (tx) async { + await UniqueSetDefaultChild.db.deleteRow( + replica.session, + child, + transaction: tx, + ); + }), + ); + snapshot = await DstSnapshot.capture(replica); + }); + + test('then the hidden row retains a null reference.', () { + final hidden = snapshot.rows['unique_set_default_child']![child.id]!; + expect(hidden.visible, isFalse); + expect(hidden.columns['parentId'], isNull); + }); + + test('then the schema retains its non-null default.', () { + expect( + dstForeignKeys + .singleWhere((edge) => edge.child == DstTable.uniqueSetDefaultChild) + .defaultValue, + parent.id, + ); + }); + + test('then the snapshot satisfies the oracle invariants.', () { + expect(DstOracle.invariants(snapshot), isEmpty); + }); + }); + }); test( 'Given a visible person referencing a hidden company, ' @@ -94,62 +109,6 @@ void main() { }, ); - test( - 'Given a visible required set-null child referencing a hidden person, ' - 'when its snapshot is checked, ' - 'then the oracle rejects the unrepaired reference.', - () { - final ids = DstIds(DstRandom(3)); - final space = ids.next(); - final parentId = ids.next(); - final childId = ids.next(); - final snapshot = DstSnapshot( - rows: { - 'person': {parentId: (spaceUuid: space, columns: {}, visible: false)}, - 'required_set_null_child': { - childId: (spaceUuid: space, columns: {'parentId': parentId}, visible: true), - }, - }, - projections: {}, - causalLengths: {}, - ); - - final violations = DstOracle.foreignKeyClosure(snapshot); - - expect(violations, hasLength(1)); - }, - ); - - test( - 'Given a hidden nullable set-default child whose null repair was skipped, ' - 'when its snapshot is checked, ' - 'then the oracle rejects the unrepaired reference.', - () { - final ids = DstIds(DstRandom(3)); - final space = ids.next(); - final parentId = ids.next(); - final childId = ids.next(); - final snapshot = DstSnapshot( - rows: { - 'person': {parentId: (spaceUuid: space, columns: {}, visible: false)}, - 'nullable_set_default_child': { - childId: ( - spaceUuid: space, - columns: {'parentId': parentId}, - visible: false, - ), - }, - }, - projections: {}, - causalLengths: {}, - ); - - final violations = DstOracle.projectionPurity(snapshot); - - expect(violations, hasLength(1)); - }, - ); - test( 'Given a visible no-action descendant of a hidden cascade middle, ' 'when its snapshot is checked, ' @@ -182,259 +141,195 @@ void main() { }, ); - test( - 'Given a nullable set-default child repaired to its null default, ' - 'when its snapshot is checked, ' - 'then the oracle accepts its set-default projection.', + group( + 'Given a person and visible city, organization, company, and town parents,', () { - final ids = DstIds(DstRandom(3)); - final space = ids.next(); - final parentId = ids.next(); - final childId = ids.next(); - final snapshot = DstSnapshot( - rows: { - 'person': {parentId: (spaceUuid: space, columns: {}, visible: false)}, - 'nullable_set_default_child': { - childId: (spaceUuid: space, columns: {'parentId': null}, visible: true), - }, - }, - projections: { - ('nullable_set_default_child', childId, 'parentId'): ( - attemptedValue: parentId, - projectionReason: CrdtProjectionReason.foreignKeySetDefault, - ), - }, - causalLengths: {}, - ); + late DstReplica replica; + late UuidValue space; + late City city; + late Organization organization; + late Town town; + late Company company; + late Person person; + late DstOperations operations; - final violations = DstOracle.projectionPurity(snapshot); + setUpAll(() async { + final random = DstRandom(300); + final ids = DstIds(random); + space = ids.next(); + replica = await DstReplica.create( + name: 'replica', + spaceUuids: [space], + nodeUuid: ids.next(), + clock: DstClock().clock, + ); + city = City(id: ids.next(), name: 'city'); + organization = Organization( + id: ids.next(), + name: 'organization', + cityId: city.id, + ); + town = Town(id: ids.next(), name: 'town', cityId: city.id); + company = Company(id: ids.next(), name: 'company', townId: town.id); + person = Person(id: ids.next(), name: 'person'); + await replica.withReplicaClock( + () => replica.session.db.transactionForUser(space, (tx) async { + await City.db.insertRow(replica.session, city, transaction: tx); + await Organization.db.insertRow( + replica.session, + organization, + transaction: tx, + ); + await Town.db.insertRow(replica.session, town, transaction: tx); + await Company.db.insertRow(replica.session, company, transaction: tx); + await Person.db.insertRow(replica.session, person, transaction: tx); + }), + ); + operations = DstOperations(random, ids); + }); - expect(violations, isEmpty); + group('when the DST repeatedly retargets the person and town,', () { + late Set references; + late bool cycleAuthored; + + setUpAll(() async { + references = {}; + cycleAuthored = false; + + for (var index = 0; index < 60; index++) { + await operations.apply( + replica, + space, + table: DstTable.person, + action: DstAction.update, + ); + await operations.apply( + replica, + space, + table: DstTable.town, + action: DstAction.update, + ); + final actualPerson = (await Person.db.findById( + replica.session, + person.id!, + ))!; + final actualTown = (await Town.db.findById(replica.session, town.id!))!; + if (actualPerson.organizationId == organization.id) { + references.add('organization'); + } + if (actualPerson.oldCompanyId == company.id) references.add('company'); + if (actualPerson.cityId == city.id) references.add('city'); + if (actualPerson.oldCompanyId == company.id && + actualTown.mayorId == person.id) { + cycleAuthored = true; + } + } + }); + + test('then every person reference can be authored.', () { + expect(references, {'organization', 'company', 'city'}); + }); + + test('then the company-town-person cycle can be authored.', () { + expect(cycleAuthored, isTrue); + }); + }); }, ); - test( - 'Given a hidden required set-null child and its hidden parent, ' - 'when its snapshot is checked, ' - 'then the oracle accepts the unchanged non-null reference.', + group( + 'Given visible person and town parents for required cascade, required no-action, unique set-default, and unique cascade children,', () { - final ids = DstIds(DstRandom(3)); - final space = ids.next(); - final parentId = ids.next(); - final childId = ids.next(); - final snapshot = DstSnapshot( - rows: { - 'person': {parentId: (spaceUuid: space, columns: {}, visible: false)}, - 'required_set_null_child': { - childId: ( - spaceUuid: space, - columns: {'parentId': parentId}, - visible: false, - ), - }, - }, - projections: {}, - causalLengths: {}, - ); + late DstReplica replica; + late UuidValue space; + late DstOperations operations; - final violations = DstOracle.projectionPurity(snapshot); - - expect(violations, isEmpty); - }, - ); - - test( - 'Given a replica holding a required set-null child, ' - 'when its snapshot is captured, ' - 'then the child and its reference are available to the oracle.', - () async { - final ids = DstIds(DstRandom(3)); - final space = ids.next(); - final replica = await DstReplica.create( - name: 'replica', - spaceUuids: [space], - nodeUuid: ids.next(), - clock: DstClock().clock, - ); - final parent = Person(id: ids.next(), name: 'parent'); - final child = RequiredSetNullChild( - id: ids.next(), - name: 'child', - parentId: parent.id!, - ); - await replica.withReplicaClock( - () => replica.session.db.transactionForUser(space, (tx) async { - await Person.db.insertRow(replica.session, parent, transaction: tx); - await RequiredSetNullChild.db.insertRow( - replica.session, - child, - transaction: tx, - ); - }), - ); - - final snapshot = await DstSnapshot.capture(replica); - - expect( - snapshot.rows['required_set_null_child']?[child.id]?.columns['parentId'], - parent.id.toString(), - ); - }, - ); - test( - 'Given a person and visible city, organization, company, and town parents, ' - 'when the DST repeatedly retargets the person and town, ' - 'then every person reference and the company-town-person cycle can be authored.', - () async { - final random = DstRandom(300); - final ids = DstIds(random); - final space = ids.next(); - final replica = await DstReplica.create( - name: 'replica', - spaceUuids: [space], - nodeUuid: ids.next(), - clock: DstClock().clock, - ); - final city = City(id: ids.next(), name: 'city'); - final organization = Organization( - id: ids.next(), - name: 'organization', - cityId: city.id, - ); - final town = Town(id: ids.next(), name: 'town', cityId: city.id); - final company = Company(id: ids.next(), name: 'company', townId: town.id); - final person = Person(id: ids.next(), name: 'person'); - await replica.withReplicaClock( - () => replica.session.db.transactionForUser(space, (tx) async { - await City.db.insertRow(replica.session, city, transaction: tx); - await Organization.db.insertRow( - replica.session, - organization, - transaction: tx, - ); - await Town.db.insertRow(replica.session, town, transaction: tx); - await Company.db.insertRow(replica.session, company, transaction: tx); - await Person.db.insertRow(replica.session, person, transaction: tx); - }), - ); - final operations = DstOperations(random, ids); - final references = {}; - var cycleAuthored = false; - - for (var index = 0; index < 60; index++) { - await operations.apply( - replica, - space, - table: DstTable.person, - action: DstAction.update, + setUpAll(() async { + final random = DstRandom(301); + final ids = DstIds(random); + space = ids.next(); + replica = await DstReplica.create( + name: 'replica', + spaceUuids: [space], + nodeUuid: ids.next(), + clock: DstClock().clock, ); - await operations.apply( - replica, - space, - table: DstTable.town, - action: DstAction.update, + await replica.withReplicaClock( + () => replica.session.db.transactionForUser(space, (tx) async { + await Person.db.insertRow( + replica.session, + Person(id: ids.next(), name: 'parent'), + transaction: tx, + ); + await Town.db.insertRow( + replica.session, + Town(id: dstDefaultTownId, name: 'default'), + transaction: tx, + ); + }), ); - final actualPerson = (await Person.db.findById(replica.session, person.id!))!; - final actualTown = (await Town.db.findById(replica.session, town.id!))!; - if (actualPerson.organizationId == organization.id) { - references.add('organization'); - } - if (actualPerson.oldCompanyId == company.id) references.add('company'); - if (actualPerson.cityId == city.id) references.add('city'); - if (actualPerson.oldCompanyId == company.id && - actualTown.mayorId == person.id) { - cycleAuthored = true; - } - } + operations = DstOperations(random, ids); + }); - expect(references, {'organization', 'company', 'city'}); - expect(cycleAuthored, isTrue); - }, - ); + group('when the DST inserts the children,', () { + late DstOperationOutcome requiredCascade; + late DstOperationOutcome requiredNoAction; + late DstOperationOutcome uniqueDefault; + late DstOperationOutcome uniqueCascade; + late DstSnapshot snapshot; - test( - 'Given visible person and town parents in one space, ' - 'when the DST inserts children of every required and nullable FK shape, ' - 'then each shape is authored and captured with valid references.', - () async { - final random = DstRandom(301); - final ids = DstIds(random); - final space = ids.next(); - final replica = await DstReplica.create( - name: 'replica', - spaceUuids: [space], - nodeUuid: ids.next(), - clock: DstClock().clock, - ); - await replica.withReplicaClock( - () => replica.session.db.transactionForUser(space, (tx) async { - await Person.db.insertRow( - replica.session, - Person(id: ids.next(), name: 'parent'), - transaction: tx, + setUpAll(() async { + requiredCascade = await operations.apply( + replica, + space, + table: DstTable.requiredCascadeChild, + action: DstAction.insert, ); - await Town.db.insertRow( - replica.session, - Town(id: dstDefaultTownId, name: 'default'), - transaction: tx, + requiredNoAction = await operations.apply( + replica, + space, + table: DstTable.requiredNoActionChild, + action: DstAction.insert, ); - }), - ); - final operations = DstOperations(random, ids); + uniqueDefault = await operations.apply( + replica, + space, + table: DstTable.uniqueSetDefaultChild, + action: DstAction.insert, + ); + uniqueCascade = await operations.apply( + replica, + space, + table: DstTable.uniqueCascadeReference, + action: DstAction.insert, + ); + snapshot = await DstSnapshot.capture(replica); + }); - final requiredNull = await operations.apply( - replica, - space, - table: DstTable.requiredSetNullChild, - action: DstAction.insert, - ); - final requiredCascade = await operations.apply( - replica, - space, - table: DstTable.requiredCascadeChild, - action: DstAction.insert, - ); - final requiredNoAction = await operations.apply( - replica, - space, - table: DstTable.requiredNoActionChild, - action: DstAction.insert, - ); - final nullableDefault = await operations.apply( - replica, - space, - table: DstTable.nullableSetDefaultChild, - action: DstAction.insert, - ); - final uniqueDefault = await operations.apply( - replica, - space, - table: DstTable.uniqueSetDefaultChild, - action: DstAction.insert, - ); - final uniqueCascade = await operations.apply( - replica, - space, - table: DstTable.uniqueCascadeReference, - action: DstAction.insert, - ); - final snapshot = await DstSnapshot.capture(replica); + test('then the required cascade child is authored and captured.', () { + expect(requiredCascade, DstOperationOutcome.applied); + expect(snapshot.rows['required_cascade_child'], hasLength(1)); + }); - expect([ - requiredNull, - requiredCascade, - requiredNoAction, - nullableDefault, - uniqueDefault, - uniqueCascade, - ], everyElement(DstOperationOutcome.applied)); - expect(snapshot.rows['required_set_null_child'], hasLength(1)); - expect(snapshot.rows['required_cascade_child'], hasLength(1)); - expect(snapshot.rows['required_no_action_child'], hasLength(1)); - expect(snapshot.rows['nullable_set_default_child'], hasLength(1)); - expect(snapshot.rows['unique_set_default_child'], hasLength(1)); - expect(snapshot.rows['unique_cascade_reference'], hasLength(1)); - expect(DstOracle.invariants(snapshot), isEmpty); + test('then the required no-action child is authored and captured.', () { + expect(requiredNoAction, DstOperationOutcome.applied); + expect(snapshot.rows['required_no_action_child'], hasLength(1)); + }); + + test('then the unique set-default child is authored and captured.', () { + expect(uniqueDefault, DstOperationOutcome.applied); + expect(snapshot.rows['unique_set_default_child'], hasLength(1)); + }); + + test('then the unique cascade child is authored and captured.', () { + expect(uniqueCascade, DstOperationOutcome.applied); + expect(snapshot.rows['unique_cascade_reference'], hasLength(1)); + }); + + test('then every child reference satisfies the oracle invariants.', () { + expect(DstOracle.invariants(snapshot), isEmpty); + }); + }); }, ); } diff --git a/test/serverpod_offline_sync_test_server/test/dst/dst_operations_test.dart b/test/serverpod_offline_sync_test_server/test/dst/dst_operations_test.dart index 643a554..4f09b3c 100644 --- a/test/serverpod_offline_sync_test_server/test/dst/dst_operations_test.dart +++ b/test/serverpod_offline_sync_test_server/test/dst/dst_operations_test.dart @@ -8,65 +8,23 @@ import 'framework/dst_snapshot.dart'; import 'framework/dst_world.dart'; void main() { - initTestClientSession(); + initTestClientSession(createSessionPerTest: false); - test( - 'Given a person referenced by a required set-null child, ' - 'when the DST deletes the person in a batch, ' - 'then the operation is rejected and both rows remain unchanged.', - () async { - final random = DstRandom(114); - final ids = DstIds(random); - final space = ids.next(); - final replica = await _replica(ids, space); - final operations = DstOperations(random, ids); - final parent = Person(id: ids.next(), name: 'parent'); - final child = RequiredSetNullChild( - id: ids.next(), - name: 'child', - parentId: parent.id!, - ); - await replica.withReplicaClock( - () => replica.session.db.transactionForUser(space, (tx) async { - await Person.db.insertRow(replica.session, parent, transaction: tx); - await RequiredSetNullChild.db.insertRow( - replica.session, - child, - transaction: tx, - ); - }), - ); - final before = (await replica.collect(space)).map(dstChangeKey).toSet(); + group('Given a deleted unique claimant and a newer claimant of the same name,', () { + late UuidValue space; + late DstReplica replica; + late DstOperations operations; + late Unique original; + late Unique peer; - final outcome = await operations.apply( - replica, - space, - table: DstTable.person, - action: DstAction.deleteBatch, - ); - - expect(outcome, DstOperationOutcome.rejected); - expect(await Person.db.findById(replica.session, parent.id!), isNotNull); - expect( - (await RequiredSetNullChild.db.findById(replica.session, child.id!))!.parentId, - parent.id, - ); - expect((await replica.collect(space)).map(dstChangeKey).toSet(), before); - }, - ); - - test( - 'Given a deleted unique claimant and a newer claimant of the same name, ' - 'when the DST restores the deleted identity, ' - 'then the renewed claim yields the name to its earlier peer.', - () async { + setUpAll(() async { final random = DstRandom(4); final ids = DstIds(random); - final space = ids.next(); - final replica = await _replica(ids, space); - final operations = DstOperations(random, ids); - final original = Unique(id: ids.next(), name: 'shared'); - final peer = Unique(id: ids.next(), name: 'shared'); + space = ids.next(); + replica = await _replica(ids, space); + operations = DstOperations(random, ids); + original = Unique(id: ids.next(), name: 'shared'); + peer = Unique(id: ids.next(), name: 'shared'); await replica.withReplicaClock( () => replica.session.db.transactionForUser(space, (tx) async { await Unique.db.insertRow(replica.session, original, transaction: tx); @@ -78,27 +36,44 @@ void main() { await Unique.db.insertRow(replica.session, peer, transaction: tx); }), ); + }); - final outcome = await operations.apply( - replica, - space, - table: DstTable.unique, - action: _action('restore'), - ); + group('when the DST restores the deleted identity,', () { + late DstOperationOutcome outcome; + late Unique? restored; + late Unique? other; + late DstSnapshot snapshot; - expect(outcome, DstOperationOutcome.applied); - final restored = await Unique.db.findById(replica.session, original.id!); - final other = await Unique.db.findById(replica.session, peer.id!); - expect(restored?.name, 'shared__conflict__${original.id}'); - expect(other?.name, 'shared'); - final snapshot = await DstSnapshot.capture(replica); - expect(snapshot.authoredValue(('unique', original.id!, 'name')), 'shared'); - expect( - snapshot.fieldHlc(('unique', original.id!, 'name')), - snapshot.rowHlcs['unique/${original.id}'], - ); - }, - ); + setUpAll(() async { + outcome = await operations.apply( + replica, + space, + table: DstTable.unique, + action: _action('restore'), + ); + restored = await Unique.db.findById(replica.session, original.id!); + other = await Unique.db.findById(replica.session, peer.id!); + snapshot = await DstSnapshot.capture(replica); + }); + + test('then the restoration is applied.', () { + expect(outcome, DstOperationOutcome.applied); + }); + + test('then the renewed claim yields the name to its earlier peer.', () { + expect(restored?.name, 'shared__conflict__${original.id}'); + expect(other?.name, 'shared'); + }); + + test('then the authored name is renewed at the restored row clock.', () { + expect(snapshot.authoredValue(('unique', original.id!, 'name')), 'shared'); + expect( + snapshot.fieldHlc(('unique', original.id!, 'name')), + snapshot.rowHlcs['unique/${original.id}'], + ); + }); + }); + }); test( 'Given an empty city table, ' @@ -391,19 +366,22 @@ void main() { }, ); - test( - 'Given a town with a set-null projection after a remote mayor deletion, ' - 'when the DST performs a full-row update of an unrelated field, ' - 'then the town changes name while preserving the authored mayor in its export.', - () async { + group('Given a town with a set-null projection after a remote mayor deletion,', () { + late UuidValue space; + late DstReplica replica; + late DstOperations operations; + late Person mayor; + late Town town; + + setUpAll(() async { final random = DstRandom(4); final ids = DstIds(random); - final space = ids.next(); - final replica = await _replica(ids, space); - final operations = DstOperations(random, ids); + space = ids.next(); + replica = await _replica(ids, space); + operations = DstOperations(random, ids); final source = await _replica(ids, space); - final mayor = Person(id: ids.next(), name: 'mayor'); - final town = Town(id: ids.next(), name: 'original-town', mayorId: mayor.id); + mayor = Person(id: ids.next(), name: 'mayor'); + town = Town(id: ids.next(), name: 'original-town', mayorId: mayor.id); await source.withReplicaClock( () => source.session.db.transactionForUser(space, (tx) async { await Person.db.insertRow(source.session, mayor, transaction: tx); @@ -421,51 +399,141 @@ void main() { }), ); await replica.merge(await source.collect(space), space); + }); - final outcome = await operations.apply( - replica, - space, - table: DstTable.town, - action: _action('fullRowUpdate'), + group('when the DST performs a full-row update of an unrelated field,', () { + late DstOperationOutcome outcome; + late Town visible; + late CrdtMergeSet changes; + + setUpAll(() async { + outcome = await operations.apply( + replica, + space, + table: DstTable.town, + action: _action('fullRowUpdate'), + ); + visible = (await Town.db.findById(replica.session, town.id!))!; + changes = await replica.collect(space); + }); + + test('then the update is applied.', () { + expect(outcome, DstOperationOutcome.applied); + }); + + test('then the town changes name and retains its projected null mayor.', () { + expect(visible.name, isNot(town.name)); + expect(visible.mayorId, isNull); + }); + + test('then the exported insert preserves the authored mayor.', () { + final insert = changes.whereType().singleWhere( + (change) => change.uuidRowId == town.id, + ); + expect((insert.data as Town).mayorId, mayor.id); + }); + }); + }); + + group('Given a detached defaulted FK with a local parent and no default target,', () { + late UuidValue space; + late DstReplica replica; + late Town parent; + late UniqueSetDefaultChild child; + late DstOperations operations; + + setUpAll(() async { + final ids = DstIds(DstRandom(910)); + space = ids.next(); + final otherSpace = ids.next(); + replica = await DstReplica.create( + name: 'replica', + spaceUuids: [space, otherSpace], + nodeUuid: ids.next(), + clock: DstClock().clock, ); - - expect(outcome, DstOperationOutcome.applied); - final visible = (await Town.db.findById(replica.session, town.id!))!; - expect(visible.name, isNot(town.name)); - expect(visible.mayorId, isNull); - final changes = await replica.collect(space); - final insert = changes.whereType().singleWhere( - (change) => change.uuidRowId == town.id, + parent = Town(id: ids.next(), name: 'available-parent'); + child = UniqueSetDefaultChild( + id: ids.next(), + name: 'original', + parentId: parent.id, ); - expect((insert.data as Town).mayorId, mayor.id); - }, - ); + await replica.withReplicaClock( + () => replica.session.db.transactionForUser(space, (tx) async { + await Town.db.insertRow(replica.session, parent, transaction: tx); + await UniqueSetDefaultChild.db.insertRow( + replica.session, + child, + transaction: tx, + ); + await UniqueSetDefaultChild.db.updateRow( + replica.session, + child.copyWith(parentId: null), + columns: (t) => [t.parentId], + transaction: tx, + ); + }), + ); + // This seed changes only the name during the full-row upsert. + operations = DstOperations(DstRandom(5), ids); + }); - for (final defaultLocation in ['missing', 'another space', 'the acting space']) { - final defaultDescription = defaultLocation == 'missing' - ? 'no default target' - : 'a default target in $defaultLocation'; - test( - 'Given a detached defaulted FK with a local parent and $defaultDescription, ' - 'when the DST upserts an unrelated field, ' - 'then the submitted reference resolves to a visible parent in the acting space.', - () async { + group('when the DST upserts an unrelated field,', () { + late DstOperationOutcome outcome; + late UniqueSetDefaultChild updated; + late List rejections; + + setUpAll(() async { + outcome = await operations.apply( + replica, + space, + table: DstTable.uniqueSetDefaultChild, + action: DstAction.upsert, + ); + updated = (await UniqueSetDefaultChild.db.findById( + replica.session, + child.id!, + ))!; + rejections = List.of(operations.rejections); + }); + + test('then the upsert is applied without a rejection.', () { + expect(outcome, DstOperationOutcome.applied); + expect(rejections, isEmpty); + }); + + test('then the unrelated name changes.', () { + expect(updated.name, isNot(child.name)); + }); + + test('then the reference resolves to a visible parent in the acting space.', () { + expect(updated.parentId, parent.id); + }); + }); + }); + + group( + 'Given a detached defaulted FK with a local parent and a default target in another space,', + () { + late UuidValue space; + late DstReplica replica; + late Town parent; + late UniqueSetDefaultChild child; + late DstOperations operations; + + setUpAll(() async { final ids = DstIds(DstRandom(910)); - final space = ids.next(); + space = ids.next(); final otherSpace = ids.next(); - final replica = await DstReplica.create( + replica = await DstReplica.create( name: 'replica', spaceUuids: [space, otherSpace], nodeUuid: ids.next(), clock: DstClock().clock, ); - if (defaultLocation != 'missing') { - await replica.seedDefaultTown( - defaultLocation == 'the acting space' ? space : otherSpace, - ); - } - final parent = Town(id: ids.next(), name: 'available-parent'); - final child = UniqueSetDefaultChild( + await replica.seedDefaultTown(otherSpace); + parent = Town(id: ids.next(), name: 'available-parent'); + child = UniqueSetDefaultChild( id: ids.next(), name: 'original', parentId: parent.id, @@ -486,42 +554,145 @@ void main() { ); }), ); - // This seed changes only name, leaving the full-row upsert to apply - // the unchanged null FK's persisted default. - final operations = DstOperations(DstRandom(5), ids); + // This seed changes only the name during the full-row upsert. + operations = DstOperations(DstRandom(5), ids); + }); - final outcome = await operations.apply( - replica, - space, - table: DstTable.uniqueSetDefaultChild, - action: DstAction.upsert, + group('when the DST upserts an unrelated field,', () { + late DstOperationOutcome outcome; + late UniqueSetDefaultChild updated; + late List rejections; + + setUpAll(() async { + outcome = await operations.apply( + replica, + space, + table: DstTable.uniqueSetDefaultChild, + action: DstAction.upsert, + ); + updated = (await UniqueSetDefaultChild.db.findById( + replica.session, + child.id!, + ))!; + rejections = List.of(operations.rejections); + }); + + test('then the upsert is applied without a rejection.', () { + expect(outcome, DstOperationOutcome.applied); + expect(rejections, isEmpty); + }); + + test('then the unrelated name changes.', () { + expect(updated.name, isNot(child.name)); + }); + + test( + 'then the reference resolves to a visible parent in the acting space.', + () { + expect(updated.parentId, parent.id); + }, ); + }); + }, + ); - expect(outcome, DstOperationOutcome.applied); - final updated = (await UniqueSetDefaultChild.db.findById( - replica.session, - child.id!, - ))!; - expect(updated.name, isNot(child.name)); - expect( - updated.parentId, - defaultLocation == 'the acting space' ? dstDefaultTownId : parent.id, + group( + 'Given a detached defaulted FK with a local parent and a default target in the acting space,', + () { + late UuidValue space; + late DstReplica replica; + late Town parent; + late UniqueSetDefaultChild child; + late DstOperations operations; + + setUpAll(() async { + final ids = DstIds(DstRandom(910)); + space = ids.next(); + final otherSpace = ids.next(); + replica = await DstReplica.create( + name: 'replica', + spaceUuids: [space, otherSpace], + nodeUuid: ids.next(), + clock: DstClock().clock, ); - expect(operations.rejections, isEmpty); - }, - ); - } + await replica.seedDefaultTown(space); + parent = Town(id: ids.next(), name: 'available-parent'); + child = UniqueSetDefaultChild( + id: ids.next(), + name: 'original', + parentId: parent.id, + ); + await replica.withReplicaClock( + () => replica.session.db.transactionForUser(space, (tx) async { + await Town.db.insertRow(replica.session, parent, transaction: tx); + await UniqueSetDefaultChild.db.insertRow( + replica.session, + child, + transaction: tx, + ); + await UniqueSetDefaultChild.db.updateRow( + replica.session, + child.copyWith(parentId: null), + columns: (t) => [t.parentId], + transaction: tx, + ); + }), + ); + // This seed changes only the name during the full-row upsert. + operations = DstOperations(DstRandom(5), ids); + }); - test( - 'Given a detached defaulted FK with no visible parent or default target, ' - 'when the DST tries to upsert an unrelated field, ' - 'then it skips the unavailable reference without changing authored facts.', - () async { + group('when the DST upserts an unrelated field,', () { + late DstOperationOutcome outcome; + late UniqueSetDefaultChild updated; + late List rejections; + + setUpAll(() async { + outcome = await operations.apply( + replica, + space, + table: DstTable.uniqueSetDefaultChild, + action: DstAction.upsert, + ); + updated = (await UniqueSetDefaultChild.db.findById( + replica.session, + child.id!, + ))!; + rejections = List.of(operations.rejections); + }); + + test('then the upsert is applied without a rejection.', () { + expect(outcome, DstOperationOutcome.applied); + expect(rejections, isEmpty); + }); + + test('then the unrelated name changes.', () { + expect(updated.name, isNot(child.name)); + }); + + test( + 'then the reference resolves to a visible parent in the acting space.', + () { + expect(updated.parentId, dstDefaultTownId); + }, + ); + }); + }, + ); + + group('Given a detached defaulted FK with no visible parent or default target,', () { + late UuidValue space; + late DstReplica replica; + late UniqueSetDefaultChild child; + late Set before; + late DstOperations operations; + + setUpAll(() async { final ids = DstIds(DstRandom(910)); - final space = ids.next(); - final replica = await _replica(ids, space); + space = ids.next(); + replica = await _replica(ids, space); final parent = Town(id: ids.next(), name: 'removed-parent'); - final child = UniqueSetDefaultChild( + child = UniqueSetDefaultChild( id: ids.next(), name: 'original', parentId: parent.id, @@ -543,26 +714,43 @@ void main() { await Town.db.deleteRow(replica.session, parent, transaction: tx); }), ); - final before = (await replica.collect(space)).map(dstChangeKey).toSet(); - final operations = DstOperations(DstRandom(5), ids); + before = (await replica.collect(space)).map(dstChangeKey).toSet(); + operations = DstOperations(DstRandom(5), ids); + }); - final outcome = await operations.apply( - replica, - space, - table: DstTable.uniqueSetDefaultChild, - action: DstAction.upsert, - ); + group('when the DST tries to upsert an unrelated field,', () { + late DstOperationOutcome outcome; + late Set after; + late UniqueSetDefaultChild retained; - expect(outcome, DstOperationOutcome.skipped); - expect((await replica.collect(space)).map(dstChangeKey).toSet(), before); - final retained = (await UniqueSetDefaultChild.db.findById( - replica.session, - child.id!, - ))!; - expect(retained.name, child.name); - expect(retained.parentId, isNull); - }, - ); + setUpAll(() async { + outcome = await operations.apply( + replica, + space, + table: DstTable.uniqueSetDefaultChild, + action: DstAction.upsert, + ); + after = (await replica.collect(space)).map(dstChangeKey).toSet(); + retained = (await UniqueSetDefaultChild.db.findById( + replica.session, + child.id!, + ))!; + }); + + test('then it skips the unavailable reference.', () { + expect(outcome, DstOperationOutcome.skipped); + }); + + test('then the authored facts remain unchanged.', () { + expect(after, before); + }); + + test('then the child retains its name and null reference.', () { + expect(retained.name, child.name); + expect(retained.parentId, isNull); + }); + }); + }); } DstAction _action(String name) => diff --git a/test/serverpod_offline_sync_test_server/test/dst/framework/dst_schema.dart b/test/serverpod_offline_sync_test_server/test/dst/framework/dst_schema.dart index 7d7dd40..db5fffc 100644 --- a/test/serverpod_offline_sync_test_server/test/dst/framework/dst_schema.dart +++ b/test/serverpod_offline_sync_test_server/test/dst/framework/dst_schema.dart @@ -25,10 +25,8 @@ enum DstTable { uniqueFkPair('unique_fk_pair'), uniqueMixedFk('unique_mixed_fk'), organization('organization'), - requiredSetNullChild('required_set_null_child'), requiredCascadeChild('required_cascade_child'), requiredNoActionChild('required_no_action_child'), - nullableSetDefaultChild('nullable_set_default_child'), uniqueSetDefaultChild('unique_set_default_child'), uniqueCascadeReference('unique_cascade_reference'), restrictChild('restrict_child'), @@ -216,10 +214,6 @@ final dstModels = >>{ table: models.Organization.t, fromJson: models.Organization.fromJson, ), - DstTable.requiredSetNullChild: DstModel( - table: models.RequiredSetNullChild.t, - fromJson: models.RequiredSetNullChild.fromJson, - ), DstTable.requiredCascadeChild: DstModel( table: models.RequiredCascadeChild.t, fromJson: models.RequiredCascadeChild.fromJson, @@ -228,10 +222,6 @@ final dstModels = >>{ table: models.RequiredNoActionChild.t, fromJson: models.RequiredNoActionChild.fromJson, ), - DstTable.nullableSetDefaultChild: DstModel( - table: models.NullableSetDefaultChild.t, - fromJson: models.NullableSetDefaultChild.fromJson, - ), DstTable.uniqueSetDefaultChild: DstModel( table: models.UniqueSetDefaultChild.t, fromJson: models.UniqueSetDefaultChild.fromJson, diff --git a/test/serverpod_offline_sync_test_server/test/dst/framework/dst_snapshot.dart b/test/serverpod_offline_sync_test_server/test/dst/framework/dst_snapshot.dart index 512e05a..1f06e6c 100644 --- a/test/serverpod_offline_sync_test_server/test/dst/framework/dst_snapshot.dart +++ b/test/serverpod_offline_sync_test_server/test/dst/framework/dst_snapshot.dart @@ -694,14 +694,11 @@ class DstOracle { static bool _canRepair(DstSnapshot snapshot, DstForeignKey edge, DstRow child) => switch (edge.action) { - 'setNull' => edge.nullable, - 'setDefault' => - edge.defaultValue == null - ? edge.nullable - : _available( - snapshot.rows[edge.parent.tableName]?[edge.defaultValue], - child, - ), + 'setNull' => true, + 'setDefault' => _available( + snapshot.rows[edge.parent.tableName]?[edge.defaultValue], + child, + ), _ => false, }; @@ -735,14 +732,12 @@ class DstOracle { /// repair. static bool _reasonFitsEdge(CrdtProjectionReason reason, DstForeignKey edge) { return switch (reason) { - CrdtProjectionReason.foreignKeySetNull => - edge.action == 'setNull' && edge.nullable, + CrdtProjectionReason.foreignKeySetNull => edge.action == 'setNull', CrdtProjectionReason.foreignKeySetDefault => edge.action == 'setDefault', CrdtProjectionReason.foreignKeyMissingParent => edge.action == 'cascade' || edge.action == 'noAction' || - edge.action == 'setDefault' || - (edge.action == 'setNull' && !edge.nullable), + edge.action == 'setDefault', CrdtProjectionReason.uniqueConflict || CrdtProjectionReason.hiddenUniqueRelease => _isUniqueForeignKey(edge), }; diff --git a/test/serverpod_offline_sync_test_server/test/dst/framework/dst_world.dart b/test/serverpod_offline_sync_test_server/test/dst/framework/dst_world.dart index 57b77e4..dbe856f 100644 --- a/test/serverpod_offline_sync_test_server/test/dst/framework/dst_world.dart +++ b/test/serverpod_offline_sync_test_server/test/dst/framework/dst_world.dart @@ -236,8 +236,8 @@ enum DstOperationOutcome { /// The operation committed. applied, - /// The engine refused the operation by design - a no-action violation, a - /// required set-null delete, or a restored reference unavailable in space. + /// The engine refused the operation by design - a no-action violation or a + /// restored reference unavailable in space. rejected, /// There was nothing to act on (for example a delete with no rows yet). diff --git a/test/serverpod_offline_sync_test_server/test/integration/merge/foreign_key_invariant_test.dart b/test/serverpod_offline_sync_test_server/test/integration/merge/foreign_key_invariant_test.dart index 12fd1e2..18197de 100644 --- a/test/serverpod_offline_sync_test_server/test/integration/merge/foreign_key_invariant_test.dart +++ b/test/serverpod_offline_sync_test_server/test/integration/merge/foreign_key_invariant_test.dart @@ -435,64 +435,6 @@ void main() { }, ); - group( - 'Given a parent with a required (non-nullable) set-null child insert,', - () { - late Person parent; - late RequiredSetNullChild child; - late CrdtMergeDelete remoteParentDelete; - - setUp(() async { - await session.db.transactionForUser(testCrdtUserId, (tx) async { - parent = await Person.db.insertRow( - session, - Person(id: const Uuid().v7obj(), name: 'required set-null parent'), - transaction: tx, - ); - child = await RequiredSetNullChild.db.insertRow( - session, - RequiredSetNullChild( - id: const Uuid().v7obj(), - name: 'required set-null child', - parentId: parent.id!, - ), - transaction: tx, - ); - }); - }); - - group('when a concurrent remote parent delete is merged,', () { - setUp(() async { - remoteParentDelete = _deleteChange( - tableName: Person.t.tableName, - rowId: parent.id!, - after: await rowHlc(parent.id!), - ); - - await session.db.mergeChanges( - [remoteParentDelete], - spaceId: testCrdtUserId, - ); - }); - - test( - 'then the parent remains visible because set-null cannot repair the child.', - () async { - final visibleParent = await Person.db.findById(session, parent.id!); - final visibleChild = await RequiredSetNullChild.db.findById( - session, - child.id!, - ); - - expect(visibleParent, isNotNull); - expect(visibleChild, isNotNull); - expect(visibleChild!.parentId, parent.id); - }, - ); - }); - }, - ); - group( 'Given a parent with a nullable set-null foreign key whose attempted value was stored on update,', () { @@ -2093,17 +2035,16 @@ void main() { // transaction commits: drop `DEFERRABLE INITIALLY DEFERRED` from the schema // and this group fails with a foreign key violation. group( - 'Given a merge set whose non-nullable child insert carries a foreign key ' - 'to a parent that is inserted after it,', + 'Given a merge set whose non-nullable child insert carries a foreign key to a parent that is inserted after it,', () { late Person parent; - late RequiredSetNullChild child; + late RequiredNoActionChild child; late CrdtMergeSet mergeSet; setUp(() { final remoteNodeId = const Uuid().v7obj(); parent = Person(id: const Uuid().v7obj(), name: 'late required parent'); - child = RequiredSetNullChild( + child = RequiredNoActionChild( id: const Uuid().v7obj(), name: 'early required child', parentId: parent.id!, @@ -2115,7 +2056,7 @@ void main() { mergeSet = [ CrdtMergeInsert( uuidSpaceId: testCrdtUserId, - tableName: RequiredSetNullChild.t.tableName, + tableName: RequiredNoActionChild.t.tableName, uuidRowId: child.id!, uuidNodeId: remoteNodeId, hlcDatetime: childHlc.datetime, @@ -2143,7 +2084,7 @@ void main() { 'then both rows are visible and the child keeps its foreign key.', () async { final visibleParent = await Person.db.findById(session, parent.id!); - final visibleChild = await RequiredSetNullChild.db.findById( + final visibleChild = await RequiredNoActionChild.db.findById( session, child.id!, ); @@ -2320,7 +2261,7 @@ void main() { ); }); - group('when the root delete replayed after merged,', () { + group('when the root delete is merged twice,', () { late List visibilityAfterMerge; late List visibilityAfterReplay; late List foreignKeyProjectionAfterMerge; @@ -2398,8 +2339,7 @@ void main() { }); group( - 'when a newer remote update for a cascade-hidden descendant is merged ' - 'after the root delete,', + 'when the root delete and a newer descendant update are merged in order,', () { late CrdtMergeUpdate remoteOrganizationUpdate; @@ -2434,33 +2374,53 @@ void main() { expect(await Person.db.findById(session, person.id!), isNull); }, ); + }, + ); - group('when the root restore is merged afterwards,', () { - setUp(() async { - final remoteCityRestore = _restoreChange( - tableName: City.t.tableName, - rowId: city.id!, - after: remoteOrganizationUpdate.hlc, - ); - await session.db.mergeChanges( - [remoteCityRestore], - spaceId: testCrdtUserId, - ); - }); + group( + 'when the root delete, a newer descendant update, and the root restore are merged in order,', + () { + late Organization? visibleOrganization; - test( - 'then the descendant becomes visible with the merged update value.', - () async { - final visibleOrganization = await Organization.db.findById( - session, - organization.id!, - ); - - expect(visibleOrganization, isNotNull); - expect(visibleOrganization!.name, 'renamed while hidden'); - expect(visibleOrganization.cityId, city.id); - }, + setUp(() async { + await session.db.mergeChanges( + [remoteCityDelete], + spaceId: testCrdtUserId, ); + + final remoteOrganizationUpdate = _updateChange( + tableName: Organization.t.tableName, + rowId: organization.id!, + columnName: Organization.t.name.columnName, + value: 'renamed while hidden', + after: (await rowHlc(organization.id!)).maxBetween( + remoteCityDelete.hlc, + ), + ); + await session.db.mergeChanges( + [remoteOrganizationUpdate], + spaceId: testCrdtUserId, + ); + + final remoteCityRestore = _restoreChange( + tableName: City.t.tableName, + rowId: city.id!, + after: remoteOrganizationUpdate.hlc, + ); + await session.db.mergeChanges( + [remoteCityRestore], + spaceId: testCrdtUserId, + ); + visibleOrganization = await Organization.db.findById( + session, + organization.id!, + ); + }); + + test('then the descendant becomes visible with the merged update value.', () { + expect(visibleOrganization, isNotNull); + expect(visibleOrganization!.name, 'renamed while hidden'); + expect(visibleOrganization!.cityId, city.id); }); }, ); diff --git a/test/serverpod_offline_sync_test_server/test/integration/schema/schema_test.dart b/test/serverpod_offline_sync_test_server/test/integration/schema/schema_test.dart index c5a9b96..5f3cc01 100644 --- a/test/serverpod_offline_sync_test_server/test/integration/schema/schema_test.dart +++ b/test/serverpod_offline_sync_test_server/test/integration/schema/schema_test.dart @@ -601,7 +601,7 @@ void main() { final childDefinition = testSession.db.serializationManager .getTargetTableDefinitions() .firstWhere( - (definition) => definition.name == RequiredSetNullChild.t.tableName, + (definition) => definition.name == RequiredNoActionChild.t.tableName, ); final nonDeferredDefinition = childDefinition.copyWith( foreignKeys: [ @@ -613,7 +613,7 @@ void main() { expect( () => CrdtSchemaRegistry( session, - syncTables: [RequiredSetNullChild.t], + syncTables: [RequiredNoActionChild.t], tableDefinitions: [nonDeferredDefinition], ), throwsA( @@ -622,7 +622,7 @@ void main() { 'message', 'CRDT requires deferred foreign keys for non-optional relations, ' 'but 1 foreign key(s) are not deferred: ' - '"required_set_null_child.parentId". Mark these as "deferred" ' + '"required_no_action_child.parentId". Mark these as "deferred" ' 'or make the relation optional.', ), ), @@ -638,7 +638,7 @@ void main() { final childDefinition = testSession.db.serializationManager .getTargetTableDefinitions() .firstWhere( - (definition) => definition.name == RequiredSetNullChild.t.tableName, + (definition) => definition.name == RequiredNoActionChild.t.tableName, ); final immediateDefinition = childDefinition.copyWith( foreignKeys: [ @@ -652,7 +652,7 @@ void main() { expect( () => CrdtSchemaRegistry( session, - syncTables: [RequiredSetNullChild.t], + syncTables: [RequiredNoActionChild.t], tableDefinitions: [immediateDefinition], ), throwsA( @@ -661,7 +661,7 @@ void main() { 'message', 'CRDT requires deferred foreign keys for non-optional relations, ' 'but 1 foreign key(s) are not deferred: ' - '"required_set_null_child.parentId". Mark these as "deferred" ' + '"required_no_action_child.parentId". Mark these as "deferred" ' 'or make the relation optional.', ), ), diff --git a/test/serverpod_offline_sync_test_server/test/integration/sync/sync_foreign_key_set_default_enforcement_test.dart b/test/serverpod_offline_sync_test_server/test/integration/sync/sync_foreign_key_set_default_enforcement_test.dart index a78e3e3..6f807fc 100644 --- a/test/serverpod_offline_sync_test_server/test/integration/sync/sync_foreign_key_set_default_enforcement_test.dart +++ b/test/serverpod_offline_sync_test_server/test/integration/sync/sync_foreign_key_set_default_enforcement_test.dart @@ -302,90 +302,6 @@ void main() { }); }); - group('Given a visible child with a nullable set-default FK and a null default,', () { - late SyncNode server; - late SyncNode client; - late Person parent; - late NullableSetDefaultChild child; - - setUpAll(() async { - server = await syncNode(await createAdditionalTestSession(), testSyncTables); - client = await syncNode(await createAdditionalTestSession(), testSyncTables); - parent = Person(id: const Uuid().v7obj(), name: 'parent'); - child = NullableSetDefaultChild( - id: const Uuid().v7obj(), - name: 'child', - parentId: parent.id, - ); - await client.offlineSync.db.transactionForUser(testCrdtUserId, (tx) async { - await Person.db.insertRow(client.offlineSync, parent, transaction: tx); - await NullableSetDefaultChild.db.insertRow( - client.offlineSync, - child, - transaction: tx, - ); - }); - await syncWithServer(client, server); - }); - - group('when deleting its parent locally and synchronizing,', () { - late Person? clientParent; - late NullableSetDefaultChild? clientChild; - late Person? serverParent; - late NullableSetDefaultChild? serverChild; - late CrdtMergeSet changes; - - setUpAll(() async { - await client.offlineSync.db.transactionForUser(testCrdtUserId, (tx) async { - await Person.db.deleteRow(client.offlineSync, parent, transaction: tx); - }); - await syncWithServer(client, server); - - clientParent = await Person.db.findById(client.offlineSync, parent.id!); - clientChild = await NullableSetDefaultChild.db.findById( - client.offlineSync, - child.id!, - ); - serverParent = await Person.db.findById(server.offlineSync, parent.id!); - serverChild = await NullableSetDefaultChild.db.findById( - server.offlineSync, - child.id!, - ); - changes = await client.sync - .collectPendingChanges( - client.raw, - checkpointsBySpaceUuid: {testCrdtUserId: const []}, - ) - .toList(); - }); - - test('then the parent is hidden on the client.', () { - expect(clientParent, isNull); - }); - - test('then the child is visible with a null reference on the client.', () { - expect(clientChild, isNotNull); - expect(clientChild!.parentId, isNull); - }); - - test('then the parent is hidden on the server.', () { - expect(serverParent, isNull); - }); - - test('then the child is visible with a null reference on the server.', () { - expect(serverChild, isNotNull); - expect(serverChild!.parentId, isNull); - }); - - test('then the exported child insert retains the authored null.', () { - final insert = changes.whereType().singleWhere( - (change) => change.uuidRowId == child.id, - ); - expect((insert.data as NullableSetDefaultChild).parentId, isNull); - }); - }); - }); - group( 'Given a company referencing another town and a visible default town in its space,', () { diff --git a/test/serverpod_offline_sync_test_shared/pubspec.yaml b/test/serverpod_offline_sync_test_shared/pubspec.yaml index b151da7..693a496 100644 --- a/test/serverpod_offline_sync_test_shared/pubspec.yaml +++ b/test/serverpod_offline_sync_test_shared/pubspec.yaml @@ -8,10 +8,10 @@ environment: resolution: workspace dependencies: - serverpod_database: ^4.0.0 + serverpod_database: '>=4.0.4 <4.1.0' serverpod_offline_sync: path: ../../packages/serverpod_offline_sync - serverpod_serialization: ^4.0.0 + serverpod_serialization: '>=4.0.4 <4.1.0' dev_dependencies: lints: '>=3.0.0 <7.0.0'