From ee000e348c2503e09e9e1b63226d7cd2d816fd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelo=20Mendon=C3=A7a=20Soares?= Date: Thu, 8 Oct 2026 22:48:47 -0300 Subject: [PATCH] fix: Author the column default an upsert writes for a null foreign key (#164) Co-authored-by: Cursor Agent --- .../lib/src/database/database.dart | 12 +- .../lib/src/database/recorder.dart | 118 +- .../integration/untracked_update_test.dart | 32 +- .../20261008234516445/definition.json | 5995 +++++++++++++++++ .../20261008234516445/definition_project.json | 2919 ++++++++ .../20261008234516445/migration.dart | 1425 ++++ .../20261008234516445/migration.json | 68 + .../lib/migrations/migration_registry.dart | 2 + .../lib/src/protocol/protocol.dart | 17 + .../lib/src/generated/protocol.dart | 17 + .../models/unique_set_default_child.spy.yaml | 4 + .../20261008234516445/definition.json | 5995 +++++++++++++++++ .../20261008234516445/definition.sql | 1219 ++++ .../20261008234516445/definition_project.json | 2919 ++++++++ .../20261008234516445/migration.json | 68 + .../20261008234516445/migration.sql | 189 + .../migrations/migration_registry.txt | 1 + .../test/dst/dst_set_default_upsert_test.dart | 183 + .../test/integration/crud/upsert_test.dart | 7 +- .../server/transaction_membership_test.dart | 2 +- .../server/upsert_default_authoring_test.dart | 187 + ...sync_set_default_upsert_identity_test.dart | 400 ++ 22 files changed, 21728 insertions(+), 51 deletions(-) create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition.json create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition_project.json create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/migration.dart create mode 100644 test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/migration.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.sql create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition_project.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.json create mode 100644 test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.sql create mode 100644 test/serverpod_offline_sync_test_server/test/dst/dst_set_default_upsert_test.dart create mode 100644 test/serverpod_offline_sync_test_server/test/integration/server/upsert_default_authoring_test.dart create mode 100644 test/serverpod_offline_sync_test_server/test/integration/sync/sync_set_default_upsert_identity_test.dart diff --git a/packages/serverpod_offline_sync/lib/src/database/database.dart b/packages/serverpod_offline_sync/lib/src/database/database.dart index e2f19be..48602c5 100644 --- a/packages/serverpod_offline_sync/lib/src/database/database.dart +++ b/packages/serverpod_offline_sync/lib/src/database/database.dart @@ -491,9 +491,15 @@ class OfflineSyncDatabase implements Database { tx, projectionUnchanged: projection.projectionUnchanged, domainBeforeUpsert: projection.domain, - upsertRows: updateColumns == null && projection.domain.isNotEmpty - ? prepared.rows - : const [], + upsertInputs: updateColumns == null && projection.domain.isNotEmpty + ? _recorder.upsertInputsByRow( + suppliedRows: prepared.rows, + databaseRows: values, + updatedRows: updatedRows, + conflictColumns: conflictColumns, + ) + : const {}, + upsertConflictColumns: conflictColumns.map((c) => c.columnName).toSet(), ); if (noReturn) return []; _stripStampedRows(result, prepared); diff --git a/packages/serverpod_offline_sync/lib/src/database/recorder.dart b/packages/serverpod_offline_sync/lib/src/database/recorder.dart index f28e1b1..52a46a9 100644 --- a/packages/serverpod_offline_sync/lib/src/database/recorder.dart +++ b/packages/serverpod_offline_sync/lib/src/database/recorder.dart @@ -782,6 +782,67 @@ class CrdtMutationRecorder { }), ]; + /// Associates caller values with the rows accepted by the physical upsert. + /// + /// A unique conflict target can select an existing row with a different ID. + /// Match its unchanged conflict columns against the default-resolved inputs; + /// returned positions cannot be used because `updateWhere` can skip inputs. + Map> upsertInputsByRow({ + required List suppliedRows, + required List databaseRows, + required List updatedRows, + required List conflictColumns, + }) { + if (updatedRows.isEmpty) return const {}; + + if (conflictColumns.length == 1 && conflictColumns.single.columnName == 'id') { + final inputs = >{}; + for (final row in suppliedRows) { + if (row.id case final UuidValue rowId) { + inputs.putIfAbsent( + (row.table.tableName, rowId), + () => _authoredValuesFromRow(row, null), + ); + } + } + return inputs; + } + + final inputsByConflictKey = >{}; + for (final (index, row) in databaseRows.indexed) { + final key = _upsertConflictKey(row, conflictColumns); + if (key == null) continue; + + // A repeated target may appear after an accepted update makes + // `updateWhere` false. Keep the first input, not the later skipped one; + // the delegate rejects batches that accept the same target twice. + inputsByConflictKey.putIfAbsent( + key, + () => _authoredValuesFromRow(suppliedRows[index], null), + ); + } + return { + for (final row in updatedRows) + (row.table.tableName, row.id as UuidValue): + ?inputsByConflictKey[_upsertConflictKey(row, conflictColumns)], + }; + } + + String? _upsertConflictKey(TableRow row, List conflictColumns) { + final values = row.toJsonForDatabase() as Map; + final parts = []; + for (final column in conflictColumns) { + final value = values[column.columnName]; + // A null component makes no unique claim and cannot select an update. + if (value == null) return null; + + final part = canonicalProjectionValue(value); + // Length prefixes preserve component boundaries even inside text keys. + parts.add('${part.length}:$part'); + } + return parts.join(); + } + Future>> _readPlannedDomainValues( String tableName, Set rowIds, @@ -944,7 +1005,8 @@ class CrdtMutationRecorder { bool authoredColumnValues = false, Set projectionRows = const {}, Map> domainBeforeUpsert = const {}, - List upsertRows = const [], + Map> upsertInputs = const {}, + Set upsertConflictColumns = const {}, }) async { await _foreignKeyProjector.assertVisibleTargets(updatedRows, columns, transaction); @@ -953,6 +1015,16 @@ class CrdtMutationRecorder { rowIds, _, ) async { + // Serverpod's full-row upsert updates only non-conflict columns. Keep + // the caller's null `columns` separate from this physical write set so + // unchanged projected values still follow full-row passthrough rules. + final writtenColumns = + columns ?? + (upsertConflictColumns.isEmpty + ? null + : updatedRows.first.table.managedColumns + .where((c) => !upsertConflictColumns.contains(c.columnName)) + .toList()); final crdtDataRows = await _context.findRequiredCrdtRows( tableName, rowIds, @@ -966,24 +1038,13 @@ class CrdtMutationRecorder { transaction: transaction, ) : const {}; - final upsertInputs = upsertRows.isEmpty || implicitForeignKeyRepairFields.isEmpty - ? const >{} - : { - for (final row in upsertRows) - if (row.id case final UuidValue rowId) - (row.table.tableName, rowId): - row.toJsonForDatabase() as Map, - }; - // Insert defaults must not author over an echoed null that is holding - // a projected FK claim. - bool echoesProjectedNull(UuidValue rowId, String columnName) { - if (!implicitForeignKeyRepairFields.contains((tableName, rowId, columnName))) { - return false; - } + // A null foreign key is resolved to its column default before the + // physical upsert, so the stored value can equal a projected default the + // caller never wrote. Passthrough is about what the caller supplied. + Object? suppliedValue(UuidValue rowId, String columnName, Object? stored) { final input = upsertInputs[(tableName, rowId)]; - return input != null && - input[columnName] == null && - domainBeforeUpsert[(tableName, rowId)]?[columnName] == null; + if (input == null || !input.containsKey(columnName)) return stored; + return input[columnName]; } // Explicit columns author even an unchanged null; full-row passthrough @@ -992,7 +1053,7 @@ class CrdtMutationRecorder { if (authoredColumnValues) for (final row in updatedRows) for (final MapEntry(key: columnName, value: value) - in _authoredValuesFromRow(row, columns).entries) + in _authoredValuesFromRow(row, writtenColumns).entries) (tableName, row.id as UuidValue, columnName): value else // Only rows returned by the physical upsert were accepted by its @@ -1000,22 +1061,21 @@ class CrdtMutationRecorder { for (final row in updatedRows) if (domainBeforeUpsert.containsKey((tableName, row.id))) for (final MapEntry(key: columnName, value: value) - in _authoredValuesFromRow(row, columns).entries) + in _authoredValuesFromRow(row, writtenColumns).entries) if ((domainBeforeUpsert[(tableName, row.id)]?.containsKey(columnName) ?? false) && (columns != null || - (!projectionValuesEqual( - domainBeforeUpsert[(tableName, row.id)]![columnName], - value, - ) && - !echoesProjectedNull(row.id as UuidValue, columnName)))) + !projectionValuesEqual( + domainBeforeUpsert[(tableName, row.id)]![columnName], + suppliedValue(row.id as UuidValue, columnName, value), + ))) (tableName, row.id as UuidValue, columnName): value, }; _uniqueResolver.validateAuthoredFields(authoredOverlays); await _recordUpdatedFields( updatedRows, crdtDataRows, - columns, + writtenColumns, transaction, skippedFields: implicitForeignKeyRepairFields.difference( authoredOverlays.keys.toSet(), @@ -1026,11 +1086,13 @@ class CrdtMutationRecorder { updatedRows, transaction, inserting: false, - columns: columns, + columns: writtenColumns, )) { return; } - final updatedColumnNames = columns?.map((column) => column.columnName).toSet(); + final updatedColumnNames = writtenColumns + ?.map((column) => column.columnName) + .toSet(); await _maybeProject( tableName, rowIds, diff --git a/packages/serverpod_offline_sync_server/test/integration/untracked_update_test.dart b/packages/serverpod_offline_sync_server/test/integration/untracked_update_test.dart index 504562e..a1d3c5b 100644 --- a/packages/serverpod_offline_sync_server/test/integration/untracked_update_test.dart +++ b/packages/serverpod_offline_sync_server/test/integration/untracked_update_test.dart @@ -24,7 +24,22 @@ void main() { }); withServerpod( - 'PostgreSQL untracked updates with the database interceptor', + '[PostgreSQL untracked updates with the database interceptor]', + databaseInterceptor: offlineSyncDatabaseInterceptor, + serverDirectory: serverDirectory, + configOverride: (config) => config.copyWith( + apiServer: ServerConfig( + port: 0, + publicHost: 'localhost', + publicPort: 0, + publicScheme: 'http', + ), + database: PostgresDatabaseConfig.embedded( + dataPath: '${Directory.systemTemp.path}/offline_sync_updates_postgres_$pid', + name: 'serverpod_test', + maxConnectionCount: 5, + ), + ), (sessionBuilder, _) { late Session session; @@ -65,21 +80,6 @@ void main() { }); }); }, - databaseInterceptor: offlineSyncDatabaseInterceptor, - serverDirectory: serverDirectory, - configOverride: (config) => config.copyWith( - apiServer: ServerConfig( - port: 0, - publicHost: 'localhost', - publicPort: 0, - publicScheme: 'http', - ), - database: PostgresDatabaseConfig.embedded( - dataPath: '${Directory.systemTemp.path}/offline_sync_updates_postgres_$pid', - name: 'serverpod_test', - maxConnectionCount: 5, - ), - ), ); } diff --git a/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition.json b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition.json new file mode 100644 index 0000000..9081b61 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition.json @@ -0,0 +1,5995 @@ +{ + "__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 + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child_name", + "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_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": "20261008234516445" + }, + { + "__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/20261008234516445/definition_project.json b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition_project.json new file mode 100644 index 0000000..150e188 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/definition_project.json @@ -0,0 +1,2919 @@ +{ + "__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 + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child_name", + "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_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/20261008234516445/migration.dart b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/migration.dart new file mode 100644 index 0000000..6c89f8f --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/migration.dart @@ -0,0 +1,1425 @@ +/// 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 _Migration20261008234516445 implements MigrationVersionSql { + @override + String get version => '20261008234516445'; + + @override + String get moduleName => 'serverpod_offline_sync_test'; + + @override + String get migrationSql => '''BEGIN; + +-- +-- ACTION ALTER TABLE +-- +CREATE UNIQUE INDEX "unique_set_default_child_name" ON "unique_set_default_child" ("spaceId", "name"); + +-- +-- 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', '20261008234516445', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261008234516445', "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"); +CREATE UNIQUE INDEX "unique_set_default_child_name" ON "unique_set_default_child" ("spaceId", "name"); + + +-- +-- 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', '20261008234516445', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261008234516445', "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/20261008234516445/migration.json b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/migration.json new file mode 100644 index 0000000..245da04 --- /dev/null +++ b/test/serverpod_offline_sync_test_client/lib/migrations/20261008234516445/migration.json @@ -0,0 +1,68 @@ +{ + "__className__": "serverpod.DatabaseMigration", + "actions": [ + { + "__className__": "serverpod.DatabaseMigrationAction", + "type": "alterTable", + "alterTable": { + "__className__": "serverpod.TableMigration", + "name": "unique_set_default_child", + "schema": "public", + "addColumns": [], + "deleteColumns": [], + "modifyColumns": [], + "addIndexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child_name", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "deleteIndexes": [], + "addForeignKeys": [], + "deleteForeignKeys": [], + "warnings": [ + { + "__className__": "serverpod.DatabaseMigrationWarning", + "type": "uniqueIndexCreated", + "message": "Unique index \"unique_set_default_child_name\" is added to table \"unique_set_default_child\". If there are existing rows with duplicate values, this migration will fail.", + "table": "unique_set_default_child", + "columns": [ + "spaceId", + "name" + ], + "destrucive": false + } + ] + } + } + ], + "warnings": [ + { + "__className__": "serverpod.DatabaseMigrationWarning", + "type": "uniqueIndexCreated", + "message": "Unique index \"unique_set_default_child_name\" is added to table \"unique_set_default_child\". If there are existing rows with duplicate values, this migration will fail.", + "table": "unique_set_default_child", + "columns": [ + "spaceId", + "name" + ], + "destrucive": false + } + ], + "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 19efbe3..caa49a9 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 @@ -16,6 +16,7 @@ part '20260914144112288/migration.dart'; part '20260914165608984/migration.dart'; part '20260930185557154/migration.dart'; part '20261007215503877/migration.dart'; +part '20261008234516445/migration.dart'; /// Migration registry for the client-side database. class MigrationRegistry { @@ -34,6 +35,7 @@ class MigrationRegistry { _Migration20260914165608984(), _Migration20260930185557154(), _Migration20261007215503877(), + _Migration20261008234516445(), ]; /// List of all client-side database migration versions. 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 a547d1c..cffa0ec 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 @@ -2124,6 +2124,23 @@ class Protocol extends _isd.DatabaseSerializationManager { isUnique: true, isPrimary: false, ), + _isd.IndexDefinition( + indexName: 'unique_set_default_child_name', + tableSpace: null, + elements: [ + _isd.IndexElementDefinition( + type: _isd.IndexElementDefinitionType.column, + definition: 'spaceId', + ), + _isd.IndexElementDefinition( + type: _isd.IndexElementDefinitionType.column, + definition: 'name', + ), + ], + type: 'btree', + isUnique: true, + isPrimary: false, + ), ], managed: true, ), 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 3791d62..4044899 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 @@ -2123,6 +2123,23 @@ class Protocol extends _is.DatabaseSerializationManager { isUnique: true, isPrimary: false, ), + _isp.IndexDefinition( + indexName: 'unique_set_default_child_name', + tableSpace: null, + elements: [ + _isp.IndexElementDefinition( + type: _isp.IndexElementDefinitionType.column, + definition: 'spaceId', + ), + _isp.IndexElementDefinition( + type: _isp.IndexElementDefinitionType.column, + definition: 'name', + ), + ], + type: 'btree', + isUnique: true, + isPrimary: false, + ), ], managed: true, ), diff --git a/test/serverpod_offline_sync_test_server/lib/src/models/unique_set_default_child.spy.yaml b/test/serverpod_offline_sync_test_server/lib/src/models/unique_set_default_child.spy.yaml index 66cca1c..2752a55 100644 --- a/test/serverpod_offline_sync_test_server/lib/src/models/unique_set_default_child.spy.yaml +++ b/test/serverpod_offline_sync_test_server/lib/src/models/unique_set_default_child.spy.yaml @@ -6,3 +6,7 @@ fields: # Keep the database default without replacing explicit nulls on model reads. parentId: UuidValue?, defaultPersist='550e8400-e29b-41d4-a716-446655440000', unique parent: Town?, relation(field=parentId, onDelete=SetDefault, deferred) +indexes: + unique_set_default_child_name: + fields: spaceId, name + unique: true diff --git a/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.json b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.json new file mode 100644 index 0000000..9081b61 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.json @@ -0,0 +1,5995 @@ +{ + "__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 + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child_name", + "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_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": "20261008234516445" + }, + { + "__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/20261008234516445/definition.sql b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.sql new file mode 100644 index 0000000..57e5563 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition.sql @@ -0,0 +1,1219 @@ +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"); +CREATE UNIQUE INDEX "unique_set_default_child_name" ON "unique_set_default_child" ("spaceId", "name"); + + +-- +-- 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', '20261008234516445', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261008234516445', "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/20261008234516445/definition_project.json b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition_project.json new file mode 100644 index 0000000..150e188 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/definition_project.json @@ -0,0 +1,2919 @@ +{ + "__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 + }, + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child_name", + "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_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/20261008234516445/migration.json b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.json new file mode 100644 index 0000000..245da04 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.json @@ -0,0 +1,68 @@ +{ + "__className__": "serverpod.DatabaseMigration", + "actions": [ + { + "__className__": "serverpod.DatabaseMigrationAction", + "type": "alterTable", + "alterTable": { + "__className__": "serverpod.TableMigration", + "name": "unique_set_default_child", + "schema": "public", + "addColumns": [], + "deleteColumns": [], + "modifyColumns": [], + "addIndexes": [ + { + "__className__": "serverpod.IndexDefinition", + "indexName": "unique_set_default_child_name", + "elements": [ + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "spaceId" + }, + { + "__className__": "serverpod.IndexElementDefinition", + "type": 0, + "definition": "name" + } + ], + "type": "btree", + "isUnique": true, + "isPrimary": false + } + ], + "deleteIndexes": [], + "addForeignKeys": [], + "deleteForeignKeys": [], + "warnings": [ + { + "__className__": "serverpod.DatabaseMigrationWarning", + "type": "uniqueIndexCreated", + "message": "Unique index \"unique_set_default_child_name\" is added to table \"unique_set_default_child\". If there are existing rows with duplicate values, this migration will fail.", + "table": "unique_set_default_child", + "columns": [ + "spaceId", + "name" + ], + "destrucive": false + } + ] + } + } + ], + "warnings": [ + { + "__className__": "serverpod.DatabaseMigrationWarning", + "type": "uniqueIndexCreated", + "message": "Unique index \"unique_set_default_child_name\" is added to table \"unique_set_default_child\". If there are existing rows with duplicate values, this migration will fail.", + "table": "unique_set_default_child", + "columns": [ + "spaceId", + "name" + ], + "destrucive": false + } + ], + "migrationApiVersion": 1 +} \ No newline at end of file diff --git a/test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.sql b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.sql new file mode 100644 index 0000000..ae1639b --- /dev/null +++ b/test/serverpod_offline_sync_test_server/migrations/20261008234516445/migration.sql @@ -0,0 +1,189 @@ +BEGIN; + +-- +-- ACTION ALTER TABLE +-- +CREATE UNIQUE INDEX "unique_set_default_child_name" ON "unique_set_default_child" ("spaceId", "name"); + +-- +-- 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', '20261008234516445', (unixepoch('now', 'subsecond') * 1000)) + ON CONFLICT ("module") + DO UPDATE SET "version" = '20261008234516445', "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 0a2f583..cbb67b3 100644 --- a/test/serverpod_offline_sync_test_server/migrations/migration_registry.txt +++ b/test/serverpod_offline_sync_test_server/migrations/migration_registry.txt @@ -16,3 +16,4 @@ 20260914165608984 20260930185557154 20261007215503877 +20261008234516445 diff --git a/test/serverpod_offline_sync_test_server/test/dst/dst_set_default_upsert_test.dart b/test/serverpod_offline_sync_test_server/test/dst/dst_set_default_upsert_test.dart new file mode 100644 index 0000000..ddd7f1a --- /dev/null +++ b/test/serverpod_offline_sync_test_server/test/dst/dst_set_default_upsert_test.dart @@ -0,0 +1,183 @@ +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'; + +import '../integration/test_tools/client_session.dart'; +import '../integration/test_tools/crdt_probes.dart'; +import '../integration/test_tools/sync_topology.dart'; + +/// Serverpod reads a null insert value as a request for the column default, so +/// an upsert supplying null for `unique_set_default_child.parentId` writes +/// `550e8400-…`. That is an authored write of the default, not the full-row +/// passthrough of `docs/projection-model.md`, which only translates back a +/// projected value the caller echoed unchanged. +/// +/// The two coincide exactly when a set-default repair is already displaying the +/// default over a hidden parent, which is the state the convergence simulation +/// reached at seed 1791399000: `unique_set_default_child.upsert … accepted +/// "550e8400-…" but retained "00000000-000b-…"`. +void main() { + initTestClientSession(createSessionPerTest: false); + + const defaultTownId = UuidValue.raw('550e8400-e29b-41d4-a716-446655440000'); + + group( + 'Given a set-default child displaying the column default for a hidden parent,', + () { + late SyncNode node; + late Town parent; + late UniqueSetDefaultChild child; + + /// The clock the column authored its value at, which is the row's + /// insertion clock while no field record exists. + Future parentIdHlc() async { + final field = await CrdtDataField.db.findFirstRow( + node.offlineSync, + where: (t) => + t.row.uuidRowId.equals(child.id) & t.column.name.equals('parentId'), + include: CrdtDataField.include(node: CrdtNode.include()), + ); + return field?.hlc ?? await rowHlc(child.id!, databaseSession: node.offlineSync); + } + + setUpAll(() async { + node = await syncNode(await createAdditionalTestSession(), testSyncTables); + parent = Town(id: const Uuid().v7obj(), name: 'parent'); + child = UniqueSetDefaultChild( + id: const Uuid().v7obj(), + name: 'child', + parentId: parent.id, + ); + + await node.offlineSync.db.transactionForUser(testCrdtUserId, (tx) async { + await Town.db.insert(node.offlineSync, [ + parent, + Town(id: defaultTownId, name: 'default'), + ], transaction: tx); + await UniqueSetDefaultChild.db.insertRow( + node.offlineSync, + child, + transaction: tx, + ); + }); + + // A peer deleted the parent after this replica authored the reference, + // so the repair is projected rather than authored locally. + final childHlc = await rowHlc(child.id!, databaseSession: node.offlineSync); + await node.offlineSync.db.mergeChanges([ + CrdtMergeDelete( + uuidSpaceId: testCrdtUserId, + tableName: Town.t.tableName, + uuidRowId: parent.id!, + uuidNodeId: const Uuid().v7obj(), + hlcDatetime: childHlc.datetime.add(const Duration(milliseconds: 1)), + hlcCounter: 0, + clFlag: 2, + reason: CrdtDataDeletedReason.userDelete, + ), + ], spaceId: testCrdtUserId); + }); + + test( + 'when reading the repaired child, ' + 'then the repair displays the default over the authored parent.', + () async { + final repaired = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + final attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + + expect(repaired!.parentId, defaultTownId); + expect(attempt?.value.toString(), parent.id.toString()); + expect(attempt?.projectionReason, CrdtProjectionReason.foreignKeySetDefault); + }, + ); + + group('when a full-row upsert supplies null for the parent,', () { + late Hlc before; + late Hlc after; + late CrdtDataAttemptedValue? attempt; + late UniqueSetDefaultChild? stored; + late UniqueSetDefaultChild? restored; + late CrdtMergeSet changes; + + setUpAll(() async { + before = await parentIdHlc(); + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => UniqueSetDefaultChild.db.upsertRow( + node.offlineSync, + UniqueSetDefaultChild(id: child.id, name: 'edited'), + conflictColumns: (t) => [t.id], + transaction: tx, + ), + ); + + stored = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + + after = await parentIdHlc(); + changes = await node.sync + .collectPendingChanges( + node.raw, + checkpointsBySpaceUuid: {testCrdtUserId: const []}, + ) + .toList(); + + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => Town.db.insertRow(node.offlineSync, parent, transaction: tx), + ); + + restored = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + }); + + test('then the default it wrote becomes the authored value.', () { + expect(stored!.name, 'edited'); + expect(stored!.parentId, defaultTownId); + expect(attempt, isNull); + }); + + test('then the write advances the authored clock of the column.', () { + expect(after, greaterThan(before)); + }); + + test('then outbound sync exports the default, not the replaced parent.', () { + final insert = changes.inserts.singleWhere( + (change) => change.uuidRowId == child.id, + ); + expect((insert.data as UniqueSetDefaultChild).parentId, defaultTownId); + expect( + changes.updates + .where( + (change) => + change.uuidRowId == child.id && change.columnName == 'parentId', + ) + .map((change) => change.value.toString()), + everyElement(defaultTownId.toString()), + ); + }); + + test('then restoring the old parent leaves the written default.', () { + expect(restored!.parentId, defaultTownId); + }); + }); + }, + ); +} diff --git a/test/serverpod_offline_sync_test_server/test/integration/crud/upsert_test.dart b/test/serverpod_offline_sync_test_server/test/integration/crud/upsert_test.dart index c33905f..97370ec 100644 --- a/test/serverpod_offline_sync_test_server/test/integration/crud/upsert_test.dart +++ b/test/serverpod_offline_sync_test_server/test/integration/crud/upsert_test.dart @@ -627,14 +627,15 @@ void main() { expect(rows, hasLength(1)); }); - test('then CRDT fields are tracked for the default updated columns.', () async { + test('then the conflict columns keep their original implicit clocks.', () async { final fields = await CrdtDataField.db.find( session, where: (t) => t.row.uuidRowId.equals(uniqueComposite.id), - include: CrdtDataField.include(column: CrdtSchemaColumn.include()), ); - expect(fields.map((e) => e.column!.name).toSet(), {'scope', 'value'}); + // Both domain columns are conflict keys, so Serverpod's default + // update set contains no authored domain write. + expect(fields, isEmpty); }); }); }); diff --git a/test/serverpod_offline_sync_test_server/test/integration/server/transaction_membership_test.dart b/test/serverpod_offline_sync_test_server/test/integration/server/transaction_membership_test.dart index 4d1afcb..156a061 100644 --- a/test/serverpod_offline_sync_test_server/test/integration/server/transaction_membership_test.dart +++ b/test/serverpod_offline_sync_test_server/test/integration/server/transaction_membership_test.dart @@ -21,7 +21,7 @@ void main() { }); withServerpod( - 'PostgreSQL membership visibility', + '[PostgreSQL membership visibility]', rollbackDatabase: RollbackDatabase.disabled, serverDirectory: serverDirectory, configOverride: (config) => config.copyWith( diff --git a/test/serverpod_offline_sync_test_server/test/integration/server/upsert_default_authoring_test.dart b/test/serverpod_offline_sync_test_server/test/integration/server/upsert_default_authoring_test.dart new file mode 100644 index 0000000..d254c92 --- /dev/null +++ b/test/serverpod_offline_sync_test_server/test/integration/server/upsert_default_authoring_test.dart @@ -0,0 +1,187 @@ +import 'dart:io'; + +import 'package:serverpod/serverpod.dart'; +import 'package:serverpod_offline_sync_server/serverpod_offline_sync_server.dart'; +import 'package:serverpod_offline_sync_test_server/src/generated/protocol.dart' + as server; +import 'package:test/test.dart'; + +import '../test_tools/crdt_probes.dart'; +import '../test_tools/postgres_migrations.dart'; +import '../test_tools/serverpod_test_tools.dart'; + +void main() { + final serverDirectory = Directory( + '${Directory.systemTemp.path}/offline_sync_upsert_${const Uuid().v4()}', + ); + + setUpAll(() => preparePostgresMigrations(serverDirectory)); + + tearDownAll(() async { + if (serverDirectory.existsSync()) await serverDirectory.delete(recursive: true); + }); + + withServerpod( + '[PostgreSQL upsert default authoring]', + rollbackDatabase: RollbackDatabase.disabled, + serverDirectory: serverDirectory, + configOverride: (config) => config.copyWith( + database: PostgresDatabaseConfig.embedded( + dataPath: '${serverDirectory.path}/postgres', + name: 'serverpod_test', + maxConnectionCount: 6, + ), + ), + (sessionBuilder, _) { + late OfflineSyncDatabaseSession session; + + setUpAll(() async { + session = OfflineSyncDatabaseSession.wraps( + sessionBuilder.build(), + syncTables: server.syncTables, + ); + await session.db.initialize(); + }); + + group('Given a projected-default child and a child with an available parent,', () { + late UuidValue space; + late server.Town parent; + late server.Town otherParent; + late server.Town insertParent; + late server.UniqueSetDefaultChild child; + late server.UniqueSetDefaultChild skipped; + late Hlc originalClock; + + const defaultTownId = UuidValue.raw('550e8400-e29b-41d4-a716-446655440000'); + + setUpAll(() async { + space = const Uuid().v7obj(); + parent = server.Town(id: const Uuid().v7obj(), name: 'parent'); + otherParent = server.Town(id: const Uuid().v7obj(), name: 'other'); + insertParent = server.Town(id: const Uuid().v7obj(), name: 'insert parent'); + + child = server.UniqueSetDefaultChild( + id: const Uuid().v7obj(), + name: 'child', + parentId: parent.id, + ); + + skipped = server.UniqueSetDefaultChild( + id: const Uuid().v7obj(), + name: 'skipped', + parentId: otherParent.id, + ); + + await session.db.transactionForUser(space, (tx) async { + await server.Town.db.insert(session, [ + parent, + otherParent, + insertParent, + server.Town(id: defaultTownId, name: 'default'), + ], transaction: tx); + await server.UniqueSetDefaultChild.db.insert( + session, + [child, skipped], + transaction: tx, + ); + }); + + originalClock = await rowHlc(child.id!, databaseSession: session); + + await session.db.mergeChanges([ + CrdtMergeDelete( + uuidSpaceId: space, + tableName: server.Town.t.tableName, + uuidRowId: parent.id!, + uuidNodeId: const Uuid().v7obj(), + hlcDatetime: originalClock.datetime.add(const Duration(milliseconds: 1)), + hlcCounter: 0, + clFlag: 2, + reason: CrdtDataDeletedReason.userDelete, + ), + ], spaceId: space); + }); + + group('when a mixed-ID batch skips, updates by name, and inserts rows,', () { + late List saved; + late CrdtDataAttemptedValue? attempt; + late CrdtDataField? field; + late server.UniqueSetDefaultChild? restored; + late server.UniqueSetDefaultChild? unchanged; + + setUpAll(() async { + saved = await session.db.transactionForUser( + space, + (tx) => server.UniqueSetDefaultChild.db.upsert( + session, + [ + server.UniqueSetDefaultChild( + name: skipped.name, + parentId: otherParent.id, + ), + server.UniqueSetDefaultChild( + id: const Uuid().v7obj(), + name: child.name, + ), + server.UniqueSetDefaultChild( + name: 'inserted', + parentId: insertParent.id, + ), + ], + conflictColumns: (t) => [t.spaceId, t.name], + updateWhere: (t) => t.name.equals(child.name), + transaction: tx, + ), + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: session, + ); + + field = await CrdtDataField.db.findFirstRow( + session, + where: (t) => + t.row.uuidRowId.equals(child.id) & t.column.name.equals('parentId'), + include: CrdtDataField.include(node: CrdtNode.include()), + ); + + unchanged = await server.UniqueSetDefaultChild.db.findById( + session, + skipped.id!, + ); + + await session.db.transactionForUser( + space, + (tx) => server.Town.db.insertRow(session, parent, transaction: tx), + ); + + restored = await server.UniqueSetDefaultChild.db.findById( + session, + child.id!, + ); + }); + + test( + 'then the existing row authors the default despite the different input ID.', + () { + expect( + saved.map((row) => row.name), + unorderedEquals([child.name, 'inserted']), + ); + expect(saved.singleWhere((row) => row.name == child.name).id, child.id); + expect(attempt, isNull); + expect(field!.hlc, greaterThan(originalClock)); + expect(restored!.parentId, defaultTownId); + }, + ); + + test('then the skipped row retains its parent.', () { + expect(unchanged!.parentId, otherParent.id); + }); + }); + }); + }, + ); +} diff --git a/test/serverpod_offline_sync_test_server/test/integration/sync/sync_set_default_upsert_identity_test.dart b/test/serverpod_offline_sync_test_server/test/integration/sync/sync_set_default_upsert_identity_test.dart new file mode 100644 index 0000000..e4e0b8a --- /dev/null +++ b/test/serverpod_offline_sync_test_server/test/integration/sync/sync_set_default_upsert_identity_test.dart @@ -0,0 +1,400 @@ +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'; + +import '../test_tools/client_session.dart'; +import '../test_tools/crdt_probes.dart'; +import '../test_tools/sync_topology.dart'; + +void main() { + initTestClientSession(createSessionPerTest: false); + + group('Given a child displaying the column default for its hidden parent,', () { + late SyncNode node; + late Town parent; + late UniqueSetDefaultChild child; + late Hlc originalClock; + late UniqueSetDefaultChild? before; + late CrdtDataAttemptedValue? originalAttempt; + + const defaultTownId = UuidValue.raw('550e8400-e29b-41d4-a716-446655440000'); + + setUp(() async { + node = await syncNode(await createAdditionalTestSession(), testSyncTables); + parent = Town(id: const Uuid().v7obj(), name: 'parent'); + child = UniqueSetDefaultChild( + id: const Uuid().v7obj(), + name: 'child', + parentId: parent.id, + ); + + await node.offlineSync.db.transactionForUser(testCrdtUserId, (tx) async { + await Town.db.insert(node.offlineSync, [ + parent, + Town(id: defaultTownId, name: 'default'), + ], transaction: tx); + + await UniqueSetDefaultChild.db.insertRow( + node.offlineSync, + child, + transaction: tx, + ); + }); + + originalClock = await _parentIdHlc(node, child.id!); + + await node.offlineSync.db.mergeChanges([ + CrdtMergeDelete( + uuidSpaceId: testCrdtUserId, + tableName: Town.t.tableName, + uuidRowId: parent.id!, + uuidNodeId: const Uuid().v7obj(), + hlcDatetime: originalClock.datetime.add(const Duration(milliseconds: 1)), + hlcCounter: 0, + clFlag: 2, + reason: CrdtDataDeletedReason.userDelete, + ), + ], spaceId: testCrdtUserId); + + before = await UniqueSetDefaultChild.db.findById(node.offlineSync, child.id!); + + originalAttempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + }); + + group( + 'when an upsert supplies null and matches its unique name without an ID,', + () { + late UniqueSetDefaultChild? saved; + late UniqueSetDefaultChild? restored; + late UniqueSetDefaultChild? peerChild; + late CrdtDataAttemptedValue? attempt; + late CrdtDataAttemptedValue? peerAttempt; + late Hlc updatedClock; + + setUp(() async { + saved = await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => UniqueSetDefaultChild.db.upsertRow( + node.offlineSync, + UniqueSetDefaultChild(name: child.name), + conflictColumns: (t) => [t.spaceId, t.name], + transaction: tx, + ), + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + + updatedClock = await _parentIdHlc(node, child.id!); + + final peer = await syncNode( + await createAdditionalTestSession(), + testSyncTables, + ); + + await pushChanges(node, peer); + peerChild = await UniqueSetDefaultChild.db.findById( + peer.offlineSync, + child.id!, + ); + + peerAttempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: peer.offlineSync, + ); + + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => Town.db.insertRow(node.offlineSync, parent, transaction: tx), + ); + + restored = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + }); + + test( + 'then it replaces the hidden claim on the existing row with the default.', + () { + expect(before!.parentId, defaultTownId); + expect(originalAttempt?.value.toString(), parent.id.toString()); + expect( + originalAttempt?.projectionReason, + CrdtProjectionReason.foreignKeySetDefault, + ); + expect(saved!.id, child.id); + expect(saved!.parentId, defaultTownId); + expect(attempt, isNull); + }, + ); + + test('then the authored foreign-key clock advances.', () { + expect(updatedClock, greaterThan(originalClock)); + }); + + test('then an empty peer receives the authored default.', () { + expect(peerChild!.parentId, defaultTownId); + expect(peerAttempt, isNull); + }); + + test('then restoring the old parent leaves the authored default.', () { + expect(restored!.parentId, defaultTownId); + }); + }, + ); + + group('when an upsert matches its name and echoes the displayed default,', () { + late CrdtDataAttemptedValue? attempt; + late Hlc updatedClock; + late UniqueSetDefaultChild? restored; + + setUp(() async { + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => UniqueSetDefaultChild.db.upsertRow( + node.offlineSync, + UniqueSetDefaultChild(name: child.name, parentId: defaultTownId), + conflictColumns: (t) => [t.spaceId, t.name], + transaction: tx, + ), + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + + updatedClock = await _parentIdHlc(node, child.id!); + + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => Town.db.insertRow(node.offlineSync, parent, transaction: tx), + ); + + restored = await UniqueSetDefaultChild.db.findById(node.offlineSync, child.id!); + }); + + test( + 'then the original authored parent and its clock survive the passthrough.', + () { + expect(attempt?.value.toString(), parent.id.toString()); + expect(updatedClock, originalClock); + expect(restored!.parentId, parent.id); + }, + ); + }); + + group( + 'when an upsert supplies null for the foreign key used only as its conflict key,', + () { + late CrdtDataAttemptedValue? attempt; + late Hlc updatedClock; + late UniqueSetDefaultChild? restored; + + setUp(() async { + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => UniqueSetDefaultChild.db.upsertRow( + node.offlineSync, + UniqueSetDefaultChild(id: child.id, name: 'edited'), + conflictColumns: (t) => [t.parentId], + transaction: tx, + ), + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + + updatedClock = await _parentIdHlc(node, child.id!); + + await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => Town.db.insertRow(node.offlineSync, parent, transaction: tx), + ); + + restored = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + }); + + test('then the foreign key is not authored by the name-only update.', () { + expect(attempt?.value.toString(), parent.id.toString()); + expect(updatedClock, originalClock); + expect(restored!.name, 'edited'); + expect(restored!.parentId, parent.id); + }); + }, + ); + + group('and another child has an available parent,', () { + late Town otherParent; + late Town insertParent; + late UniqueSetDefaultChild skipped; + late Hlc skippedClock; + late UuidValue inputId; + + setUp(() async { + otherParent = Town(id: const Uuid().v7obj(), name: 'other'); + insertParent = Town(id: const Uuid().v7obj(), name: 'insert parent'); + skipped = UniqueSetDefaultChild( + id: const Uuid().v7obj(), + name: 'skipped', + parentId: otherParent.id, + ); + + inputId = const Uuid().v7obj(); + await node.offlineSync.db.transactionForUser(testCrdtUserId, (tx) async { + await Town.db.insert(node.offlineSync, [ + otherParent, + insertParent, + ], transaction: tx); + + await UniqueSetDefaultChild.db.insertRow( + node.offlineSync, + skipped, + transaction: tx, + ); + }); + + skippedClock = await _parentIdHlc(node, skipped.id!); + }); + + group( + 'when a batch skips one input, updates by name with a different ID, and inserts another,', + () { + late List saved; + late CrdtDataAttemptedValue? attempt; + late UniqueSetDefaultChild? stored; + late UniqueSetDefaultChild? unchanged; + late Hlc updatedClock; + late Hlc unchangedClock; + + setUp(() async { + saved = await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => UniqueSetDefaultChild.db.upsert( + node.offlineSync, + [ + UniqueSetDefaultChild(name: skipped.name, parentId: otherParent.id), + UniqueSetDefaultChild(id: inputId, name: child.name), + UniqueSetDefaultChild(name: 'inserted', parentId: insertParent.id), + ], + conflictColumns: (t) => [t.spaceId, t.name], + updateWhere: (t) => t.name.equals(child.name), + transaction: tx, + ), + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + + stored = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + + unchanged = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + skipped.id!, + ); + + updatedClock = await _parentIdHlc(node, child.id!); + unchangedClock = await _parentIdHlc(node, skipped.id!); + }); + + test( + 'then the accepted existing row authors the default under its stored ID.', + () { + expect( + saved.map((row) => row.name), + unorderedEquals([child.name, 'inserted']), + ); + expect(saved.singleWhere((row) => row.name == child.name).id, child.id); + expect(saved.map((row) => row.id), isNot(contains(inputId))); + expect(stored!.parentId, defaultTownId); + expect(attempt, isNull); + expect(updatedClock, greaterThan(originalClock)); + }, + ); + + test( + 'then the rejected input leaves its row and authored clock unchanged.', + () { + expect(unchanged!.parentId, otherParent.id); + expect(unchangedClock, skippedClock); + }, + ); + }, + ); + + group( + 'when a batch retargets the child and skips a later input with the same key,', + () { + late List saved; + late UniqueSetDefaultChild? stored; + late CrdtDataAttemptedValue? attempt; + + setUp(() async { + saved = await node.offlineSync.db.transactionForUser( + testCrdtUserId, + (tx) => UniqueSetDefaultChild.db.upsert( + node.offlineSync, + [ + UniqueSetDefaultChild(name: child.name, parentId: insertParent.id), + UniqueSetDefaultChild(name: child.name, parentId: defaultTownId), + ], + conflictColumns: (t) => [t.spaceId, t.name], + updateWhere: (t) => t.parentId.equals(defaultTownId), + transaction: tx, + ), + ); + + stored = await UniqueSetDefaultChild.db.findById( + node.offlineSync, + child.id!, + ); + + attempt = await attemptedValue( + rowId: child.id!, + columnName: 'parentId', + databaseSession: node.offlineSync, + ); + }); + + test('then the accepted input supplies the authored parent.', () { + expect(saved, hasLength(1)); + expect(saved.single.id, child.id); + expect(stored!.parentId, insertParent.id); + expect(attempt, isNull); + }); + }, + ); + }); + }); +} + +Future _parentIdHlc(SyncNode node, UuidValue childId) async { + final field = await CrdtDataField.db.findFirstRow( + node.offlineSync, + where: (t) => t.row.uuidRowId.equals(childId) & t.column.name.equals('parentId'), + include: CrdtDataField.include(node: CrdtNode.include()), + ); + return field?.hlc ?? await rowHlc(childId, databaseSession: node.offlineSync); +}