halkyon/apps/train/halkyon_train_client/lib/migrations/20261103204323683-body-weights/migration.dart

1830 lines
79 KiB
Dart
Raw Normal View History

feat(train): weight, entered on Progress and read from Health Connect, sealed and synced (ADR 0030, D63) A person's weights are each a sealed `body_weight` row, as the days and the places: the weight in grams, when it was measured (UTC), where it came from and, for Health Connect's, the record's id and app are the payload; the server sees the space and the ciphertext alone. Progress gets a Weight card after Your body: the latest and its day, its line over time (held, each weight and its day), the plus to enter one (a comma taken as a point, 20 to 400 kg, when measured, today by default) and All, the list to delete one. The latest weight is also Your body's, which the band's and the zones' figures work from. In kilograms alone: Train is metric throughout and has no units setting yet. Health Connect's weight records are read in when switched on in its screen (READ_WEIGHT, asked as the others): each record once, its id kept in health_connect.json also after it is deleted here, never Train's own, and none within 10 minutes and 0.1 kg of a weight entered in Train. The migration (20261103204323683-body-weights): - creates (or replaces, unchanged) `gen_random_uuid_v7()`, the default of every UUID id, as each of Serverpod's migrations does; - CREATE TABLE "body_weight": "id" uuid primary key defaulting to a UUID v7, "spaceId" bigint (the sync space), "keyId" text (the key that sealed it), "payload" bytea NOT NULL (the sealed content), "nonce" bytea; - CREATE INDEX "body_weight_space_idx" on "spaceId", for a space's rows as the sync reads them; - a foreign key from "spaceId" to "offline_sync_spaces"("id"), ON DELETE CASCADE, so that an account's deletion takes its weights with its space; - the version rows of Train's and every module's migrations. Nothing existing changes, so nothing is lost. Tests: the row written and read back in its owner's space, and the denials: another person reads none of them, and writing one into another's space throws OfflineSyncSpaceMembershipException and leaves it empty; an account's deletion takes them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-03 22:11:57 +01:00
/// 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 _Migration20261103204323683_body_weights implements MigrationVersionSql {
@override
String get version => '20261103204323683-body-weights';
@override
String get moduleName => 'halkyon_train';
@override
String get migrationSql => '''BEGIN;
--
-- ACTION CREATE TABLE
--
CREATE TABLE "body_weight" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "body_weight_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "body_weight_space_idx" ON "body_weight" ("spaceId");
--
-- 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
('body_weight', 'id', 'uuid', NULL),
('content_key', 'id', 'uuid', NULL),
('day', 'id', 'uuid', NULL),
('day_series', 'id', 'uuid', NULL),
('day_series', 'dayId', 'uuid', NULL),
('night', 'id', 'uuid', NULL),
('plan', 'id', 'uuid', NULL),
('profile', 'id', 'uuid', NULL),
('route', 'id', 'uuid', NULL),
('strength_plan', 'id', 'uuid', NULL),
('training_place', 'id', 'uuid', NULL),
('workout', 'id', 'uuid', NULL),
('workout_series', 'id', 'uuid', NULL),
('workout_series', 'workoutId', 'uuid', NULL),
('account_deletion_notice', 'account', 'uuid', NULL),
('account_deletion_notice', 'createdAt', 'timestampWithoutTimeZone', NULL),
('account_deletion_notice', 'lastAttemptAt', 'timestampWithoutTimeZone', NULL),
('account_password', 'authUserId', 'uuid', NULL),
('account_password', 'sessionEndedForProofsAt', 'timestampWithoutTimeZone', NULL),
('account_password', 'createdAt', 'timestampWithoutTimeZone', NULL),
('account_password', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('account_reset', 'authUserId', 'uuid', NULL),
('account_reset', 'takesEffectAt', 'timestampWithoutTimeZone', NULL),
('account_reset', 'heldOutUntil', 'timestampWithoutTimeZone', NULL),
('account_reset', 'createdAt', 'timestampWithoutTimeZone', NULL),
('assistant_budget', 'authUserId', 'uuid', NULL),
('assistant_figures', 'authUserId', 'uuid', NULL),
('assistant_figures', 'day', 'timestampWithoutTimeZone', NULL),
('assistant_grant', 'authUserId', 'uuid', NULL),
('assistant_grant', 'grantedAt', 'timestampWithoutTimeZone', NULL),
('assistant_grant', 'agreedAt', 'timestampWithoutTimeZone', NULL),
('email_code_request', 'id', 'uuid', NULL),
('email_code_request', 'challengeId', 'uuid', NULL),
('email_code_request', 'switchChallengeId', 'uuid', NULL),
('email_code_request', 'createdAt', 'timestampWithoutTimeZone', NULL),
('email_identity', 'authUserId', 'uuid', NULL),
('email_identity', 'createdAt', 'timestampWithoutTimeZone', NULL),
('public_profile', 'authUserId', 'uuid', NULL),
('public_profile', 'links', 'json', NULL),
('public_profile', 'verifiedLinks', 'json', NULL),
('public_profile', 'firstPublishedAt', 'timestampWithoutTimeZone', NULL),
('public_profile', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('recovery_code', 'authUserId', 'uuid', NULL),
('second_factor_failures', 'authUserId', 'uuid', NULL),
('second_factor_failures', 'waitUntil', 'timestampWithoutTimeZone', NULL),
('second_factor_failures', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('session_code_failures', 'sessionId', 'uuid', NULL),
('session_code_failures', 'authUserId', 'uuid', NULL),
('session_code_failures', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('sessions_ended_notice', 'account', 'uuid', NULL),
('sessions_ended_notice', 'endedBefore', 'timestampWithoutTimeZone', NULL),
('sessions_ended_notice', 'keepSession', 'uuid', NULL),
('sessions_ended_notice', 'lastAttemptAt', 'timestampWithoutTimeZone', NULL),
('sign_in_challenge', 'id', 'uuid', NULL),
('sign_in_challenge', 'authUserId', 'uuid', NULL),
('sign_in_challenge', 'createdAt', 'timestampWithoutTimeZone', NULL),
('totp_authenticator', 'id', 'uuid', NULL),
('totp_authenticator', 'authUserId', 'uuid', NULL),
('totp_authenticator', 'confirmedAt', 'timestampWithoutTimeZone', NULL),
('totp_authenticator', 'createdAt', 'timestampWithoutTimeZone', NULL),
('waiting_account', 'authUserId', 'uuid', NULL),
('waiting_account', 'since', 'timestampWithoutTimeZone', NULL),
('waiting_account', 'suspendedAt', 'timestampWithoutTimeZone', NULL),
('waiting_pass', 'authUserId', 'uuid', NULL),
('waiting_pass', 'madeAt', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL),
('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL),
('serverpod_future_call', 'scheduling', 'json', NULL),
('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL),
('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL),
('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL),
('serverpod_health_metric', 'isHealthy', 'boolean', NULL),
('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL),
('serverpod_message_log', 'slow', 'boolean', NULL),
('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL),
('serverpod_query_log', 'slow', 'boolean', NULL),
('serverpod_runtime_settings', 'logSettings', 'json', NULL),
('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL),
('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL),
('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL),
('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL),
('serverpod_session_log', 'slow', 'boolean', NULL),
('serverpod_session_log', 'isOpen', 'boolean', NULL),
('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_anonymous_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_anonymous_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_anonymous_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_apple_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_apple_account', 'refreshTokenRequestedWithBundleIdentifier', 'boolean', NULL),
('serverpod_auth_idp_apple_account', 'lastRefreshedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_apple_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_apple_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_apple_account', 'isEmailVerified', 'boolean', NULL),
('serverpod_auth_idp_apple_account', 'isPrivateEmail', 'boolean', NULL),
('serverpod_auth_idp_email_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_email_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_email_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'id', 'uuid', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'emailAccountId', 'uuid', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'challengeId', 'uuid', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'setPasswordChallengeId', 'uuid', NULL),
('serverpod_auth_idp_email_account_request', 'id', 'uuid', NULL),
('serverpod_auth_idp_email_account_request', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_email_account_request', 'challengeId', 'uuid', NULL),
('serverpod_auth_idp_email_account_request', 'createAccountChallengeId', 'uuid', NULL),
('serverpod_auth_idp_facebook_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_facebook_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_facebook_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_firebase_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_firebase_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_firebase_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_github_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_github_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_github_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_google_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_google_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_google_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_microsoft_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_microsoft_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_microsoft_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_passkey_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_passkey_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_passkey_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_passkey_challenge', 'id', 'uuid', NULL),
('serverpod_auth_idp_passkey_challenge', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_rate_limited_request_attempt', 'id', 'uuid', NULL),
('serverpod_auth_idp_rate_limited_request_attempt', 'attemptedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_rate_limited_request_attempt', 'extraData', 'json', NULL),
('serverpod_auth_idp_secret_challenge', 'id', 'uuid', NULL),
('crdt_data_attempted_value', 'value', 'jsonb', NULL),
('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_data_rows', 'uuidRowId', 'uuid', NULL),
('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_nodes', 'uuidNodeId', 'uuid', NULL),
('crdt_nodes', 'lastHlc', 'jsonb', NULL),
('crdt_schema_columns', 'isNullable', 'boolean', NULL),
('offline_sync_integrity_violations', 'uuidRowId', 'uuid', NULL),
('offline_sync_integrity_violations', 'ownerSpaceUuid', 'uuid', NULL),
('offline_sync_integrity_violations', 'incomingSpaceUuid', 'uuid', NULL),
('offline_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL),
('offline_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('offline_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL),
('offline_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL),
('offline_sync_space_members', 'userUuid', 'uuid', NULL),
('offline_sync_space_nodes', 'lastReceivedHlc', 'jsonb', NULL),
('offline_sync_spaces', 'uuidSpaceId', 'uuid', NULL),
('halkyon_oidc_attempt', 'id', 'uuid', NULL),
('halkyon_oidc_attempt', 'callerId', 'uuid', NULL),
('halkyon_oidc_attempt', 'expiresAt', 'timestampWithoutTimeZone', NULL),
('halkyon_oidc_identity', 'id', 'uuid', NULL),
('halkyon_oidc_identity', 'authUserId', 'uuid', NULL),
('halkyon_oidc_identity', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL),
('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL),
('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL),
('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_profile', 'id', 'uuid', NULL),
('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL),
('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_profile', 'imageId', 'uuid', NULL),
('serverpod_auth_core_profile_image', 'id', 'uuid', NULL),
('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL),
('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_session', 'id', 'uuid', NULL),
('serverpod_auth_core_session', 'authUserId', 'uuid', NULL),
('serverpod_auth_core_session', 'scopeNames', 'json', NULL),
('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_user', 'id', 'uuid', NULL),
('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_user', 'scopeNames', 'json', NULL),
('serverpod_auth_core_user', 'blocked', 'boolean', NULL);
--
-- MIGRATION VERSION FOR halkyon_train
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('halkyon_train', '20261103204323683-body-weights', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20261103204323683-body-weights', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR halkyon_base
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('halkyon_base', '20261026140329453-assistant-budgets', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20261026140329453-assistant-budgets', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod', '20260824182259319', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260824182259319', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod_auth_idp
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_auth_idp', '20260924105404509', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260924105404509', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod_offline_sync
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_offline_sync', '20260914143806119', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260914143806119', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR halkyon_oidc
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('halkyon_oidc', '20261023180644988', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20261023180644988', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod_auth_core
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_auth_core', '20260924105232991', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260924105232991', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
COMMIT;
''';
@override
String get definitionSql => '''BEGIN;
--
-- Class BodyWeight as table body_weight
--
CREATE TABLE "body_weight" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "body_weight_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "body_weight_space_idx" ON "body_weight" ("spaceId");
--
-- Class ContentKey as table content_key
--
CREATE TABLE "content_key" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"dataKeyId" TEXT NOT NULL,
"sealedKey" BLOB NOT NULL,
CONSTRAINT "content_key_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "content_key_space_idx" ON "content_key" ("spaceId");
--
-- Class Day as table day
--
CREATE TABLE "day" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "day_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "day_space_idx" ON "day" ("spaceId");
--
-- Class DaySeries as table day_series
--
CREATE TABLE "day_series" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"dayId" BLOB NOT NULL,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "day_series_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "day_series_fk_1" FOREIGN KEY ("dayId") REFERENCES "day" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
) STRICT;
-- Indexes
CREATE INDEX "day_series_space_idx" ON "day_series" ("spaceId");
CREATE INDEX "day_series_day_idx" ON "day_series" ("dayId");
--
-- Class Night as table night
--
CREATE TABLE "night" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "night_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "night_space_idx" ON "night" ("spaceId");
--
-- Class Plan as table plan
--
CREATE TABLE "plan" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "plan_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "plan_space_idx" ON "plan" ("spaceId");
--
-- Class Profile as table profile
--
CREATE TABLE "profile" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "profile_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "profile_space_idx" ON "profile" ("spaceId");
--
-- Class SavedRoute as table route
--
CREATE TABLE "route" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "route_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "route_space_idx" ON "route" ("spaceId");
--
-- Class StrengthPlan as table strength_plan
--
CREATE TABLE "strength_plan" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "strength_plan_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "strength_plan_space_idx" ON "strength_plan" ("spaceId");
--
-- Class TrainingPlace as table training_place
--
CREATE TABLE "training_place" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "training_place_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "training_place_space_idx" ON "training_place" ("spaceId");
--
-- Class Workout as table workout
--
CREATE TABLE "workout" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "workout_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "workout_space_idx" ON "workout" ("spaceId");
--
-- Class WorkoutSeries as table workout_series
--
CREATE TABLE "workout_series" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"spaceId" INTEGER,
"workoutId" BLOB NOT NULL,
"keyId" TEXT,
"payload" BLOB NOT NULL,
"nonce" BLOB,
CONSTRAINT "workout_series_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "workout_series_fk_1" FOREIGN KEY ("workoutId") REFERENCES "workout" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
) STRICT;
-- Indexes
CREATE INDEX "workout_series_space_idx" ON "workout_series" ("spaceId");
CREATE INDEX "workout_series_workout_idx" ON "workout_series" ("workoutId");
--
-- Class AccountDeletionNotice as table account_deletion_notice
--
CREATE TABLE "account_deletion_notice" (
"id" INTEGER PRIMARY KEY,
"account" BLOB NOT NULL,
"member" TEXT NOT NULL,
"createdAt" INTEGER NOT NULL,
"attempts" INTEGER NOT NULL,
"lastAttemptAt" INTEGER
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "account_deletion_notice_idx" ON "account_deletion_notice" ("account", "member");
--
-- Class AccountPassword as table account_password
--
CREATE TABLE "account_password" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"salt" BLOB NOT NULL,
"kdfAlgorithm" TEXT NOT NULL,
"kdfOpsLimit" INTEGER NOT NULL,
"kdfMemLimit" INTEGER NOT NULL,
"verifier" BLOB,
"passwordProofKey" BLOB,
"encryptionPublicKey" BLOB NOT NULL,
"signingPublicKey" BLOB NOT NULL,
"passwordKeysNonce" BLOB NOT NULL,
"passwordKeysCipherText" BLOB NOT NULL,
"recoveryKeysNonce" BLOB NOT NULL,
"recoveryKeysCipherText" BLOB NOT NULL,
"recoveryProofKey" BLOB,
"sessionEndedForProofsAt" INTEGER,
"createdAt" INTEGER NOT NULL,
"updatedAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "account_password_person_idx" ON "account_password" ("authUserId");
--
-- Class AccountReset as table account_reset
--
CREATE TABLE "account_reset" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"kind" TEXT NOT NULL,
"takesEffectAt" INTEGER NOT NULL,
"heldOutUntil" INTEGER,
"createdAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "account_reset_person_kind_idx" ON "account_reset" ("authUserId", "kind");
--
-- Class AssistantBudget as table assistant_budget
--
CREATE TABLE "assistant_budget" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"dailyCostMicros" INTEGER,
"monthlyCostMicros" INTEGER,
"dailyTokens" INTEGER,
"monthlyTokens" INTEGER
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "assistant_budget_person_idx" ON "assistant_budget" ("authUserId");
--
-- Class AssistantFigures as table assistant_figures
--
CREATE TABLE "assistant_figures" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"assistant" TEXT NOT NULL,
"day" INTEGER NOT NULL,
"requests" INTEGER NOT NULL,
"inputTokens" INTEGER NOT NULL,
"outputTokens" INTEGER NOT NULL,
"costMicros" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "assistant_figures_day_idx" ON "assistant_figures" ("authUserId", "assistant", "day");
CREATE INDEX "assistant_figures_age_idx" ON "assistant_figures" ("day");
--
-- Class AssistantGrant as table assistant_grant
--
CREATE TABLE "assistant_grant" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"assistant" TEXT NOT NULL,
"grantedAt" INTEGER NOT NULL,
"agreedAt" INTEGER,
"agreedTo" TEXT
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "assistant_grant_person_idx" ON "assistant_grant" ("authUserId", "assistant");
--
-- Class EmailCodeRequest as table email_code_request
--
CREATE TABLE "email_code_request" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"addressHash" TEXT NOT NULL,
"challengeId" BLOB NOT NULL,
"switchChallengeId" BLOB,
"purpose" TEXT,
"createdAt" INTEGER NOT NULL,
CONSTRAINT "email_code_request_fk_0" FOREIGN KEY ("challengeId") REFERENCES "serverpod_auth_idp_secret_challenge" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "email_code_request_fk_1" FOREIGN KEY ("switchChallengeId") REFERENCES "serverpod_auth_idp_secret_challenge" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "email_code_request_address_idx" ON "email_code_request" ("addressHash");
--
-- Class EmailIdentity as table email_identity
--
CREATE TABLE "email_identity" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"addressHash" TEXT NOT NULL,
"createdAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "email_identity_person_idx" ON "email_identity" ("authUserId");
CREATE UNIQUE INDEX "email_identity_address_idx" ON "email_identity" ("addressHash");
--
-- Class PublicProfile as table public_profile
--
CREATE TABLE "public_profile" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"handle" TEXT NOT NULL,
"handleKey" TEXT NOT NULL,
"displayName" TEXT NOT NULL,
"bio" TEXT NOT NULL,
"links" TEXT NOT NULL,
"verifiedLinks" TEXT,
"avatarHash" TEXT,
"firstPublishedAt" INTEGER,
"updatedAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "public_profile_person_idx" ON "public_profile" ("authUserId");
CREATE UNIQUE INDEX "public_profile_handle_idx" ON "public_profile" ("handleKey");
--
-- Class RecoveryCode as table recovery_code
--
CREATE TABLE "recovery_code" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"hash" TEXT NOT NULL
) STRICT;
-- Indexes
CREATE INDEX "recovery_code_person_idx" ON "recovery_code" ("authUserId");
--
-- Class SecondFactorFailures as table second_factor_failures
--
CREATE TABLE "second_factor_failures" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"path" TEXT NOT NULL DEFAULT ('password'),
"failures" INTEGER NOT NULL,
"waits" INTEGER NOT NULL,
"waitUntil" INTEGER,
"updatedAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "second_factor_failures_person_idx" ON "second_factor_failures" ("authUserId", "path");
--
-- Class SessionCodeFailures as table session_code_failures
--
CREATE TABLE "session_code_failures" (
"id" INTEGER PRIMARY KEY,
"sessionId" BLOB NOT NULL,
"authUserId" BLOB NOT NULL,
"failures" INTEGER NOT NULL,
"updatedAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "session_code_failures_session_idx" ON "session_code_failures" ("sessionId");
--
-- Class SessionsEndedNotice as table sessions_ended_notice
--
CREATE TABLE "sessions_ended_notice" (
"id" INTEGER PRIMARY KEY,
"account" BLOB NOT NULL,
"member" TEXT NOT NULL,
"endedBefore" INTEGER NOT NULL,
"keepSession" BLOB,
"attempts" INTEGER NOT NULL,
"lastAttemptAt" INTEGER
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "sessions_ended_notice_idx" ON "sessions_ended_notice" ("account", "member");
--
-- Class SignInChallenge as table sign_in_challenge
--
CREATE TABLE "sign_in_challenge" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB,
"purpose" TEXT NOT NULL,
"addressHash" TEXT NOT NULL,
"secret" TEXT NOT NULL,
"serverValue" TEXT,
"createdAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE INDEX "sign_in_challenge_created_idx" ON "sign_in_challenge" ("createdAt");
--
-- Class TotpAuthenticator as table totp_authenticator
--
CREATE TABLE "totp_authenticator" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"name" TEXT NOT NULL,
"secret" BLOB NOT NULL,
"confirmedAt" INTEGER,
"lastStep" INTEGER,
"createdAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE INDEX "totp_authenticator_person_idx" ON "totp_authenticator" ("authUserId");
--
-- Class WaitingAccount as table waiting_account
--
CREATE TABLE "waiting_account" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"since" INTEGER NOT NULL,
"words" TEXT NOT NULL,
"suspendedAt" INTEGER
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "waiting_account_person_idx" ON "waiting_account" ("authUserId");
--
-- Class WaitingPass as table waiting_pass
--
CREATE TABLE "waiting_pass" (
"id" INTEGER PRIMARY KEY,
"authUserId" BLOB NOT NULL,
"passHash" TEXT NOT NULL,
"madeAt" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "waiting_pass_hash_idx" ON "waiting_pass" ("passHash");
CREATE INDEX "waiting_pass_person_idx" ON "waiting_pass" ("authUserId");
--
-- Class CloudStorageEntry as table serverpod_cloud_storage
--
CREATE TABLE "serverpod_cloud_storage" (
"id" INTEGER PRIMARY KEY,
"storageId" TEXT NOT NULL,
"path" TEXT NOT NULL,
"addedTime" INTEGER NOT NULL,
"expiration" INTEGER,
"byteData" BLOB NOT NULL,
"verified" INTEGER NOT NULL,
"contentType" TEXT,
"cacheControl" TEXT,
"contentDisposition" TEXT,
"contentEncoding" TEXT,
"customMetadata" TEXT
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_cloud_storage_path_idx" ON "serverpod_cloud_storage" ("storageId", "path");
CREATE INDEX "serverpod_cloud_storage_expiration" ON "serverpod_cloud_storage" ("expiration");
--
-- Class CloudStorageDirectDownloadEntry as table serverpod_cloud_storage_direct_download
--
CREATE TABLE "serverpod_cloud_storage_direct_download" (
"id" INTEGER PRIMARY KEY,
"storageId" TEXT NOT NULL,
"path" TEXT NOT NULL,
"expiration" INTEGER NOT NULL,
"authKey" TEXT NOT NULL,
"downloadFileName" TEXT,
"contentType" TEXT
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_download_auth_key" ON "serverpod_cloud_storage_direct_download" ("authKey");
CREATE INDEX "serverpod_cloud_storage_direct_download_expiration" ON "serverpod_cloud_storage_direct_download" ("expiration");
--
-- Class CloudStorageDirectUploadEntry as table serverpod_cloud_storage_direct_upload
--
CREATE TABLE "serverpod_cloud_storage_direct_upload" (
"id" INTEGER PRIMARY KEY,
"storageId" TEXT NOT NULL,
"path" TEXT NOT NULL,
"expiration" INTEGER NOT NULL,
"authKey" TEXT NOT NULL,
"maxFileSize" INTEGER NOT NULL DEFAULT (10485760),
"contentLength" INTEGER,
"preventOverwrite" INTEGER NOT NULL DEFAULT (0),
"contentType" TEXT,
"cacheControl" TEXT,
"contentDisposition" TEXT,
"contentEncoding" TEXT,
"customMetadata" TEXT
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" ("storageId", "path");
--
-- Class FutureCallEntry as table serverpod_future_call
--
CREATE TABLE "serverpod_future_call" (
"id" INTEGER PRIMARY KEY,
"name" TEXT NOT NULL,
"time" INTEGER NOT NULL,
"serializedObject" TEXT,
"serverId" TEXT NOT NULL,
"identifier" TEXT,
"scheduling" TEXT
) STRICT;
-- Indexes
CREATE INDEX "serverpod_future_call_time_idx" ON "serverpod_future_call" ("time");
CREATE INDEX "serverpod_future_call_serverId_idx" ON "serverpod_future_call" ("serverId");
CREATE INDEX "serverpod_future_call_identifier_idx" ON "serverpod_future_call" ("identifier");
--
-- Class FutureCallClaimEntry as table serverpod_future_call_claim
--
CREATE TABLE "serverpod_future_call_claim" (
"id" INTEGER PRIMARY KEY,
"futureCallId" INTEGER,
"lastHeartbeatTime" INTEGER NOT NULL,
CONSTRAINT "serverpod_future_call_claim_fk_0" FOREIGN KEY ("futureCallId") REFERENCES "serverpod_future_call" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "future_call_unique_idx" ON "serverpod_future_call_claim" ("futureCallId");
--
-- Class ServerHealthConnectionInfo as table serverpod_health_connection_info
--
CREATE TABLE "serverpod_health_connection_info" (
"id" INTEGER PRIMARY KEY,
"serverId" TEXT NOT NULL,
"timestamp" INTEGER NOT NULL,
"active" INTEGER NOT NULL,
"closing" INTEGER NOT NULL,
"idle" INTEGER NOT NULL,
"granularity" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_health_connection_info_timestamp_idx" ON "serverpod_health_connection_info" ("timestamp", "serverId", "granularity");
--
-- Class ServerHealthMetric as table serverpod_health_metric
--
CREATE TABLE "serverpod_health_metric" (
"id" INTEGER PRIMARY KEY,
"name" TEXT NOT NULL,
"serverId" TEXT NOT NULL,
"timestamp" INTEGER NOT NULL,
"isHealthy" INTEGER NOT NULL,
"value" REAL NOT NULL,
"granularity" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_health_metric_timestamp_idx" ON "serverpod_health_metric" ("timestamp", "serverId", "name", "granularity");
--
-- Class LogEntry as table serverpod_log
--
CREATE TABLE "serverpod_log" (
"id" INTEGER PRIMARY KEY,
"sessionLogId" INTEGER NOT NULL,
"messageId" INTEGER,
"reference" TEXT,
"serverId" TEXT NOT NULL,
"time" INTEGER NOT NULL,
"logLevel" INTEGER NOT NULL,
"message" TEXT NOT NULL,
"error" TEXT,
"stackTrace" TEXT,
"order" INTEGER NOT NULL,
CONSTRAINT "serverpod_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "serverpod_log_sessionLogId_idx" ON "serverpod_log" ("sessionLogId", "order");
--
-- Class MessageLogEntry as table serverpod_message_log
--
CREATE TABLE "serverpod_message_log" (
"id" INTEGER PRIMARY KEY,
"sessionLogId" INTEGER NOT NULL,
"serverId" TEXT NOT NULL,
"messageId" INTEGER NOT NULL,
"endpoint" TEXT NOT NULL,
"messageName" TEXT NOT NULL,
"duration" REAL NOT NULL,
"error" TEXT,
"stackTrace" TEXT,
"slow" INTEGER NOT NULL,
"order" INTEGER NOT NULL,
CONSTRAINT "serverpod_message_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "serverpod_message_log_sessionLogId_idx" ON "serverpod_message_log" ("sessionLogId", "order");
--
-- Class MethodInfo as table serverpod_method
--
CREATE TABLE "serverpod_method" (
"id" INTEGER PRIMARY KEY,
"endpoint" TEXT NOT NULL,
"method" TEXT NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_method_endpoint_method_idx" ON "serverpod_method" ("endpoint", "method");
--
-- Class DatabaseMigrationVersion as table serverpod_migrations
--
CREATE TABLE "serverpod_migrations" (
"id" INTEGER PRIMARY KEY,
"module" TEXT NOT NULL,
"version" TEXT NOT NULL,
"timestamp" INTEGER
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_migrations_ids" ON "serverpod_migrations" ("module");
--
-- Class QueryLogEntry as table serverpod_query_log
--
CREATE TABLE "serverpod_query_log" (
"id" INTEGER PRIMARY KEY,
"serverId" TEXT NOT NULL,
"sessionLogId" INTEGER NOT NULL,
"messageId" INTEGER,
"query" TEXT NOT NULL,
"duration" REAL NOT NULL,
"numRows" INTEGER,
"error" TEXT,
"stackTrace" TEXT,
"slow" INTEGER NOT NULL,
"order" INTEGER NOT NULL,
CONSTRAINT "serverpod_query_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "serverpod_query_log_sessionLogId_idx" ON "serverpod_query_log" ("sessionLogId", "order");
--
-- Class ReadWriteTestEntry as table serverpod_readwrite_test
--
CREATE TABLE "serverpod_readwrite_test" (
"id" INTEGER PRIMARY KEY,
"number" INTEGER NOT NULL
) STRICT;
--
-- Class RuntimeSettings as table serverpod_runtime_settings
--
CREATE TABLE "serverpod_runtime_settings" (
"id" INTEGER PRIMARY KEY,
"logSettings" TEXT NOT NULL,
"logSettingsOverrides" TEXT NOT NULL,
"logServiceCalls" INTEGER NOT NULL,
"logMalformedCalls" INTEGER NOT NULL
) STRICT;
--
-- Class SessionLogEntry as table serverpod_session_log
--
CREATE TABLE "serverpod_session_log" (
"id" INTEGER PRIMARY KEY,
"serverId" TEXT NOT NULL,
"time" INTEGER NOT NULL,
"module" TEXT,
"endpoint" TEXT,
"method" TEXT,
"duration" REAL,
"numQueries" INTEGER,
"slow" INTEGER,
"error" TEXT,
"stackTrace" TEXT,
"authenticatedUserId" INTEGER,
"userId" TEXT,
"isOpen" INTEGER,
"touched" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE INDEX "serverpod_session_log_serverid_idx" ON "serverpod_session_log" ("serverId");
CREATE INDEX "serverpod_session_log_time_idx" ON "serverpod_session_log" ("time");
CREATE INDEX "serverpod_session_log_touched_idx" ON "serverpod_session_log" ("touched");
CREATE INDEX "serverpod_session_log_isopen_idx" ON "serverpod_session_log" ("isOpen");
--
-- Class AnonymousAccount as table serverpod_auth_idp_anonymous_account
--
CREATE TABLE "serverpod_auth_idp_anonymous_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL,
CONSTRAINT "serverpod_auth_idp_anonymous_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
--
-- Class AppleAccount as table serverpod_auth_idp_apple_account
--
CREATE TABLE "serverpod_auth_idp_apple_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"userIdentifier" TEXT NOT NULL,
"refreshToken" TEXT NOT NULL,
"refreshTokenRequestedWithBundleIdentifier" INTEGER NOT NULL,
"lastRefreshedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"authUserId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL,
"email" TEXT,
"isEmailVerified" INTEGER,
"isPrivateEmail" INTEGER,
"firstName" TEXT,
"lastName" TEXT,
CONSTRAINT "serverpod_auth_idp_apple_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_apple_account_identifier" ON "serverpod_auth_idp_apple_account" ("userIdentifier");
--
-- Class EmailAccount as table serverpod_auth_idp_email_account
--
CREATE TABLE "serverpod_auth_idp_email_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL,
"email" TEXT NOT NULL,
"passwordHash" TEXT NOT NULL,
CONSTRAINT "serverpod_auth_idp_email_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_idp_email_account_email" ON "serverpod_auth_idp_email_account" ("email");
--
-- Class EmailAccountPasswordResetRequest as table serverpod_auth_idp_email_account_password_reset_request
--
CREATE TABLE "serverpod_auth_idp_email_account_password_reset_request" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"emailAccountId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"challengeId" BLOB NOT NULL,
"setPasswordChallengeId" BLOB,
CONSTRAINT "serverpod_auth_idp_email_account_password_reset_request_fk_0" FOREIGN KEY ("emailAccountId") REFERENCES "serverpod_auth_idp_email_account" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "serverpod_auth_idp_email_account_password_reset_request_fk_1" FOREIGN KEY ("challengeId") REFERENCES "serverpod_auth_idp_secret_challenge" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "serverpod_auth_idp_email_account_password_reset_request_fk_2" FOREIGN KEY ("setPasswordChallengeId") REFERENCES "serverpod_auth_idp_secret_challenge" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
--
-- Class EmailAccountRequest as table serverpod_auth_idp_email_account_request
--
CREATE TABLE "serverpod_auth_idp_email_account_request" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"email" TEXT NOT NULL,
"challengeId" BLOB NOT NULL,
"createAccountChallengeId" BLOB,
CONSTRAINT "serverpod_auth_idp_email_account_request_fk_0" FOREIGN KEY ("challengeId") REFERENCES "serverpod_auth_idp_secret_challenge" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "serverpod_auth_idp_email_account_request_fk_1" FOREIGN KEY ("createAccountChallengeId") REFERENCES "serverpod_auth_idp_secret_challenge" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_idp_email_account_request_email" ON "serverpod_auth_idp_email_account_request" ("email");
--
-- Class FacebookAccount as table serverpod_auth_idp_facebook_account
--
CREATE TABLE "serverpod_auth_idp_facebook_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL,
"userIdentifier" TEXT NOT NULL,
"email" TEXT,
"fullName" TEXT,
"firstName" TEXT,
"lastName" TEXT,
CONSTRAINT "serverpod_auth_idp_facebook_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_facebook_account_user_identifier" ON "serverpod_auth_idp_facebook_account" ("userIdentifier");
--
-- Class FirebaseAccount as table serverpod_auth_idp_firebase_account
--
CREATE TABLE "serverpod_auth_idp_firebase_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"created" INTEGER NOT NULL,
"email" TEXT,
"phone" TEXT,
"userIdentifier" TEXT NOT NULL,
CONSTRAINT "serverpod_auth_idp_firebase_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_firebase_account_user_identifier" ON "serverpod_auth_idp_firebase_account" ("userIdentifier");
--
-- Class GitHubAccount as table serverpod_auth_idp_github_account
--
CREATE TABLE "serverpod_auth_idp_github_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"userIdentifier" TEXT NOT NULL,
"email" TEXT,
"created" INTEGER NOT NULL,
CONSTRAINT "serverpod_auth_idp_github_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_github_account_user_identifier" ON "serverpod_auth_idp_github_account" ("userIdentifier");
--
-- Class GoogleAccount as table serverpod_auth_idp_google_account
--
CREATE TABLE "serverpod_auth_idp_google_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"created" INTEGER NOT NULL,
"email" TEXT NOT NULL,
"userIdentifier" TEXT NOT NULL,
CONSTRAINT "serverpod_auth_idp_google_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_google_account_user_identifier" ON "serverpod_auth_idp_google_account" ("userIdentifier");
--
-- Class MicrosoftAccount as table serverpod_auth_idp_microsoft_account
--
CREATE TABLE "serverpod_auth_idp_microsoft_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"userIdentifier" TEXT NOT NULL,
"email" TEXT,
"created" INTEGER NOT NULL,
CONSTRAINT "serverpod_auth_idp_microsoft_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_microsoft_account_user_identifier" ON "serverpod_auth_idp_microsoft_account" ("userIdentifier");
--
-- Class PasskeyAccount as table serverpod_auth_idp_passkey_account
--
CREATE TABLE "serverpod_auth_idp_passkey_account" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL,
"keyId" BLOB NOT NULL,
"keyIdBase64" TEXT NOT NULL,
"clientDataJSON" BLOB NOT NULL,
"attestationObject" BLOB NOT NULL,
"originalChallenge" BLOB NOT NULL,
CONSTRAINT "serverpod_auth_idp_passkey_account_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_idp_passkey_account_key_id_base64" ON "serverpod_auth_idp_passkey_account" ("keyIdBase64");
--
-- Class PasskeyChallenge as table serverpod_auth_idp_passkey_challenge
--
CREATE TABLE "serverpod_auth_idp_passkey_challenge" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"createdAt" INTEGER NOT NULL,
"challenge" BLOB NOT NULL
) STRICT;
--
-- Class RateLimitedRequestAttempt as table serverpod_auth_idp_rate_limited_request_attempt
--
CREATE TABLE "serverpod_auth_idp_rate_limited_request_attempt" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"domain" TEXT NOT NULL,
"source" TEXT NOT NULL,
"key" TEXT NOT NULL,
"ipAddress" TEXT,
"attemptedAt" INTEGER NOT NULL,
"extraData" TEXT
) STRICT;
-- Indexes
CREATE INDEX "serverpod_auth_idp_rate_limited_request_attempt_composite" ON "serverpod_auth_idp_rate_limited_request_attempt" ("domain", "source", "key", "attemptedAt");
--
-- Class SecretChallenge as table serverpod_auth_idp_secret_challenge
--
CREATE TABLE "serverpod_auth_idp_secret_challenge" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"challengeCodeHash" TEXT NOT NULL
) STRICT;
--
-- Class CrdtDataAttemptedValue as table crdt_data_attempted_value
--
CREATE TABLE "crdt_data_attempted_value" (
"id" INTEGER PRIMARY KEY,
"fieldId" INTEGER NOT NULL,
"value" BLOB NOT NULL,
"projectionReason" INTEGER NOT NULL,
CONSTRAINT "crdt_data_attempted_value_fk_0" FOREIGN KEY ("fieldId") REFERENCES "crdt_data_fields" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_data_attempted_value__fieldId__unique_idx" ON "crdt_data_attempted_value" ("fieldId");
--
-- Class CrdtDataField as table crdt_data_fields
--
CREATE TABLE "crdt_data_fields" (
"id" INTEGER PRIMARY KEY,
"hlcDatetime" INTEGER NOT NULL,
"hlcCounter" INTEGER NOT NULL,
"rowId" INTEGER NOT NULL,
"columnId" INTEGER NOT NULL,
"nodeId" INTEGER NOT NULL,
CONSTRAINT "crdt_data_fields_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_data_fields_fk_1" FOREIGN KEY ("columnId") REFERENCES "crdt_schema_columns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_data_fields_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_data_fields_row_column_idx" ON "crdt_data_fields" ("rowId", "columnId");
--
-- Class CrdtDataRow as table crdt_data_rows
--
CREATE TABLE "crdt_data_rows" (
"id" INTEGER PRIMARY KEY,
"hlcDatetime" INTEGER NOT NULL,
"hlcCounter" INTEGER NOT NULL,
"spaceId" INTEGER NOT NULL,
"tblId" INTEGER NOT NULL,
"uuidRowId" BLOB NOT NULL,
"nodeId" INTEGER NOT NULL,
"visibility" INTEGER NOT NULL DEFAULT (0),
CONSTRAINT "crdt_data_rows_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_data_rows_fk_1" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_data_rows_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_data_rows_space_tbl_row_idx" ON "crdt_data_rows" ("spaceId", "tblId", "uuidRowId");
--
-- Class CrdtDataDeleted as table crdt_data_tombstone
--
CREATE TABLE "crdt_data_tombstone" (
"id" INTEGER PRIMARY KEY,
"hlcDatetime" INTEGER NOT NULL,
"hlcCounter" INTEGER NOT NULL,
"rowId" INTEGER NOT NULL,
"nodeId" INTEGER NOT NULL,
"clFlag" INTEGER NOT NULL,
"reason" INTEGER NOT NULL,
CONSTRAINT "crdt_data_tombstone_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "crdt_data_tombstone_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_data_tombstone_row_idx" ON "crdt_data_tombstone" ("rowId");
--
-- Class CrdtNode as table crdt_nodes
--
CREATE TABLE "crdt_nodes" (
"id" INTEGER PRIMARY KEY,
"uuidNodeId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"lastHlc" BLOB
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_nodes__uuidNodeId__unique_idx" ON "crdt_nodes" ("uuidNodeId");
--
-- Class CrdtSchemaColumn as table crdt_schema_columns
--
CREATE TABLE "crdt_schema_columns" (
"id" INTEGER PRIMARY KEY,
"tblId" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"columnType" TEXT NOT NULL,
"dartType" TEXT NOT NULL,
"isNullable" INTEGER NOT NULL,
CONSTRAINT "crdt_schema_columns_fk_0" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_schema_columns_table_column_idx" ON "crdt_schema_columns" ("tblId", "name");
--
-- Class CrdtSchemaTable as table crdt_schema_tables
--
CREATE TABLE "crdt_schema_tables" (
"id" INTEGER PRIMARY KEY,
"name" TEXT NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "crdt_schema_tables__name__unique_idx" ON "crdt_schema_tables" ("name");
--
-- Class OfflineSyncIntegrityViolation as table offline_sync_integrity_violations
--
CREATE TABLE "offline_sync_integrity_violations" (
"id" INTEGER PRIMARY KEY,
"type" TEXT NOT NULL,
"domainTableName" TEXT NOT NULL,
"uuidRowId" BLOB NOT NULL,
"ownerSpaceUuid" BLOB,
"incomingSpaceUuid" BLOB NOT NULL,
"operation" TEXT NOT NULL,
"uuidNodeId" BLOB,
"crdtDataRowId" INTEGER,
"hlcDatetime" INTEGER,
"hlcCounter" INTEGER,
"firstSeenAt" INTEGER NOT NULL,
"lastSeenAt" INTEGER NOT NULL,
"occurrences" INTEGER NOT NULL
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "offline_sync_integrity_violations_key_idx" ON "offline_sync_integrity_violations" ("type", "operation", "domainTableName", "uuidRowId", "ownerSpaceUuid", "incomingSpaceUuid");
--
-- Class OfflineSyncSpaceMember as table offline_sync_space_members
--
CREATE TABLE "offline_sync_space_members" (
"id" INTEGER PRIMARY KEY,
"spaceId" INTEGER NOT NULL,
"userUuid" BLOB NOT NULL,
"role" TEXT NOT NULL,
CONSTRAINT "offline_sync_space_members_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "offline_sync_space_member_unique_idx" ON "offline_sync_space_members" ("userUuid", "spaceId");
--
-- Class OfflineSyncSpaceNode as table offline_sync_space_nodes
--
CREATE TABLE "offline_sync_space_nodes" (
"id" INTEGER PRIMARY KEY,
"spaceId" INTEGER NOT NULL,
"nodeId" INTEGER NOT NULL,
"lastReceivedHlc" BLOB,
CONSTRAINT "offline_sync_space_nodes_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "offline_sync_space_nodes_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "offline_sync_space_node_unique_idx" ON "offline_sync_space_nodes" ("spaceId", "nodeId");
--
-- Class OfflineSyncSpace as table offline_sync_spaces
--
CREATE TABLE "offline_sync_spaces" (
"id" INTEGER PRIMARY KEY,
"uuidSpaceId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"currentNodeId" INTEGER,
CONSTRAINT "offline_sync_spaces_fk_0" FOREIGN KEY ("currentNodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "offline_sync_spaces__uuidSpaceId__unique_idx" ON "offline_sync_spaces" ("uuidSpaceId");
--
-- Class OidcAttempt as table halkyon_oidc_attempt
--
CREATE TABLE "halkyon_oidc_attempt" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(hex(randomblob(6)) || '4' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"provider" TEXT NOT NULL,
"state" TEXT NOT NULL,
"nonce" TEXT NOT NULL,
"codeVerifier" TEXT,
"callerId" BLOB,
"subject" TEXT,
"expiresAt" INTEGER NOT NULL,
CONSTRAINT "halkyon_oidc_attempt_fk_0" FOREIGN KEY ("callerId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "halkyon_oidc_attempt_expires_idx" ON "halkyon_oidc_attempt" ("expiresAt");
--
-- Class OidcIdentity as table halkyon_oidc_identity
--
CREATE TABLE "halkyon_oidc_identity" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"provider" TEXT NOT NULL,
"subject" TEXT NOT NULL,
"createdAt" INTEGER NOT NULL,
CONSTRAINT "halkyon_oidc_identity_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "halkyon_oidc_identity_subject_idx" ON "halkyon_oidc_identity" ("provider", "subject");
CREATE UNIQUE INDEX "halkyon_oidc_identity_person_idx" ON "halkyon_oidc_identity" ("authUserId", "provider");
--
-- Class RefreshToken as table serverpod_auth_core_jwt_refresh_token
--
CREATE TABLE "serverpod_auth_core_jwt_refresh_token" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"scopeNames" TEXT NOT NULL,
"extraClaims" TEXT,
"method" TEXT NOT NULL,
"fixedSecret" BLOB NOT NULL,
"rotatingSecretHash" TEXT NOT NULL,
"lastUpdatedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
CONSTRAINT "serverpod_auth_core_jwt_refresh_token_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
-- Indexes
CREATE INDEX "serverpod_auth_core_jwt_refresh_token_last_updated_at" ON "serverpod_auth_core_jwt_refresh_token" ("lastUpdatedAt");
--
-- Class UserProfile as table serverpod_auth_core_profile
--
CREATE TABLE "serverpod_auth_core_profile" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"userName" TEXT,
"fullName" TEXT,
"email" TEXT,
"createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"imageId" BLOB,
CONSTRAINT "serverpod_auth_core_profile_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "serverpod_auth_core_profile_fk_1" FOREIGN KEY ("imageId") REFERENCES "serverpod_auth_core_profile_image" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
) STRICT;
-- Indexes
CREATE UNIQUE INDEX "serverpod_auth_profile_user_profile_email_auth_user_id" ON "serverpod_auth_core_profile" ("authUserId");
--
-- Class UserProfileImage as table serverpod_auth_core_profile_image
--
CREATE TABLE "serverpod_auth_core_profile_image" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"userProfileId" BLOB NOT NULL,
"createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"storageId" TEXT NOT NULL,
"path" TEXT NOT NULL,
"url" TEXT NOT NULL,
CONSTRAINT "serverpod_auth_core_profile_image_fk_0" FOREIGN KEY ("userProfileId") REFERENCES "serverpod_auth_core_profile" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
--
-- Class ServerSideSession as table serverpod_auth_core_session
--
CREATE TABLE "serverpod_auth_core_session" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"authUserId" BLOB NOT NULL,
"scopeNames" TEXT NOT NULL,
"createdAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"lastUsedAt" INTEGER NOT NULL DEFAULT (CAST(unixepoch('subsecond') * 1000 AS INTEGER)),
"expiresAt" INTEGER,
"expireAfterUnusedFor" INTEGER,
"sessionKeyHash" BLOB NOT NULL,
"sessionKeySalt" BLOB NOT NULL,
"method" TEXT NOT NULL,
CONSTRAINT "serverpod_auth_core_session_fk_0" FOREIGN KEY ("authUserId") REFERENCES "serverpod_auth_core_user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
) STRICT;
--
-- Class AuthUser as table serverpod_auth_core_user
--
CREATE TABLE "serverpod_auth_core_user" (
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
"createdAt" INTEGER NOT NULL,
"scopeNames" TEXT NOT NULL,
"blocked" INTEGER NOT NULL
) STRICT;
--
-- 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
('body_weight', 'id', 'uuid', NULL),
('content_key', 'id', 'uuid', NULL),
('day', 'id', 'uuid', NULL),
('day_series', 'id', 'uuid', NULL),
('day_series', 'dayId', 'uuid', NULL),
('night', 'id', 'uuid', NULL),
('plan', 'id', 'uuid', NULL),
('profile', 'id', 'uuid', NULL),
('route', 'id', 'uuid', NULL),
('strength_plan', 'id', 'uuid', NULL),
('training_place', 'id', 'uuid', NULL),
('workout', 'id', 'uuid', NULL),
('workout_series', 'id', 'uuid', NULL),
('workout_series', 'workoutId', 'uuid', NULL),
('account_deletion_notice', 'account', 'uuid', NULL),
('account_deletion_notice', 'createdAt', 'timestampWithoutTimeZone', NULL),
('account_deletion_notice', 'lastAttemptAt', 'timestampWithoutTimeZone', NULL),
('account_password', 'authUserId', 'uuid', NULL),
('account_password', 'sessionEndedForProofsAt', 'timestampWithoutTimeZone', NULL),
('account_password', 'createdAt', 'timestampWithoutTimeZone', NULL),
('account_password', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('account_reset', 'authUserId', 'uuid', NULL),
('account_reset', 'takesEffectAt', 'timestampWithoutTimeZone', NULL),
('account_reset', 'heldOutUntil', 'timestampWithoutTimeZone', NULL),
('account_reset', 'createdAt', 'timestampWithoutTimeZone', NULL),
('assistant_budget', 'authUserId', 'uuid', NULL),
('assistant_figures', 'authUserId', 'uuid', NULL),
('assistant_figures', 'day', 'timestampWithoutTimeZone', NULL),
('assistant_grant', 'authUserId', 'uuid', NULL),
('assistant_grant', 'grantedAt', 'timestampWithoutTimeZone', NULL),
('assistant_grant', 'agreedAt', 'timestampWithoutTimeZone', NULL),
('email_code_request', 'id', 'uuid', NULL),
('email_code_request', 'challengeId', 'uuid', NULL),
('email_code_request', 'switchChallengeId', 'uuid', NULL),
('email_code_request', 'createdAt', 'timestampWithoutTimeZone', NULL),
('email_identity', 'authUserId', 'uuid', NULL),
('email_identity', 'createdAt', 'timestampWithoutTimeZone', NULL),
('public_profile', 'authUserId', 'uuid', NULL),
('public_profile', 'links', 'json', NULL),
('public_profile', 'verifiedLinks', 'json', NULL),
('public_profile', 'firstPublishedAt', 'timestampWithoutTimeZone', NULL),
('public_profile', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('recovery_code', 'authUserId', 'uuid', NULL),
('second_factor_failures', 'authUserId', 'uuid', NULL),
('second_factor_failures', 'waitUntil', 'timestampWithoutTimeZone', NULL),
('second_factor_failures', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('session_code_failures', 'sessionId', 'uuid', NULL),
('session_code_failures', 'authUserId', 'uuid', NULL),
('session_code_failures', 'updatedAt', 'timestampWithoutTimeZone', NULL),
('sessions_ended_notice', 'account', 'uuid', NULL),
('sessions_ended_notice', 'endedBefore', 'timestampWithoutTimeZone', NULL),
('sessions_ended_notice', 'keepSession', 'uuid', NULL),
('sessions_ended_notice', 'lastAttemptAt', 'timestampWithoutTimeZone', NULL),
('sign_in_challenge', 'id', 'uuid', NULL),
('sign_in_challenge', 'authUserId', 'uuid', NULL),
('sign_in_challenge', 'createdAt', 'timestampWithoutTimeZone', NULL),
('totp_authenticator', 'id', 'uuid', NULL),
('totp_authenticator', 'authUserId', 'uuid', NULL),
('totp_authenticator', 'confirmedAt', 'timestampWithoutTimeZone', NULL),
('totp_authenticator', 'createdAt', 'timestampWithoutTimeZone', NULL),
('waiting_account', 'authUserId', 'uuid', NULL),
('waiting_account', 'since', 'timestampWithoutTimeZone', NULL),
('waiting_account', 'suspendedAt', 'timestampWithoutTimeZone', NULL),
('waiting_pass', 'authUserId', 'uuid', NULL),
('waiting_pass', 'madeAt', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL),
('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL),
('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL),
('serverpod_future_call', 'scheduling', 'json', NULL),
('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL),
('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL),
('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL),
('serverpod_health_metric', 'isHealthy', 'boolean', NULL),
('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL),
('serverpod_message_log', 'slow', 'boolean', NULL),
('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL),
('serverpod_query_log', 'slow', 'boolean', NULL),
('serverpod_runtime_settings', 'logSettings', 'json', NULL),
('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL),
('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL),
('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL),
('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL),
('serverpod_session_log', 'slow', 'boolean', NULL),
('serverpod_session_log', 'isOpen', 'boolean', NULL),
('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_anonymous_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_anonymous_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_anonymous_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_apple_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_apple_account', 'refreshTokenRequestedWithBundleIdentifier', 'boolean', NULL),
('serverpod_auth_idp_apple_account', 'lastRefreshedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_apple_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_apple_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_apple_account', 'isEmailVerified', 'boolean', NULL),
('serverpod_auth_idp_apple_account', 'isPrivateEmail', 'boolean', NULL),
('serverpod_auth_idp_email_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_email_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_email_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'id', 'uuid', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'emailAccountId', 'uuid', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'challengeId', 'uuid', NULL),
('serverpod_auth_idp_email_account_password_reset_request', 'setPasswordChallengeId', 'uuid', NULL),
('serverpod_auth_idp_email_account_request', 'id', 'uuid', NULL),
('serverpod_auth_idp_email_account_request', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_email_account_request', 'challengeId', 'uuid', NULL),
('serverpod_auth_idp_email_account_request', 'createAccountChallengeId', 'uuid', NULL),
('serverpod_auth_idp_facebook_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_facebook_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_facebook_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_firebase_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_firebase_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_firebase_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_github_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_github_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_github_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_google_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_google_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_google_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_microsoft_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_microsoft_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_microsoft_account', 'created', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_passkey_account', 'id', 'uuid', NULL),
('serverpod_auth_idp_passkey_account', 'authUserId', 'uuid', NULL),
('serverpod_auth_idp_passkey_account', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_passkey_challenge', 'id', 'uuid', NULL),
('serverpod_auth_idp_passkey_challenge', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_rate_limited_request_attempt', 'id', 'uuid', NULL),
('serverpod_auth_idp_rate_limited_request_attempt', 'attemptedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_idp_rate_limited_request_attempt', 'extraData', 'json', NULL),
('serverpod_auth_idp_secret_challenge', 'id', 'uuid', NULL),
('crdt_data_attempted_value', 'value', 'jsonb', NULL),
('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_data_rows', 'uuidRowId', 'uuid', NULL),
('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('crdt_nodes', 'uuidNodeId', 'uuid', NULL),
('crdt_nodes', 'lastHlc', 'jsonb', NULL),
('crdt_schema_columns', 'isNullable', 'boolean', NULL),
('offline_sync_integrity_violations', 'uuidRowId', 'uuid', NULL),
('offline_sync_integrity_violations', 'ownerSpaceUuid', 'uuid', NULL),
('offline_sync_integrity_violations', 'incomingSpaceUuid', 'uuid', NULL),
('offline_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL),
('offline_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
('offline_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL),
('offline_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL),
('offline_sync_space_members', 'userUuid', 'uuid', NULL),
('offline_sync_space_nodes', 'lastReceivedHlc', 'jsonb', NULL),
('offline_sync_spaces', 'uuidSpaceId', 'uuid', NULL),
('halkyon_oidc_attempt', 'id', 'uuid', NULL),
('halkyon_oidc_attempt', 'callerId', 'uuid', NULL),
('halkyon_oidc_attempt', 'expiresAt', 'timestampWithoutTimeZone', NULL),
('halkyon_oidc_identity', 'id', 'uuid', NULL),
('halkyon_oidc_identity', 'authUserId', 'uuid', NULL),
('halkyon_oidc_identity', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL),
('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL),
('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL),
('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_profile', 'id', 'uuid', NULL),
('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL),
('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_profile', 'imageId', 'uuid', NULL),
('serverpod_auth_core_profile_image', 'id', 'uuid', NULL),
('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL),
('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_session', 'id', 'uuid', NULL),
('serverpod_auth_core_session', 'authUserId', 'uuid', NULL),
('serverpod_auth_core_session', 'scopeNames', 'json', NULL),
('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_user', 'id', 'uuid', NULL),
('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL),
('serverpod_auth_core_user', 'scopeNames', 'json', NULL),
('serverpod_auth_core_user', 'blocked', 'boolean', NULL);
--
-- MIGRATION VERSION FOR halkyon_train
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('halkyon_train', '20261103204323683-body-weights', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20261103204323683-body-weights', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR halkyon_base
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('halkyon_base', '20261026140329453-assistant-budgets', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20261026140329453-assistant-budgets', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod', '20260824182259319', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260824182259319', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod_auth_idp
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_auth_idp', '20260924105404509', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260924105404509', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod_offline_sync
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_offline_sync', '20260914143806119', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260914143806119', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR halkyon_oidc
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('halkyon_oidc', '20261023180644988', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20261023180644988', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
--
-- MIGRATION VERSION FOR serverpod_auth_core
--
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
VALUES ('serverpod_auth_core', '20260924105232991', (unixepoch('now', 'subsecond') * 1000))
ON CONFLICT ("module")
DO UPDATE SET "version" = '20260924105232991', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
COMMIT;
''';
}