chore: Add the generated code and migrations that were gitignored (#102)

This commit is contained in:
Marcelo Mendonça Soares 2026-07-09 11:25:28 -03:00 • committed by GitHub
commit 20b23a1a9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
154 changed files with 108827 additions and 101 deletions

13
.github/actions/setup/action.yml vendored Normal file
View file

@ -0,0 +1,13 @@
name: Set up workspace
description: Set up Dart SDK, install Melos, and run pub get
runs:
using: composite
steps:
- uses: dart-lang/setup-dart@v1
- shell: bash
run: dart pub global activate melos
- shell: bash
run: dart pub get

View file

@ -20,76 +20,53 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
generate:
verify_generated:
name: verify generated code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Set up Dart
uses: dart-lang/setup-dart@v1
- name: Generate code
run: melos generate
- name: Install Melos
run: dart pub global activate melos
- name: Verify generated code is committed
run: git diff --exit-code
- name: Run pub get
run: dart pub get
verify_migrations:
name: verify migrations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Generate code and migrations
run: melos generate && melos create-migration
- name: Create migrations
run: melos create-migration
- name: Upload generated code
uses: actions/upload-artifact@v4
with:
name: generated-code
path: |
**/lib/migrations/**
**/lib/src/generated/**
**/lib/src/protocol/**
**/*_server/migrations/**
**/test/**/serverpod_test_tools.dart
- name: Verify migrations are committed
run: git diff --exit-code
dart_format:
name: dart format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Set up Dart
uses: dart-lang/setup-dart@v1
- name: Run pub get
run: dart pub get
# Skip code generation for formatting check
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
run: melos format
dart_analyze:
needs: generate
name: dart analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Dart
uses: dart-lang/setup-dart@v1
- name: Install Melos
run: dart pub global activate melos
- name: Download generated code
uses: actions/download-artifact@v4
with:
name: generated-code
- name: Run pub get
run: dart pub get
- uses: ./.github/actions/setup
- name: Run lint
run: melos lint
tests:
needs: generate
name: dart test
runs-on: ubuntu-latest
permissions:
@ -97,20 +74,7 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Dart
uses: dart-lang/setup-dart@v1
- name: Install Melos
run: dart pub global activate melos
- name: Download generated code
uses: actions/download-artifact@v4
with:
name: generated-code
- name: Run pub get
run: dart pub get
- uses: ./.github/actions/setup
- name: Run tests
run: melos test
@ -135,7 +99,6 @@ jobs:
# comment-tag: coverage-results
benchmarks:
needs: generate
name: run benchmarks
runs-on: ubuntu-latest
permissions:
@ -143,17 +106,7 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Dart
uses: dart-lang/setup-dart@v1
- name: Download generated code
uses: actions/download-artifact@v4
with:
name: generated-code
- name: Run pub get
run: dart pub get
- uses: ./.github/actions/setup
- name: Configure Git
run: |
@ -192,25 +145,11 @@ jobs:
# public version.
#
# publish_check:
# needs: generate
# name: dart publish check
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
#
# - name: Set up Dart
# uses: dart-lang/setup-dart@v1
#
# - name: Install Melos
# run: dart pub global activate melos
#
# - name: Download generated code
# uses: actions/download-artifact@v4
# with:
# name: generated-code
#
# - name: Run pub get
# run: dart pub get
# - uses: ./.github/actions/setup
#
# - name: Run publish dry run
# run: melos publish-check

5
.gitignore vendored
View file

@ -19,8 +19,3 @@ coverage-results.txt
# Melos
.idea/
*melos_*.iml
# TODO: Remove this once the generated code is stable.
**/lib/src/generated/
**/lib/src/protocol/
**/test/integration/test_tools/serverpod_test_tools.dart

View file

@ -11,6 +11,3 @@ build/
# Directory created by dartdoc
doc/api/
# Migrations do not need to be committed, as they are only for testing
lib/migrations/

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,992 @@
/// 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 _Migration20260703114646971 implements MigrationVersionSql {
@override
String get version => '20260703114646971';
@override
String get moduleName => 'serverpod_offline_sync';
@override
String get migrationSql => '''BEGIN;
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_data_foreign_key" (
"id" INTEGER PRIMARY KEY,
"fieldId" INTEGER NOT NULL,
"attemptedValue" BLOB,
"visibleValue" BLOB,
"overrideReason" INTEGER,
CONSTRAINT "crdt_data_foreign_key_fk_0" FOREIGN KEY ("fieldId") REFERENCES "crdt_data_fields" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_data_foreign_key_field_idx" ON "crdt_data_foreign_key" ("fieldId");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_data_rows" (
"id" INTEGER PRIMARY KEY,
"hlcDatetime" INTEGER NOT NULL,
"hlcCounter" INTEGER NOT NULL,
"scopeId" 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 ("scopeId") REFERENCES "crdt_scopes" ("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_scope_tbl_row_idx" ON "crdt_data_rows" ("scopeId", "tblId", "uuidRowId");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_schema_columns" (
"id" INTEGER PRIMARY KEY,
"tblId" INTEGER NOT NULL,
"name" TEXT 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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_scope_members" (
"id" INTEGER PRIMARY KEY,
"scopeId" INTEGER NOT NULL,
"userUuid" BLOB NOT NULL,
"role" TEXT NOT NULL,
CONSTRAINT "crdt_scope_members_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_scope_member_unique_idx" ON "crdt_scope_members" ("userUuid", "scopeId");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_scope_nodes" (
"id" INTEGER PRIMARY KEY,
"scopeId" INTEGER NOT NULL,
"nodeId" INTEGER NOT NULL,
"lastReceivedHlc" BLOB,
CONSTRAINT "crdt_scope_nodes_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_scope_nodes_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_scope_node_unique_idx" ON "crdt_scope_nodes" ("scopeId", "nodeId");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_scopes" (
"id" INTEGER PRIMARY KEY,
"uuidScopeId" 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 "crdt_scopes_fk_0" FOREIGN KEY ("currentNodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_scopes__uuidScopeId__unique_idx" ON "crdt_scopes" ("uuidScopeId");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "crdt_sync_integrity_violations" (
"id" INTEGER PRIMARY KEY,
"type" TEXT NOT NULL,
"domainTableName" TEXT NOT NULL,
"uuidRowId" BLOB NOT NULL,
"ownerScopeUuid" BLOB,
"incomingScopeUuid" 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 "crdt_sync_integrity_violations_key_idx" ON "crdt_sync_integrity_violations" ("type", "operation", "domainTableName", "uuidRowId", "ownerScopeUuid", "incomingScopeUuid");
--
-- ACTION CREATE TABLE
--
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
) 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");
--
-- ACTION CREATE TABLE
--
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
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" ("storageId", "path");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
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");
--
-- ACTION CREATE TABLE
--
CREATE TABLE "serverpod_readwrite_test" (
"id" INTEGER PRIMARY KEY,
"number" INTEGER NOT NULL
) STRICT;
--
-- ACTION CREATE TABLE
--
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;
--
-- ACTION CREATE TABLE
--
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");
--
-- 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
('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_data_foreign_key', 'attemptedValue', 'uuid', NULL),
('crdt_data_foreign_key', 'visibleValue', 'uuid', 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_scope_members', 'userUuid', 'uuid', NULL),
('crdt_scope_nodes', 'lastReceivedHlc', 'jsonb', NULL),
('crdt_scopes', 'uuidScopeId', 'uuid', NULL),
('crdt_sync_integrity_violations', 'uuidRowId', 'uuid', NULL),
('crdt_sync_integrity_violations', 'ownerScopeUuid', 'uuid', NULL),
('crdt_sync_integrity_violations', 'incomingScopeUuid', 'uuid', NULL),
('crdt_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL),
('crdt_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL),
('crdt_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', 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);
--
-- MIGRATION VERSION FOR serverpod_offline_sync
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_offline_sync', '20260703114646971', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260703114646971', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod', '20260416151914983-insights-perf', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260416151914983-insights-perf', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
COMMIT;
''';
@override
String get definitionSql => '''BEGIN;
--
-- 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 CrdtDataForeignKey as table crdt_data_foreign_key
--
CREATE TABLE "crdt_data_foreign_key" (
"id" INTEGER PRIMARY KEY,
"fieldId" INTEGER NOT NULL,
"attemptedValue" BLOB,
"visibleValue" BLOB,
"overrideReason" INTEGER,
CONSTRAINT "crdt_data_foreign_key_fk_0" FOREIGN KEY ("fieldId") REFERENCES "crdt_data_fields" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_data_foreign_key_field_idx" ON "crdt_data_foreign_key" ("fieldId");
--
-- Class CrdtDataRow as table crdt_data_rows
--
CREATE TABLE "crdt_data_rows" (
"id" INTEGER PRIMARY KEY,
"hlcDatetime" INTEGER NOT NULL,
"hlcCounter" INTEGER NOT NULL,
"scopeId" 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 ("scopeId") REFERENCES "crdt_scopes" ("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_scope_tbl_row_idx" ON "crdt_data_rows" ("scopeId", "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,
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 CrdtScopeMember as table crdt_scope_members
--
CREATE TABLE "crdt_scope_members" (
"id" INTEGER PRIMARY KEY,
"scopeId" INTEGER NOT NULL,
"userUuid" BLOB NOT NULL,
"role" TEXT NOT NULL,
CONSTRAINT "crdt_scope_members_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_scope_member_unique_idx" ON "crdt_scope_members" ("userUuid", "scopeId");
--
-- Class CrdtScopeNode as table crdt_scope_nodes
--
CREATE TABLE "crdt_scope_nodes" (
"id" INTEGER PRIMARY KEY,
"scopeId" INTEGER NOT NULL,
"nodeId" INTEGER NOT NULL,
"lastReceivedHlc" BLOB,
CONSTRAINT "crdt_scope_nodes_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_scope_nodes_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_scope_node_unique_idx" ON "crdt_scope_nodes" ("scopeId", "nodeId");
--
-- Class CrdtScope as table crdt_scopes
--
CREATE TABLE "crdt_scopes" (
"id" INTEGER PRIMARY KEY,
"uuidScopeId" 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 "crdt_scopes_fk_0" FOREIGN KEY ("currentNodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_scopes__uuidScopeId__unique_idx" ON "crdt_scopes" ("uuidScopeId");
--
-- Class CrdtSyncIntegrityViolation as table crdt_sync_integrity_violations
--
CREATE TABLE "crdt_sync_integrity_violations" (
"id" INTEGER PRIMARY KEY,
"type" TEXT NOT NULL,
"domainTableName" TEXT NOT NULL,
"uuidRowId" BLOB NOT NULL,
"ownerScopeUuid" BLOB,
"incomingScopeUuid" 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 "crdt_sync_integrity_violations_key_idx" ON "crdt_sync_integrity_violations" ("type", "operation", "domainTableName", "uuidRowId", "ownerScopeUuid", "incomingScopeUuid");
--
-- 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
) 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 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
) 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");
--
-- 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
('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_data_foreign_key', 'attemptedValue', 'uuid', NULL),
('crdt_data_foreign_key', 'visibleValue', 'uuid', 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_scope_members', 'userUuid', 'uuid', NULL),
('crdt_scope_nodes', 'lastReceivedHlc', 'jsonb', NULL),
('crdt_scopes', 'uuidScopeId', 'uuid', NULL),
('crdt_sync_integrity_violations', 'uuidRowId', 'uuid', NULL),
('crdt_sync_integrity_violations', 'ownerScopeUuid', 'uuid', NULL),
('crdt_sync_integrity_violations', 'incomingScopeUuid', 'uuid', NULL),
('crdt_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL),
('crdt_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL),
('crdt_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', 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);
--
-- MIGRATION VERSION FOR serverpod_offline_sync
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_offline_sync', '20260703114646971', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260703114646971', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod', '20260416151914983-insights-perf', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260416151914983-insights-perf', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
COMMIT;
''';
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
/// AUTOGENERATED BY SERVERPOD create-migration - DO NOT EDIT BY HAND
/// Merging: resolve registry conflicts the same as migration_registry.txt.
library;
import 'package:serverpod_database/serverpod_database.dart';
part '20260703114646971/migration.dart';
/// Migration registry for the client-side database.
class MigrationRegistry {
/// Ordered list of all client-side database migrations.
/// New migrations are always appended at the end.
static final List<MigrationVersionSql> migrations = [
_Migration20260703114646971(),
];
/// List of all client-side database migration versions.
static List<String> get versions => migrations.map((m) => m.version).toList();
}

View file

@ -0,0 +1,53 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_client/serverpod_client.dart' as _i1;
import 'dart:async' as _i2;
import 'package:serverpod_offline_sync_client/src/protocol/sync/stream_event.dart'
as _i3;
/// Endpoint for CRDT-based offline-first synchronization.
/// {@category Endpoint}
class EndpointCrdtSync extends _i1.EndpointRef {
EndpointCrdtSync(_i1.EndpointCaller caller) : super(caller);
@override
String get name => 'serverpod_offline_sync.crdtSync';
/// Opens a bidirectional CRDT sync session with the authenticated client.
_i2.Stream<_i3.CrdtSyncStreamEvent> sync({
required _i2.Stream<_i3.CrdtSyncStreamEvent> changes,
required bool once,
}) =>
caller.callStreamingServerEndpoint<
_i2.Stream<_i3.CrdtSyncStreamEvent>,
_i3.CrdtSyncStreamEvent
>(
'serverpod_offline_sync.crdtSync',
'sync',
{'once': once},
{'changes': changes},
);
}
class Caller extends _i1.ModuleEndpointCaller {
Caller(_i1.ServerpodClientShared client) : super(client) {
crdtSync = EndpointCrdtSync(this);
}
late final EndpointCrdtSync crdtSync;
@override
Map<String, _i1.EndpointRef> get endpointRefLookup => {
'serverpod_offline_sync.crdtSync': crdtSync,
};
}

View file

@ -0,0 +1,885 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: dead_code, unnecessary_null_comparison
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_offline_sync_shared/serverpod_offline_sync_shared.dart'
as _i1;
import 'package:serverpod_database/serverpod_database.dart' as _i2;
import '../data/row.dart' as _i3;
import '../node/node.dart' as _i4;
import '../data/deleted_reason.dart' as _i5;
import 'package:serverpod_client/serverpod_client.dart' as _i6;
import 'package:serverpod_offline_sync_client/src/protocol/protocol.dart'
as _i7;
/// CRDT visibility generation table.
///
/// This table stores materialized monotone CLFlag metadata after a visibility
/// change event has been recorded.
abstract class CrdtDataDeleted extends _i1.BaseHlc
implements _i2.TableRow<int?> {
CrdtDataDeleted._({
this.id,
required super.hlcDatetime,
required super.hlcCounter,
this.row,
required this.rowId,
required this.nodeId,
this.node,
required this.clFlag,
required this.reason,
});
factory CrdtDataDeleted({
int? id,
required DateTime hlcDatetime,
required int hlcCounter,
_i3.CrdtDataRow? row,
required int rowId,
required int nodeId,
_i4.CrdtNode? node,
required int clFlag,
required _i5.CrdtDataDeletedReason reason,
}) = _CrdtDataDeletedImpl;
factory CrdtDataDeleted.fromJson(Map<String, dynamic> jsonSerialization) {
return CrdtDataDeleted(
id: jsonSerialization['id'] as int?,
hlcDatetime: _i6.DateTimeJsonExtension.fromJson(
jsonSerialization['hlcDatetime'],
),
hlcCounter: jsonSerialization['hlcCounter'] as int,
row: jsonSerialization['row'] == null
? null
: _i7.Protocol().deserialize<_i3.CrdtDataRow>(
jsonSerialization['row'],
),
rowId: jsonSerialization['rowId'] as int,
nodeId: jsonSerialization['nodeId'] as int,
node: jsonSerialization['node'] == null
? null
: _i7.Protocol().deserialize<_i4.CrdtNode>(jsonSerialization['node']),
clFlag: jsonSerialization['clFlag'] as int,
reason: _i5.CrdtDataDeletedReason.fromJson(
(jsonSerialization['reason'] as int),
),
);
}
static final t = CrdtDataDeletedTable();
static const db = CrdtDataDeletedRepository._();
@override
int? id;
/// Row whose visibility is tracked.
_i3.CrdtDataRow? row;
int rowId;
int nodeId;
/// The node that updated the field.
_i4.CrdtNode? node;
/// Monotone causal-length flag. Odd values are visible and even values are deleted.
int clFlag;
/// Why the row entered its current visibility generation.
_i5.CrdtDataDeletedReason reason;
@override
_i2.Table<int?> get table => t;
/// Returns a shallow copy of this [CrdtDataDeleted]
/// with some or all fields replaced by the given arguments.
@override
@_i6.useResult
CrdtDataDeleted copyWith({
int? id,
DateTime? hlcDatetime,
int? hlcCounter,
_i3.CrdtDataRow? row,
int? rowId,
int? nodeId,
_i4.CrdtNode? node,
int? clFlag,
_i5.CrdtDataDeletedReason? reason,
});
@override
Map<String, dynamic> toJson() {
return {
'__className__': 'serverpod_offline_sync.CrdtDataDeleted',
if (id != null) 'id': id,
'hlcDatetime': hlcDatetime.toJson(),
'hlcCounter': hlcCounter,
if (row != null) 'row': row?.toJson(),
'rowId': rowId,
'nodeId': nodeId,
if (node != null) 'node': node?.toJson(),
'clFlag': clFlag,
'reason': reason.toJson(),
};
}
static CrdtDataDeletedInclude include({
_i3.CrdtDataRowInclude? row,
_i4.CrdtNodeInclude? node,
}) {
return CrdtDataDeletedInclude._(
row: row,
node: node,
);
}
static CrdtDataDeletedIncludeList includeList({
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? where,
int? limit,
int? offset,
_i2.OrderByBuilder<CrdtDataDeletedTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i2.OrderByListBuilder<CrdtDataDeletedTable>? orderByList,
CrdtDataDeletedInclude? include,
}) {
return CrdtDataDeletedIncludeList._(
where: where,
limit: limit,
offset: offset,
orderBy: orderBy?.call(CrdtDataDeleted.t),
orderDescending: // ignore: deprecated_member_use_from_same_package
orderDescending,
orderByList: orderByList?.call(CrdtDataDeleted.t),
include: include,
);
}
@override
String toString() {
return _i6.SerializationManager.encode(this);
}
}
class _Undefined {}
class _CrdtDataDeletedImpl extends CrdtDataDeleted {
_CrdtDataDeletedImpl({
int? id,
required DateTime hlcDatetime,
required int hlcCounter,
_i3.CrdtDataRow? row,
required int rowId,
required int nodeId,
_i4.CrdtNode? node,
required int clFlag,
required _i5.CrdtDataDeletedReason reason,
}) : super._(
id: id,
hlcDatetime: hlcDatetime,
hlcCounter: hlcCounter,
row: row,
rowId: rowId,
nodeId: nodeId,
node: node,
clFlag: clFlag,
reason: reason,
);
/// Returns a shallow copy of this [CrdtDataDeleted]
/// with some or all fields replaced by the given arguments.
@_i6.useResult
@override
CrdtDataDeleted copyWith({
Object? id = _Undefined,
DateTime? hlcDatetime,
int? hlcCounter,
Object? row = _Undefined,
int? rowId,
int? nodeId,
Object? node = _Undefined,
int? clFlag,
_i5.CrdtDataDeletedReason? reason,
}) {
return CrdtDataDeleted(
id: id is int? ? id : this.id,
hlcDatetime: hlcDatetime ?? this.hlcDatetime,
hlcCounter: hlcCounter ?? this.hlcCounter,
row: row is _i3.CrdtDataRow? ? row : this.row?.copyWith(),
rowId: rowId ?? this.rowId,
nodeId: nodeId ?? this.nodeId,
node: node is _i4.CrdtNode? ? node : this.node?.copyWith(),
clFlag: clFlag ?? this.clFlag,
reason: reason ?? this.reason,
);
}
}
class CrdtDataDeletedUpdateTable extends _i2.UpdateTable<CrdtDataDeletedTable> {
CrdtDataDeletedUpdateTable(super.table);
_i2.ColumnValue<DateTime, DateTime> hlcDatetime(DateTime value) =>
_i2.ColumnValue(
table.hlcDatetime,
value,
);
_i2.ColumnValue<int, int> hlcCounter(int value) => _i2.ColumnValue(
table.hlcCounter,
value,
);
_i2.ColumnValue<int, int> rowId(int value) => _i2.ColumnValue(
table.rowId,
value,
);
_i2.ColumnValue<int, int> nodeId(int value) => _i2.ColumnValue(
table.nodeId,
value,
);
_i2.ColumnValue<int, int> clFlag(int value) => _i2.ColumnValue(
table.clFlag,
value,
);
_i2.ColumnValue<_i5.CrdtDataDeletedReason, _i5.CrdtDataDeletedReason> reason(
_i5.CrdtDataDeletedReason value,
) => _i2.ColumnValue(
table.reason,
value,
);
}
class CrdtDataDeletedTable extends _i2.Table<int?> {
CrdtDataDeletedTable({super.tableRelation})
: super(tableName: 'crdt_data_tombstone') {
updateTable = CrdtDataDeletedUpdateTable(this);
hlcDatetime = _i2.ColumnDateTime(
'hlcDatetime',
this,
);
hlcCounter = _i2.ColumnInt(
'hlcCounter',
this,
);
rowId = _i2.ColumnInt(
'rowId',
this,
);
nodeId = _i2.ColumnInt(
'nodeId',
this,
);
clFlag = _i2.ColumnInt(
'clFlag',
this,
);
reason = _i2.ColumnEnum(
'reason',
this,
_i2.EnumSerialization.byIndex,
);
}
late final CrdtDataDeletedUpdateTable updateTable;
/// The datetime component of the HLC timestamp.
late final _i2.ColumnDateTime hlcDatetime;
/// The counter component of the HLC timestamp.
late final _i2.ColumnInt hlcCounter;
/// Row whose visibility is tracked.
_i3.CrdtDataRowTable? _row;
late final _i2.ColumnInt rowId;
late final _i2.ColumnInt nodeId;
/// The node that updated the field.
_i4.CrdtNodeTable? _node;
/// Monotone causal-length flag. Odd values are visible and even values are deleted.
late final _i2.ColumnInt clFlag;
/// Why the row entered its current visibility generation.
late final _i2.ColumnEnum<_i5.CrdtDataDeletedReason> reason;
_i3.CrdtDataRowTable get row {
if (_row != null) return _row!;
_row = _i2.createRelationTable(
relationFieldName: 'row',
field: CrdtDataDeleted.t.rowId,
foreignField: _i3.CrdtDataRow.t.id,
tableRelation: tableRelation,
createTable: (foreignTableRelation) =>
_i3.CrdtDataRowTable(tableRelation: foreignTableRelation),
);
return _row!;
}
_i4.CrdtNodeTable get node {
if (_node != null) return _node!;
_node = _i2.createRelationTable(
relationFieldName: 'node',
field: CrdtDataDeleted.t.nodeId,
foreignField: _i4.CrdtNode.t.id,
tableRelation: tableRelation,
createTable: (foreignTableRelation) =>
_i4.CrdtNodeTable(tableRelation: foreignTableRelation),
);
return _node!;
}
@override
List<_i2.Column> get columns => [
id,
hlcDatetime,
hlcCounter,
rowId,
nodeId,
clFlag,
reason,
];
@override
_i2.Table? getRelationTable(String relationField) {
if (relationField == 'row') {
return row;
}
if (relationField == 'node') {
return node;
}
return null;
}
}
class CrdtDataDeletedInclude extends _i2.IncludeObject {
CrdtDataDeletedInclude._({
_i3.CrdtDataRowInclude? row,
_i4.CrdtNodeInclude? node,
}) {
_row = row;
_node = node;
}
_i3.CrdtDataRowInclude? _row;
_i4.CrdtNodeInclude? _node;
@override
Map<String, _i2.Include?> get includes => {
'row': _row,
'node': _node,
};
@override
_i2.Table<int?> get table => CrdtDataDeleted.t;
}
class CrdtDataDeletedIncludeList extends _i2.IncludeList {
CrdtDataDeletedIncludeList._({
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? where,
super.limit,
super.offset,
super.orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
super.orderDescending,
super.orderByList,
super.include,
}) {
super.where = where?.call(CrdtDataDeleted.t);
}
@override
Map<String, _i2.Include?> get includes => include?.includes ?? {};
@override
_i2.Table<int?> get table => CrdtDataDeleted.t;
}
class CrdtDataDeletedRepository {
const CrdtDataDeletedRepository._();
final attachRow = const CrdtDataDeletedAttachRowRepository._();
/// Returns a list of [CrdtDataDeleted]s matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order of the items use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// The maximum number of items can be set by [limit]. If no limit is set,
/// all items matching the query will be returned.
///
/// [offset] defines how many items to skip, after which [limit] (or all)
/// items are read from the database.
///
/// ```dart
/// var persons = await Persons.db.find(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.firstName,
/// limit: 100,
/// );
/// ```
Future<List<CrdtDataDeleted>> find(
_i2.DatabaseSession session, {
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? where,
int? limit,
int? offset,
_i2.OrderByBuilder<CrdtDataDeletedTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i2.OrderByListBuilder<CrdtDataDeletedTable>? orderByList,
_i2.Transaction? transaction,
CrdtDataDeletedInclude? include,
_i2.LockMode? lockMode,
_i2.LockBehavior? lockBehavior,
}) async {
return session.db.find<CrdtDataDeleted>(
where: where?.call(CrdtDataDeleted.t),
orderBy: orderBy?.call(CrdtDataDeleted.t),
orderByList: orderByList?.call(CrdtDataDeleted.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
limit: limit,
offset: offset,
transaction: transaction,
include: include,
lockMode: lockMode,
lockBehavior: lockBehavior,
);
}
/// Returns the first matching [CrdtDataDeleted] matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// [offset] defines how many items to skip, after which the next one will be picked.
///
/// ```dart
/// var youngestPerson = await Persons.db.findFirstRow(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.age,
/// );
/// ```
Future<CrdtDataDeleted?> findFirstRow(
_i2.DatabaseSession session, {
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? where,
int? offset,
_i2.OrderByBuilder<CrdtDataDeletedTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i2.OrderByListBuilder<CrdtDataDeletedTable>? orderByList,
_i2.Transaction? transaction,
CrdtDataDeletedInclude? include,
_i2.LockMode? lockMode,
_i2.LockBehavior? lockBehavior,
}) async {
return session.db.findFirstRow<CrdtDataDeleted>(
where: where?.call(CrdtDataDeleted.t),
orderBy: orderBy?.call(CrdtDataDeleted.t),
orderByList: orderByList?.call(CrdtDataDeleted.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
offset: offset,
transaction: transaction,
include: include,
lockMode: lockMode,
lockBehavior: lockBehavior,
);
}
/// Finds a single [CrdtDataDeleted] by its [id] or null if no such row exists.
Future<CrdtDataDeleted?> findById(
_i2.DatabaseSession session,
int id, {
_i2.Transaction? transaction,
CrdtDataDeletedInclude? include,
_i2.LockMode? lockMode,
_i2.LockBehavior? lockBehavior,
}) async {
return session.db.findById<CrdtDataDeleted>(
id,
transaction: transaction,
include: include,
lockMode: lockMode,
lockBehavior: lockBehavior,
);
}
/// Inserts all [CrdtDataDeleted]s in the list and returns the inserted rows.
///
/// The returned [CrdtDataDeleted]s will have their `id` fields set.
///
/// This is an atomic operation, meaning that if one of the rows fails to
/// insert, none of the rows will be inserted.
///
/// If [ignoreConflicts] is set to `true`, rows that conflict with existing
/// rows are silently skipped, and only the successfully inserted rows are
/// returned.
///
/// If [noReturn] is set to `true`, the inserted rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataDeleted>> insert(
_i2.DatabaseSession session,
List<CrdtDataDeleted> rows, {
_i2.Transaction? transaction,
bool ignoreConflicts = false,
bool noReturn = false,
}) async {
return session.db.insert<CrdtDataDeleted>(
rows,
transaction: transaction,
ignoreConflicts: ignoreConflicts,
noReturn: noReturn,
);
}
/// Inserts a single [CrdtDataDeleted] and returns the inserted row.
///
/// The returned [CrdtDataDeleted] will have its `id` field set.
Future<CrdtDataDeleted> insertRow(
_i2.DatabaseSession session,
CrdtDataDeleted row, {
_i2.Transaction? transaction,
}) async {
return session.db.insertRow<CrdtDataDeleted>(
row,
transaction: transaction,
);
}
/// Upserts all [CrdtDataDeleted]s in the list and returns the resulting rows.
///
/// If a row conflicts on the given [conflictColumns], the existing row is
/// updated with the new values. Otherwise, a new row is inserted.
///
/// If [updateColumns] is provided, only those columns will be updated on
/// conflict. If null, all non-conflict, non-id columns are updated.
///
/// If [updateWhere] is provided, the update only applies to rows matching the
/// given expression. Conflicting rows that don't match are skipped and not
/// returned, so the resulting list may be shorter than [rows].
///
/// The returned [CrdtDataDeleted]s will have their `id` fields set.
///
/// This is an atomic operation, meaning that if one of the rows fails,
/// none of the rows will be affected.
///
/// If [noReturn] is set to `true`, the resulting rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataDeleted>> upsert(
_i2.DatabaseSession session,
List<CrdtDataDeleted> rows, {
required _i2.ColumnSelections<CrdtDataDeletedTable> conflictColumns,
_i2.ColumnSelections<CrdtDataDeletedTable>? updateColumns,
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? updateWhere,
_i2.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.upsert<CrdtDataDeleted>(
rows,
conflictColumns: conflictColumns(CrdtDataDeleted.t),
updateColumns: updateColumns?.call(CrdtDataDeleted.t),
updateWhere: updateWhere?.call(CrdtDataDeleted.t),
transaction: transaction,
noReturn: noReturn,
);
}
/// Upserts a single [CrdtDataDeleted] and returns the resulting row.
///
/// If the row conflicts on the given [conflictColumns], the existing row is
/// updated. Otherwise, a new row is inserted.
///
/// If [updateColumns] is provided, only those columns will be updated on
/// conflict. If null, all non-conflict, non-id columns are updated.
///
/// If [updateWhere] is provided, the update only applies when the existing
/// row matches the expression. Returns `null` if no row was affected — for
/// example when [updateWhere] does not match the conflicting row.
///
/// The returned [CrdtDataDeleted] will have its `id` field set.
Future<CrdtDataDeleted?> upsertRow(
_i2.DatabaseSession session,
CrdtDataDeleted row, {
required _i2.ColumnSelections<CrdtDataDeletedTable> conflictColumns,
_i2.ColumnSelections<CrdtDataDeletedTable>? updateColumns,
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? updateWhere,
_i2.Transaction? transaction,
}) async {
return session.db.upsertRow<CrdtDataDeleted>(
row,
conflictColumns: conflictColumns(CrdtDataDeleted.t),
updateColumns: updateColumns?.call(CrdtDataDeleted.t),
updateWhere: updateWhere?.call(CrdtDataDeleted.t),
transaction: transaction,
);
}
/// Updates all [CrdtDataDeleted]s in the list and returns the updated rows. If
/// [columns] is provided, only those columns will be updated. Defaults to
/// all columns.
/// This is an atomic operation, meaning that if one of the rows fails to
/// update, none of the rows will be updated.
///
/// If [noReturn] is set to `true`, the updated rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataDeleted>> update(
_i2.DatabaseSession session,
List<CrdtDataDeleted> rows, {
_i2.ColumnSelections<CrdtDataDeletedTable>? columns,
_i2.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.update<CrdtDataDeleted>(
rows,
columns: columns?.call(CrdtDataDeleted.t),
transaction: transaction,
noReturn: noReturn,
);
}
/// Updates a single [CrdtDataDeleted]. The row needs to have its id set.
/// Optionally, a list of [columns] can be provided to only update those
/// columns. Defaults to all columns.
Future<CrdtDataDeleted> updateRow(
_i2.DatabaseSession session,
CrdtDataDeleted row, {
_i2.ColumnSelections<CrdtDataDeletedTable>? columns,
_i2.Transaction? transaction,
}) async {
return session.db.updateRow<CrdtDataDeleted>(
row,
columns: columns?.call(CrdtDataDeleted.t),
transaction: transaction,
);
}
/// Updates a single [CrdtDataDeleted] by its [id] with the specified [columnValues].
/// Returns the updated row or null if no row with the given id exists.
Future<CrdtDataDeleted?> updateById(
_i2.DatabaseSession session,
int id, {
required _i2.ColumnValueListBuilder<CrdtDataDeletedUpdateTable>
columnValues,
_i2.Transaction? transaction,
}) async {
return session.db.updateById<CrdtDataDeleted>(
id,
columnValues: columnValues(CrdtDataDeleted.t.updateTable),
transaction: transaction,
);
}
/// Updates all [CrdtDataDeleted]s matching the [where] expression with the specified [columnValues].
/// Returns the list of updated rows.
///
/// If [noReturn] is set to `true`, the updated rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataDeleted>> updateWhere(
_i2.DatabaseSession session, {
required _i2.ColumnValueListBuilder<CrdtDataDeletedUpdateTable>
columnValues,
required _i2.WhereExpressionBuilder<CrdtDataDeletedTable> where,
int? limit,
int? offset,
_i2.OrderByBuilder<CrdtDataDeletedTable>? orderBy,
_i2.OrderByListBuilder<CrdtDataDeletedTable>? orderByList,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i2.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.updateWhere<CrdtDataDeleted>(
columnValues: columnValues(CrdtDataDeleted.t.updateTable),
where: where(CrdtDataDeleted.t),
limit: limit,
offset: offset,
orderBy: orderBy?.call(CrdtDataDeleted.t),
orderByList: orderByList?.call(CrdtDataDeleted.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
transaction: transaction,
noReturn: noReturn,
);
}
/// Deletes all [CrdtDataDeleted]s in the list and returns the deleted rows.
///
/// To specify the order of the returned rows use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// This is an atomic operation, meaning that if one of the rows fail to
/// be deleted, none of the rows will be deleted.
///
/// If [noReturn] is set to `true`, the deleted rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataDeleted>> delete(
_i2.DatabaseSession session,
List<CrdtDataDeleted> rows, {
_i2.OrderByBuilder<CrdtDataDeletedTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i2.OrderByListBuilder<CrdtDataDeletedTable>? orderByList,
_i2.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.delete<CrdtDataDeleted>(
rows,
orderBy: orderBy?.call(CrdtDataDeleted.t),
orderByList: orderByList?.call(CrdtDataDeleted.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
transaction: transaction,
noReturn: noReturn,
);
}
/// Deletes a single [CrdtDataDeleted].
Future<CrdtDataDeleted> deleteRow(
_i2.DatabaseSession session,
CrdtDataDeleted row, {
_i2.Transaction? transaction,
}) async {
return session.db.deleteRow<CrdtDataDeleted>(
row,
transaction: transaction,
);
}
/// Deletes all rows matching the [where] expression.
///
/// To specify the order of the returned rows use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// If [noReturn] is set to `true`, the deleted rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataDeleted>> deleteWhere(
_i2.DatabaseSession session, {
required _i2.WhereExpressionBuilder<CrdtDataDeletedTable> where,
_i2.OrderByBuilder<CrdtDataDeletedTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i2.OrderByListBuilder<CrdtDataDeletedTable>? orderByList,
_i2.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.deleteWhere<CrdtDataDeleted>(
where: where(CrdtDataDeleted.t),
orderBy: orderBy?.call(CrdtDataDeleted.t),
orderByList: orderByList?.call(CrdtDataDeleted.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
transaction: transaction,
noReturn: noReturn,
);
}
/// Counts the number of rows matching the [where] expression. If omitted,
/// will return the count of all rows in the table.
Future<int> count(
_i2.DatabaseSession session, {
_i2.WhereExpressionBuilder<CrdtDataDeletedTable>? where,
int? limit,
_i2.Transaction? transaction,
}) async {
return session.db.count<CrdtDataDeleted>(
where: where?.call(CrdtDataDeleted.t),
limit: limit,
transaction: transaction,
);
}
/// Acquires row-level locks on [CrdtDataDeleted] rows matching the [where] expression.
Future<void> lockRows(
_i2.DatabaseSession session, {
required _i2.WhereExpressionBuilder<CrdtDataDeletedTable> where,
required _i2.LockMode lockMode,
required _i2.Transaction transaction,
_i2.LockBehavior lockBehavior = _i2.LockBehavior.wait,
}) async {
return session.db.lockRows<CrdtDataDeleted>(
where: where(CrdtDataDeleted.t),
lockMode: lockMode,
lockBehavior: lockBehavior,
transaction: transaction,
);
}
}
class CrdtDataDeletedAttachRowRepository {
const CrdtDataDeletedAttachRowRepository._();
/// Creates a relation between the given [CrdtDataDeleted] and [CrdtDataRow]
/// by setting the [CrdtDataDeleted]'s foreign key `rowId` to refer to the [CrdtDataRow].
Future<void> row(
_i2.DatabaseSession session,
CrdtDataDeleted crdtDataDeleted,
_i3.CrdtDataRow row, {
_i2.Transaction? transaction,
}) async {
if (crdtDataDeleted.id == null) {
throw ArgumentError.notNull('crdtDataDeleted.id');
}
if (row.id == null) {
throw ArgumentError.notNull('row.id');
}
var $crdtDataDeleted = crdtDataDeleted.copyWith(rowId: row.id);
await session.db.updateRow<CrdtDataDeleted>(
$crdtDataDeleted,
columns: [CrdtDataDeleted.t.rowId],
transaction: transaction,
);
}
/// Creates a relation between the given [CrdtDataDeleted] and [CrdtNode]
/// by setting the [CrdtDataDeleted]'s foreign key `nodeId` to refer to the [CrdtNode].
Future<void> node(
_i2.DatabaseSession session,
CrdtDataDeleted crdtDataDeleted,
_i4.CrdtNode node, {
_i2.Transaction? transaction,
}) async {
if (crdtDataDeleted.id == null) {
throw ArgumentError.notNull('crdtDataDeleted.id');
}
if (node.id == null) {
throw ArgumentError.notNull('node.id');
}
var $crdtDataDeleted = crdtDataDeleted.copyWith(nodeId: node.id);
await session.db.updateRow<CrdtDataDeleted>(
$crdtDataDeleted,
columns: [CrdtDataDeleted.t.nodeId],
transaction: transaction,
);
}
}

View file

@ -0,0 +1,48 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_client/serverpod_client.dart' as _i1;
/// Why a synced user tombstone changed row visibility.
enum CrdtDataDeletedReason implements _i1.SerializableModel {
userInsert,
userReinsert,
userDelete,
userCascadeDelete,
uniqueLoser
;
static CrdtDataDeletedReason fromJson(int index) {
switch (index) {
case 0:
return CrdtDataDeletedReason.userInsert;
case 1:
return CrdtDataDeletedReason.userReinsert;
case 2:
return CrdtDataDeletedReason.userDelete;
case 3:
return CrdtDataDeletedReason.userCascadeDelete;
case 4:
return CrdtDataDeletedReason.uniqueLoser;
default:
throw ArgumentError(
'Value "$index" cannot be converted to "CrdtDataDeletedReason"',
);
}
}
@override
int toJson() => index;
@override
String toString() => name;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,811 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: dead_code, unnecessary_null_comparison
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_database/serverpod_database.dart' as _i1;
import '../data/field.dart' as _i2;
import 'package:serverpod_client/serverpod_client.dart' as _i3;
import '../data/foreign_key_override_reason.dart' as _i4;
import 'package:serverpod_offline_sync_client/src/protocol/protocol.dart'
as _i5;
/// CRDT field foreign key value and projection table.
///
/// This table stores the user/attempted foreign key value for a CRDT field and
/// the materialized foreign key projection for that value. CrdtDataField stores
/// only HLC metadata, so FK columns store their durable attempted value here.
///
/// Repairs must be recomputable from merged CRDT row, field, and tombstone
/// facts plus this attempted FK value. The projection columns record what was
/// materialized into the domain row; they do not decide business semantics or
/// create user field updates during merge.
abstract class CrdtDataForeignKey implements _i1.TableRow<int?> {
CrdtDataForeignKey._({
this.id,
this.field,
required this.fieldId,
required this.attemptedValue,
this.visibleValue,
this.overrideReason,
});
factory CrdtDataForeignKey({
int? id,
_i2.CrdtDataField? field,
required int fieldId,
required _i3.UuidValue? attemptedValue,
_i3.UuidValue? visibleValue,
_i4.CrdtForeignKeyOverrideReason? overrideReason,
}) = _CrdtDataForeignKeyImpl;
factory CrdtDataForeignKey.fromJson(Map<String, dynamic> jsonSerialization) {
return CrdtDataForeignKey(
id: jsonSerialization['id'] as int?,
field: jsonSerialization['field'] == null
? null
: _i5.Protocol().deserialize<_i2.CrdtDataField>(
jsonSerialization['field'],
),
fieldId: jsonSerialization['fieldId'] as int,
attemptedValue: jsonSerialization['attemptedValue'] == null
? null
: _i3.UuidValueJsonExtension.fromJson(
jsonSerialization['attemptedValue'],
),
visibleValue: jsonSerialization['visibleValue'] == null
? null
: _i3.UuidValueJsonExtension.fromJson(
jsonSerialization['visibleValue'],
),
overrideReason: jsonSerialization['overrideReason'] == null
? null
: _i4.CrdtForeignKeyOverrideReason.fromJson(
(jsonSerialization['overrideReason'] as int),
),
);
}
static final t = CrdtDataForeignKeyTable();
static const db = CrdtDataForeignKeyRepository._();
@override
int? id;
/// The field that the foreign key belongs to.
_i2.CrdtDataField? field;
int fieldId;
/// The user-attempted foreign key value that the CRDT field currently carries.
///
/// This may be null for nullable foreign keys. This is durable FK field-value
/// storage for CRDT columns whose CrdtDataField row stores only HLC metadata.
_i3.UuidValue? attemptedValue;
/// The foreign key value that is currently visible in the actual data row
/// when an override is active (overrideReason is non-null).
_i3.UuidValue? visibleValue;
/// The authoritative indicator and reason for an active projection override.
///
/// This is the single source of truth for whether an override is active:
/// non-null means an override is active; null means no override. It also
/// names the cause of the override. The FK resolver recomputes it from merged
/// row, field, and tombstone facts.
_i4.CrdtForeignKeyOverrideReason? overrideReason;
@override
_i1.Table<int?> get table => t;
/// Returns a shallow copy of this [CrdtDataForeignKey]
/// with some or all fields replaced by the given arguments.
@_i3.useResult
CrdtDataForeignKey copyWith({
int? id,
_i2.CrdtDataField? field,
int? fieldId,
_i3.UuidValue? attemptedValue,
_i3.UuidValue? visibleValue,
_i4.CrdtForeignKeyOverrideReason? overrideReason,
});
@override
Map<String, dynamic> toJson() {
return {
'__className__': 'serverpod_offline_sync.CrdtDataForeignKey',
if (id != null) 'id': id,
if (field != null) 'field': field?.toJson(),
'fieldId': fieldId,
if (attemptedValue != null) 'attemptedValue': attemptedValue?.toJson(),
if (visibleValue != null) 'visibleValue': visibleValue?.toJson(),
if (overrideReason != null) 'overrideReason': overrideReason?.toJson(),
};
}
static CrdtDataForeignKeyInclude include({_i2.CrdtDataFieldInclude? field}) {
return CrdtDataForeignKeyInclude._(field: field);
}
static CrdtDataForeignKeyIncludeList includeList({
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? where,
int? limit,
int? offset,
_i1.OrderByBuilder<CrdtDataForeignKeyTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i1.OrderByListBuilder<CrdtDataForeignKeyTable>? orderByList,
CrdtDataForeignKeyInclude? include,
}) {
return CrdtDataForeignKeyIncludeList._(
where: where,
limit: limit,
offset: offset,
orderBy: orderBy?.call(CrdtDataForeignKey.t),
orderDescending: // ignore: deprecated_member_use_from_same_package
orderDescending,
orderByList: orderByList?.call(CrdtDataForeignKey.t),
include: include,
);
}
@override
String toString() {
return _i3.SerializationManager.encode(this);
}
}
class _Undefined {}
class _CrdtDataForeignKeyImpl extends CrdtDataForeignKey {
_CrdtDataForeignKeyImpl({
int? id,
_i2.CrdtDataField? field,
required int fieldId,
required _i3.UuidValue? attemptedValue,
_i3.UuidValue? visibleValue,
_i4.CrdtForeignKeyOverrideReason? overrideReason,
}) : super._(
id: id,
field: field,
fieldId: fieldId,
attemptedValue: attemptedValue,
visibleValue: visibleValue,
overrideReason: overrideReason,
);
/// Returns a shallow copy of this [CrdtDataForeignKey]
/// with some or all fields replaced by the given arguments.
@_i3.useResult
@override
CrdtDataForeignKey copyWith({
Object? id = _Undefined,
Object? field = _Undefined,
int? fieldId,
Object? attemptedValue = _Undefined,
Object? visibleValue = _Undefined,
Object? overrideReason = _Undefined,
}) {
return CrdtDataForeignKey(
id: id is int? ? id : this.id,
field: field is _i2.CrdtDataField? ? field : this.field?.copyWith(),
fieldId: fieldId ?? this.fieldId,
attemptedValue: attemptedValue is _i3.UuidValue?
? attemptedValue
: this.attemptedValue,
visibleValue: visibleValue is _i3.UuidValue?
? visibleValue
: this.visibleValue,
overrideReason: overrideReason is _i4.CrdtForeignKeyOverrideReason?
? overrideReason
: this.overrideReason,
);
}
}
class CrdtDataForeignKeyUpdateTable
extends _i1.UpdateTable<CrdtDataForeignKeyTable> {
CrdtDataForeignKeyUpdateTable(super.table);
_i1.ColumnValue<int, int> fieldId(int value) => _i1.ColumnValue(
table.fieldId,
value,
);
_i1.ColumnValue<_i3.UuidValue, _i3.UuidValue> attemptedValue(
_i3.UuidValue? value,
) => _i1.ColumnValue(
table.attemptedValue,
value,
);
_i1.ColumnValue<_i3.UuidValue, _i3.UuidValue> visibleValue(
_i3.UuidValue? value,
) => _i1.ColumnValue(
table.visibleValue,
value,
);
_i1.ColumnValue<
_i4.CrdtForeignKeyOverrideReason,
_i4.CrdtForeignKeyOverrideReason
>
overrideReason(_i4.CrdtForeignKeyOverrideReason? value) => _i1.ColumnValue(
table.overrideReason,
value,
);
}
class CrdtDataForeignKeyTable extends _i1.Table<int?> {
CrdtDataForeignKeyTable({super.tableRelation})
: super(tableName: 'crdt_data_foreign_key') {
updateTable = CrdtDataForeignKeyUpdateTable(this);
fieldId = _i1.ColumnInt(
'fieldId',
this,
);
attemptedValue = _i1.ColumnUuid(
'attemptedValue',
this,
);
visibleValue = _i1.ColumnUuid(
'visibleValue',
this,
);
overrideReason = _i1.ColumnEnum(
'overrideReason',
this,
_i1.EnumSerialization.byIndex,
);
}
late final CrdtDataForeignKeyUpdateTable updateTable;
/// The field that the foreign key belongs to.
_i2.CrdtDataFieldTable? _field;
late final _i1.ColumnInt fieldId;
/// The user-attempted foreign key value that the CRDT field currently carries.
///
/// This may be null for nullable foreign keys. This is durable FK field-value
/// storage for CRDT columns whose CrdtDataField row stores only HLC metadata.
late final _i1.ColumnUuid attemptedValue;
/// The foreign key value that is currently visible in the actual data row
/// when an override is active (overrideReason is non-null).
late final _i1.ColumnUuid visibleValue;
/// The authoritative indicator and reason for an active projection override.
///
/// This is the single source of truth for whether an override is active:
/// non-null means an override is active; null means no override. It also
/// names the cause of the override. The FK resolver recomputes it from merged
/// row, field, and tombstone facts.
late final _i1.ColumnEnum<_i4.CrdtForeignKeyOverrideReason> overrideReason;
_i2.CrdtDataFieldTable get field {
if (_field != null) return _field!;
_field = _i1.createRelationTable(
relationFieldName: 'field',
field: CrdtDataForeignKey.t.fieldId,
foreignField: _i2.CrdtDataField.t.id,
tableRelation: tableRelation,
createTable: (foreignTableRelation) =>
_i2.CrdtDataFieldTable(tableRelation: foreignTableRelation),
);
return _field!;
}
@override
List<_i1.Column> get columns => [
id,
fieldId,
attemptedValue,
visibleValue,
overrideReason,
];
@override
_i1.Table? getRelationTable(String relationField) {
if (relationField == 'field') {
return field;
}
return null;
}
}
class CrdtDataForeignKeyInclude extends _i1.IncludeObject {
CrdtDataForeignKeyInclude._({_i2.CrdtDataFieldInclude? field}) {
_field = field;
}
_i2.CrdtDataFieldInclude? _field;
@override
Map<String, _i1.Include?> get includes => {'field': _field};
@override
_i1.Table<int?> get table => CrdtDataForeignKey.t;
}
class CrdtDataForeignKeyIncludeList extends _i1.IncludeList {
CrdtDataForeignKeyIncludeList._({
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? where,
super.limit,
super.offset,
super.orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
super.orderDescending,
super.orderByList,
super.include,
}) {
super.where = where?.call(CrdtDataForeignKey.t);
}
@override
Map<String, _i1.Include?> get includes => include?.includes ?? {};
@override
_i1.Table<int?> get table => CrdtDataForeignKey.t;
}
class CrdtDataForeignKeyRepository {
const CrdtDataForeignKeyRepository._();
final attachRow = const CrdtDataForeignKeyAttachRowRepository._();
/// Returns a list of [CrdtDataForeignKey]s matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order of the items use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// The maximum number of items can be set by [limit]. If no limit is set,
/// all items matching the query will be returned.
///
/// [offset] defines how many items to skip, after which [limit] (or all)
/// items are read from the database.
///
/// ```dart
/// var persons = await Persons.db.find(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.firstName,
/// limit: 100,
/// );
/// ```
Future<List<CrdtDataForeignKey>> find(
_i1.DatabaseSession session, {
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? where,
int? limit,
int? offset,
_i1.OrderByBuilder<CrdtDataForeignKeyTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i1.OrderByListBuilder<CrdtDataForeignKeyTable>? orderByList,
_i1.Transaction? transaction,
CrdtDataForeignKeyInclude? include,
_i1.LockMode? lockMode,
_i1.LockBehavior? lockBehavior,
}) async {
return session.db.find<CrdtDataForeignKey>(
where: where?.call(CrdtDataForeignKey.t),
orderBy: orderBy?.call(CrdtDataForeignKey.t),
orderByList: orderByList?.call(CrdtDataForeignKey.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
limit: limit,
offset: offset,
transaction: transaction,
include: include,
lockMode: lockMode,
lockBehavior: lockBehavior,
);
}
/// Returns the first matching [CrdtDataForeignKey] matching the given query parameters.
///
/// Use [where] to specify which items to include in the return value.
/// If none is specified, all items will be returned.
///
/// To specify the order use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// [offset] defines how many items to skip, after which the next one will be picked.
///
/// ```dart
/// var youngestPerson = await Persons.db.findFirstRow(
/// session,
/// where: (t) => t.lastName.equals('Jones'),
/// orderBy: (t) => t.age,
/// );
/// ```
Future<CrdtDataForeignKey?> findFirstRow(
_i1.DatabaseSession session, {
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? where,
int? offset,
_i1.OrderByBuilder<CrdtDataForeignKeyTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i1.OrderByListBuilder<CrdtDataForeignKeyTable>? orderByList,
_i1.Transaction? transaction,
CrdtDataForeignKeyInclude? include,
_i1.LockMode? lockMode,
_i1.LockBehavior? lockBehavior,
}) async {
return session.db.findFirstRow<CrdtDataForeignKey>(
where: where?.call(CrdtDataForeignKey.t),
orderBy: orderBy?.call(CrdtDataForeignKey.t),
orderByList: orderByList?.call(CrdtDataForeignKey.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
offset: offset,
transaction: transaction,
include: include,
lockMode: lockMode,
lockBehavior: lockBehavior,
);
}
/// Finds a single [CrdtDataForeignKey] by its [id] or null if no such row exists.
Future<CrdtDataForeignKey?> findById(
_i1.DatabaseSession session,
int id, {
_i1.Transaction? transaction,
CrdtDataForeignKeyInclude? include,
_i1.LockMode? lockMode,
_i1.LockBehavior? lockBehavior,
}) async {
return session.db.findById<CrdtDataForeignKey>(
id,
transaction: transaction,
include: include,
lockMode: lockMode,
lockBehavior: lockBehavior,
);
}
/// Inserts all [CrdtDataForeignKey]s in the list and returns the inserted rows.
///
/// The returned [CrdtDataForeignKey]s will have their `id` fields set.
///
/// This is an atomic operation, meaning that if one of the rows fails to
/// insert, none of the rows will be inserted.
///
/// If [ignoreConflicts] is set to `true`, rows that conflict with existing
/// rows are silently skipped, and only the successfully inserted rows are
/// returned.
///
/// If [noReturn] is set to `true`, the inserted rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataForeignKey>> insert(
_i1.DatabaseSession session,
List<CrdtDataForeignKey> rows, {
_i1.Transaction? transaction,
bool ignoreConflicts = false,
bool noReturn = false,
}) async {
return session.db.insert<CrdtDataForeignKey>(
rows,
transaction: transaction,
ignoreConflicts: ignoreConflicts,
noReturn: noReturn,
);
}
/// Inserts a single [CrdtDataForeignKey] and returns the inserted row.
///
/// The returned [CrdtDataForeignKey] will have its `id` field set.
Future<CrdtDataForeignKey> insertRow(
_i1.DatabaseSession session,
CrdtDataForeignKey row, {
_i1.Transaction? transaction,
}) async {
return session.db.insertRow<CrdtDataForeignKey>(
row,
transaction: transaction,
);
}
/// Upserts all [CrdtDataForeignKey]s in the list and returns the resulting rows.
///
/// If a row conflicts on the given [conflictColumns], the existing row is
/// updated with the new values. Otherwise, a new row is inserted.
///
/// If [updateColumns] is provided, only those columns will be updated on
/// conflict. If null, all non-conflict, non-id columns are updated.
///
/// If [updateWhere] is provided, the update only applies to rows matching the
/// given expression. Conflicting rows that don't match are skipped and not
/// returned, so the resulting list may be shorter than [rows].
///
/// The returned [CrdtDataForeignKey]s will have their `id` fields set.
///
/// This is an atomic operation, meaning that if one of the rows fails,
/// none of the rows will be affected.
///
/// If [noReturn] is set to `true`, the resulting rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataForeignKey>> upsert(
_i1.DatabaseSession session,
List<CrdtDataForeignKey> rows, {
required _i1.ColumnSelections<CrdtDataForeignKeyTable> conflictColumns,
_i1.ColumnSelections<CrdtDataForeignKeyTable>? updateColumns,
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? updateWhere,
_i1.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.upsert<CrdtDataForeignKey>(
rows,
conflictColumns: conflictColumns(CrdtDataForeignKey.t),
updateColumns: updateColumns?.call(CrdtDataForeignKey.t),
updateWhere: updateWhere?.call(CrdtDataForeignKey.t),
transaction: transaction,
noReturn: noReturn,
);
}
/// Upserts a single [CrdtDataForeignKey] and returns the resulting row.
///
/// If the row conflicts on the given [conflictColumns], the existing row is
/// updated. Otherwise, a new row is inserted.
///
/// If [updateColumns] is provided, only those columns will be updated on
/// conflict. If null, all non-conflict, non-id columns are updated.
///
/// If [updateWhere] is provided, the update only applies when the existing
/// row matches the expression. Returns `null` if no row was affected — for
/// example when [updateWhere] does not match the conflicting row.
///
/// The returned [CrdtDataForeignKey] will have its `id` field set.
Future<CrdtDataForeignKey?> upsertRow(
_i1.DatabaseSession session,
CrdtDataForeignKey row, {
required _i1.ColumnSelections<CrdtDataForeignKeyTable> conflictColumns,
_i1.ColumnSelections<CrdtDataForeignKeyTable>? updateColumns,
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? updateWhere,
_i1.Transaction? transaction,
}) async {
return session.db.upsertRow<CrdtDataForeignKey>(
row,
conflictColumns: conflictColumns(CrdtDataForeignKey.t),
updateColumns: updateColumns?.call(CrdtDataForeignKey.t),
updateWhere: updateWhere?.call(CrdtDataForeignKey.t),
transaction: transaction,
);
}
/// Updates all [CrdtDataForeignKey]s in the list and returns the updated rows. If
/// [columns] is provided, only those columns will be updated. Defaults to
/// all columns.
/// This is an atomic operation, meaning that if one of the rows fails to
/// update, none of the rows will be updated.
///
/// If [noReturn] is set to `true`, the updated rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataForeignKey>> update(
_i1.DatabaseSession session,
List<CrdtDataForeignKey> rows, {
_i1.ColumnSelections<CrdtDataForeignKeyTable>? columns,
_i1.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.update<CrdtDataForeignKey>(
rows,
columns: columns?.call(CrdtDataForeignKey.t),
transaction: transaction,
noReturn: noReturn,
);
}
/// Updates a single [CrdtDataForeignKey]. The row needs to have its id set.
/// Optionally, a list of [columns] can be provided to only update those
/// columns. Defaults to all columns.
Future<CrdtDataForeignKey> updateRow(
_i1.DatabaseSession session,
CrdtDataForeignKey row, {
_i1.ColumnSelections<CrdtDataForeignKeyTable>? columns,
_i1.Transaction? transaction,
}) async {
return session.db.updateRow<CrdtDataForeignKey>(
row,
columns: columns?.call(CrdtDataForeignKey.t),
transaction: transaction,
);
}
/// Updates a single [CrdtDataForeignKey] by its [id] with the specified [columnValues].
/// Returns the updated row or null if no row with the given id exists.
Future<CrdtDataForeignKey?> updateById(
_i1.DatabaseSession session,
int id, {
required _i1.ColumnValueListBuilder<CrdtDataForeignKeyUpdateTable>
columnValues,
_i1.Transaction? transaction,
}) async {
return session.db.updateById<CrdtDataForeignKey>(
id,
columnValues: columnValues(CrdtDataForeignKey.t.updateTable),
transaction: transaction,
);
}
/// Updates all [CrdtDataForeignKey]s matching the [where] expression with the specified [columnValues].
/// Returns the list of updated rows.
///
/// If [noReturn] is set to `true`, the updated rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataForeignKey>> updateWhere(
_i1.DatabaseSession session, {
required _i1.ColumnValueListBuilder<CrdtDataForeignKeyUpdateTable>
columnValues,
required _i1.WhereExpressionBuilder<CrdtDataForeignKeyTable> where,
int? limit,
int? offset,
_i1.OrderByBuilder<CrdtDataForeignKeyTable>? orderBy,
_i1.OrderByListBuilder<CrdtDataForeignKeyTable>? orderByList,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i1.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.updateWhere<CrdtDataForeignKey>(
columnValues: columnValues(CrdtDataForeignKey.t.updateTable),
where: where(CrdtDataForeignKey.t),
limit: limit,
offset: offset,
orderBy: orderBy?.call(CrdtDataForeignKey.t),
orderByList: orderByList?.call(CrdtDataForeignKey.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
transaction: transaction,
noReturn: noReturn,
);
}
/// Deletes all [CrdtDataForeignKey]s in the list and returns the deleted rows.
///
/// To specify the order of the returned rows use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// This is an atomic operation, meaning that if one of the rows fail to
/// be deleted, none of the rows will be deleted.
///
/// If [noReturn] is set to `true`, the deleted rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataForeignKey>> delete(
_i1.DatabaseSession session,
List<CrdtDataForeignKey> rows, {
_i1.OrderByBuilder<CrdtDataForeignKeyTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i1.OrderByListBuilder<CrdtDataForeignKeyTable>? orderByList,
_i1.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.delete<CrdtDataForeignKey>(
rows,
orderBy: orderBy?.call(CrdtDataForeignKey.t),
orderByList: orderByList?.call(CrdtDataForeignKey.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
transaction: transaction,
noReturn: noReturn,
);
}
/// Deletes a single [CrdtDataForeignKey].
Future<CrdtDataForeignKey> deleteRow(
_i1.DatabaseSession session,
CrdtDataForeignKey row, {
_i1.Transaction? transaction,
}) async {
return session.db.deleteRow<CrdtDataForeignKey>(
row,
transaction: transaction,
);
}
/// Deletes all rows matching the [where] expression.
///
/// To specify the order of the returned rows use [orderBy] or [orderByList]
/// when sorting by multiple columns.
///
/// If [noReturn] is set to `true`, the deleted rows are not read back from
/// the database and an empty list is returned. This avoids the overhead of
/// transferring and deserializing the rows when the result is not needed.
Future<List<CrdtDataForeignKey>> deleteWhere(
_i1.DatabaseSession session, {
required _i1.WhereExpressionBuilder<CrdtDataForeignKeyTable> where,
_i1.OrderByBuilder<CrdtDataForeignKeyTable>? orderBy,
@Deprecated('Use desc() on the orderBy column instead.')
bool orderDescending = false,
_i1.OrderByListBuilder<CrdtDataForeignKeyTable>? orderByList,
_i1.Transaction? transaction,
bool noReturn = false,
}) async {
return session.db.deleteWhere<CrdtDataForeignKey>(
where: where(CrdtDataForeignKey.t),
orderBy: orderBy?.call(CrdtDataForeignKey.t),
orderByList: orderByList?.call(CrdtDataForeignKey.t),
orderDescending: // ignore: deprecated_member_use
orderDescending,
transaction: transaction,
noReturn: noReturn,
);
}
/// Counts the number of rows matching the [where] expression. If omitted,
/// will return the count of all rows in the table.
Future<int> count(
_i1.DatabaseSession session, {
_i1.WhereExpressionBuilder<CrdtDataForeignKeyTable>? where,
int? limit,
_i1.Transaction? transaction,
}) async {
return session.db.count<CrdtDataForeignKey>(
where: where?.call(CrdtDataForeignKey.t),
limit: limit,
transaction: transaction,
);
}
/// Acquires row-level locks on [CrdtDataForeignKey] rows matching the [where] expression.
Future<void> lockRows(
_i1.DatabaseSession session, {
required _i1.WhereExpressionBuilder<CrdtDataForeignKeyTable> where,
required _i1.LockMode lockMode,
required _i1.Transaction transaction,
_i1.LockBehavior lockBehavior = _i1.LockBehavior.wait,
}) async {
return session.db.lockRows<CrdtDataForeignKey>(
where: where(CrdtDataForeignKey.t),
lockMode: lockMode,
lockBehavior: lockBehavior,
transaction: transaction,
);
}
}
class CrdtDataForeignKeyAttachRowRepository {
const CrdtDataForeignKeyAttachRowRepository._();
/// Creates a relation between the given [CrdtDataForeignKey] and [CrdtDataField]
/// by setting the [CrdtDataForeignKey]'s foreign key `fieldId` to refer to the [CrdtDataField].
Future<void> field(
_i1.DatabaseSession session,
CrdtDataForeignKey crdtDataForeignKey,
_i2.CrdtDataField field, {
_i1.Transaction? transaction,
}) async {
if (crdtDataForeignKey.id == null) {
throw ArgumentError.notNull('crdtDataForeignKey.id');
}
if (field.id == null) {
throw ArgumentError.notNull('field.id');
}
var $crdtDataForeignKey = crdtDataForeignKey.copyWith(fieldId: field.id);
await session.db.updateRow<CrdtDataForeignKey>(
$crdtDataForeignKey,
columns: [CrdtDataForeignKey.t.fieldId],
transaction: transaction,
);
}
}

View file

@ -0,0 +1,52 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_client/serverpod_client.dart' as _i1;
/// Why a foreign key projection override is active.
enum CrdtForeignKeyOverrideReason implements _i1.SerializableModel {
/// The attempted parent target is hidden or missing and the FK projection
/// set the column to null.
setNull,
/// The attempted parent target is hidden or missing and the FK projection
/// set the column to the default value.
setDefault,
/// The attempted parent target is hidden or missing and the FK projection
/// cannot repair the value (restrict, no action, cascade, or the column is
/// non-nullable), so the row is hidden by projection while the attempt is
/// preserved.
missingParent
;
static CrdtForeignKeyOverrideReason fromJson(int index) {
switch (index) {
case 0:
return CrdtForeignKeyOverrideReason.setNull;
case 1:
return CrdtForeignKeyOverrideReason.setDefault;
case 2:
return CrdtForeignKeyOverrideReason.missingParent;
default:
throw ArgumentError(
'Value "$index" cannot be converted to "CrdtForeignKeyOverrideReason"',
);
}
}
@override
int toJson() => index;
@override
String toString() => name;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:serverpod_client/serverpod_client.dart' as _i1;
/// Materialized visibility state for a CRDT row.
///
/// Visible states are listed first, hidden states last. A row is visible when
/// its serialized index is less than or equal to [foreignKeyRestrictRestore].
enum CrdtDataRowVisibility implements _i1.SerializableModel {
userInsert,
userReinsert,
foreignKeyRestrictRestore,
userDelete,
userCascadeDelete,
foreignKeyCascade
;
static CrdtDataRowVisibility fromJson(int index) {
switch (index) {
case 0:
return CrdtDataRowVisibility.userInsert;
case 1:
return CrdtDataRowVisibility.userReinsert;
case 2:
return CrdtDataRowVisibility.foreignKeyRestrictRestore;
case 3:
return CrdtDataRowVisibility.userDelete;
case 4:
return CrdtDataRowVisibility.userCascadeDelete;
case 5:
return CrdtDataRowVisibility.foreignKeyCascade;
default:
throw ArgumentError(
'Value "$index" cannot be converted to "CrdtDataRowVisibility"',
);
}
}
@override
int toJson() => index;
@override
String toString() => name;
}

View file

@ -0,0 +1,61 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
// ignore_for_file: no_leading_underscores_for_library_prefixes
import '../protocol.dart' as _i1;
import 'package:serverpod_client/serverpod_client.dart' as _i2;
import '../data/deleted_reason.dart' as _i3;
import 'package:serverpod_offline_sync_client/src/protocol/protocol.dart'
as _i4;
import 'package:serverpod_offline_sync_shared/serverpod_offline_sync_shared.dart'
as _i5;
part 'delete.dart';
part 'insert.dart';
part 'update.dart';
/// A remote CRDT change to merge.
sealed class CrdtMergeChange extends _i5.BaseHlc
implements _i2.SerializableModel {
CrdtMergeChange({
required super.hlcDatetime,
required super.hlcCounter,
required this.uuidScopeId,
required this.tableName,
required this.uuidRowId,
required this.uuidNodeId,
});
/// The scope this change belongs to.
_i2.UuidValue uuidScopeId;
/// The table receiving the change.
String tableName;
/// The domain row identifier receiving the change.
_i2.UuidValue uuidRowId;
/// The remote node that produced the change.
_i2.UuidValue uuidNodeId;
/// Returns a shallow copy of this [CrdtMergeChange]
/// with some or all fields replaced by the given arguments.
@_i2.useResult
CrdtMergeChange copyWith({
DateTime? hlcDatetime,
int? hlcCounter,
_i2.UuidValue? uuidScopeId,
String? tableName,
_i2.UuidValue? uuidRowId,
_i2.UuidValue? uuidNodeId,
});
}
class _Undefined {}

View file

@ -0,0 +1,149 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
part of 'change.dart';
/// A remote visibility CLFlag update to merge.
abstract class CrdtMergeDelete extends _i1.CrdtMergeChange
implements _i2.SerializableModel {
CrdtMergeDelete._({
required super.hlcDatetime,
required super.hlcCounter,
required super.uuidScopeId,
required super.tableName,
required super.uuidRowId,
required super.uuidNodeId,
required this.clFlag,
required this.reason,
});
factory CrdtMergeDelete({
required DateTime hlcDatetime,
required int hlcCounter,
required _i2.UuidValue uuidScopeId,
required String tableName,
required _i2.UuidValue uuidRowId,
required _i2.UuidValue uuidNodeId,
required int clFlag,
required _i3.CrdtDataDeletedReason reason,
}) = _CrdtMergeDeleteImpl;
factory CrdtMergeDelete.fromJson(Map<String, dynamic> jsonSerialization) {
return CrdtMergeDelete(
hlcDatetime: _i2.DateTimeJsonExtension.fromJson(
jsonSerialization['hlcDatetime'],
),
hlcCounter: jsonSerialization['hlcCounter'] as int,
uuidScopeId: _i2.UuidValueJsonExtension.fromJson(
jsonSerialization['uuidScopeId'],
),
tableName: jsonSerialization['tableName'] as String,
uuidRowId: _i2.UuidValueJsonExtension.fromJson(
jsonSerialization['uuidRowId'],
),
uuidNodeId: _i2.UuidValueJsonExtension.fromJson(
jsonSerialization['uuidNodeId'],
),
clFlag: jsonSerialization['clFlag'] as int,
reason: _i3.CrdtDataDeletedReason.fromJson(
(jsonSerialization['reason'] as int),
),
);
}
/// Monotone causal-length flag. Odd values are visible and even values are deleted.
int clFlag;
/// Why the row entered its current visibility generation.
_i3.CrdtDataDeletedReason reason;
/// Returns a shallow copy of this [CrdtMergeDelete]
/// with some or all fields replaced by the given arguments.
@override
@_i2.useResult
CrdtMergeDelete copyWith({
DateTime? hlcDatetime,
int? hlcCounter,
_i2.UuidValue? uuidScopeId,
String? tableName,
_i2.UuidValue? uuidRowId,
_i2.UuidValue? uuidNodeId,
int? clFlag,
_i3.CrdtDataDeletedReason? reason,
});
@override
Map<String, dynamic> toJson() {
return {
'__className__': 'serverpod_offline_sync.CrdtMergeDelete',
'hlcDatetime': hlcDatetime.toJson(),
'hlcCounter': hlcCounter,
'uuidScopeId': uuidScopeId.toJson(),
'tableName': tableName,
'uuidRowId': uuidRowId.toJson(),
'uuidNodeId': uuidNodeId.toJson(),
'clFlag': clFlag,
'reason': reason.toJson(),
};
}
@override
String toString() {
return _i2.SerializationManager.encode(this);
}
}
class _CrdtMergeDeleteImpl extends CrdtMergeDelete {
_CrdtMergeDeleteImpl({
required DateTime hlcDatetime,
required int hlcCounter,
required _i2.UuidValue uuidScopeId,
required String tableName,
required _i2.UuidValue uuidRowId,
required _i2.UuidValue uuidNodeId,
required int clFlag,
required _i3.CrdtDataDeletedReason reason,
}) : super._(
hlcDatetime: hlcDatetime,
hlcCounter: hlcCounter,
uuidScopeId: uuidScopeId,
tableName: tableName,
uuidRowId: uuidRowId,
uuidNodeId: uuidNodeId,
clFlag: clFlag,
reason: reason,
);
/// Returns a shallow copy of this [CrdtMergeDelete]
/// with some or all fields replaced by the given arguments.
@_i2.useResult
@override
CrdtMergeDelete copyWith({
DateTime? hlcDatetime,
int? hlcCounter,
_i2.UuidValue? uuidScopeId,
String? tableName,
_i2.UuidValue? uuidRowId,
_i2.UuidValue? uuidNodeId,
int? clFlag,
_i3.CrdtDataDeletedReason? reason,
}) {
return CrdtMergeDelete(
hlcDatetime: hlcDatetime ?? this.hlcDatetime,
hlcCounter: hlcCounter ?? this.hlcCounter,
uuidScopeId: uuidScopeId ?? this.uuidScopeId,
tableName: tableName ?? this.tableName,
uuidRowId: uuidRowId ?? this.uuidRowId,
uuidNodeId: uuidNodeId ?? this.uuidNodeId,
clFlag: clFlag ?? this.clFlag,
reason: reason ?? this.reason,
);
}
}

View file

@ -0,0 +1,137 @@
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
/* To generate run: "serverpod generate" */
// ignore_for_file: implementation_imports
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: public_member_api_docs
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: use_super_parameters
// ignore_for_file: invalid_use_of_internal_member
part of 'change.dart';
/// A remote row insertion to merge.
abstract class CrdtMergeInsert extends _i1.CrdtMergeChange
implements _i2.SerializableModel {
CrdtMergeInsert._({
required super.hlcDatetime,
required super.hlcCounter,
required super.uuidScopeId,
required super.tableName,
required super.uuidRowId,
required super.uuidNodeId,
required this.data,
});
factory CrdtMergeInsert({
required DateTime hlcDatetime,
required int hlcCounter,
required _i2.UuidValue uuidScopeId,
required String tableName,
required _i2.UuidValue uuidRowId,
required _i2.UuidValue uuidNodeId,
required dynamic data,
}) = _CrdtMergeInsertImpl;
factory CrdtMergeInsert.fromJson(Map<String, dynamic> jsonSerialization) {
return CrdtMergeInsert(
hlcDatetime: _i2.DateTimeJsonExtension.fromJson(
jsonSerialization['hlcDatetime'],
),
hlcCounter: jsonSerialization['hlcCounter'] as int,
uuidScopeId: _i2.UuidValueJsonExtension.fromJson(
jsonSerialization['uuidScopeId'],
),
tableName: jsonSerialization['tableName'] as String,
uuidRowId: _i2.UuidValueJsonExtension.fromJson(
jsonSerialization['uuidRowId'],
),
uuidNodeId: _i2.UuidValueJsonExtension.fromJson(
jsonSerialization['uuidNodeId'],
),
data: _i4.Protocol().deserializeDynamicFieldValue(
jsonSerialization['data'],
),
);
}
/// The serialized domain row payload for the insert.
dynamic data;
/// Returns a shallow copy of this [CrdtMergeInsert]
/// with some or all fields replaced by the given arguments.
@override
@_i2.useResult
CrdtMergeInsert copyWith({
DateTime? hlcDatetime,
int? hlcCounter,
_i2.UuidValue? uuidScopeId,
String? tableName,
_i2.UuidValue? uuidRowId,
_i2.UuidValue? uuidNodeId,
dynamic data,
});
@override
Map<String, dynamic> toJson() {
return {
'__className__': 'serverpod_offline_sync.CrdtMergeInsert',
'hlcDatetime': hlcDatetime.toJson(),
'hlcCounter': hlcCounter,
'uuidScopeId': uuidScopeId.toJson(),
'tableName': tableName,
'uuidRowId': uuidRowId.toJson(),
'uuidNodeId': uuidNodeId.toJson(),
'data': _i4.Protocol().dynamicFieldToJson(data),
};
}
@override
String toString() {
return _i2.SerializationManager.encode(this);
}
}
class _CrdtMergeInsertImpl extends CrdtMergeInsert {
_CrdtMergeInsertImpl({
required DateTime hlcDatetime,
required int hlcCounter,
required _i2.UuidValue uuidScopeId,
required String tableName,
required _i2.UuidValue uuidRowId,
required _i2.UuidValue uuidNodeId,
required dynamic data,
}) : super._(
hlcDatetime: hlcDatetime,
hlcCounter: hlcCounter,
uuidScopeId: uuidScopeId,
tableName: tableName,
uuidRowId: uuidRowId,
uuidNodeId: uuidNodeId,
data: data,
);
/// Returns a shallow copy of this [CrdtMergeInsert]
/// with some or all fields replaced by the given arguments.
@_i2.useResult
@override
CrdtMergeInsert copyWith({
DateTime? hlcDatetime,
int? hlcCounter,
_i2.UuidValue? uuidScopeId,
String? tableName,
_i2.UuidValue? uuidRowId,
_i2.UuidValue? uuidNodeId,
Object? data = _Undefined,
}) {
return CrdtMergeInsert(
hlcDatetime: hlcDatetime ?? this.hlcDatetime,
hlcCounter: hlcCounter ?? this.hlcCounter,
uuidScopeId: uuidScopeId ?? this.uuidScopeId,
tableName: tableName ?? this.tableName,
uuidRowId: uuidRowId ?? this.uuidRowId,
uuidNodeId: uuidNodeId ?? this.uuidNodeId,
data: data != _Undefined ? data : this.data,
);
}
}

Some files were not shown because too many files have changed in this diff Show more