2197 lines
98 KiB
Dart
2197 lines
98 KiB
Dart
|
|
/// 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 _Migration20261025184004860_assistant_conversations
|
||
|
|
implements MigrationVersionSql {
|
||
|
|
@override
|
||
|
|
String get version => '20261025184004860-assistant-conversations';
|
||
|
|
|
||
|
|
@override
|
||
|
|
String get moduleName => 'halkyon_learn';
|
||
|
|
|
||
|
|
@override
|
||
|
|
String get migrationSql => '''BEGIN;
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
CREATE TABLE "assistant_conversation" (
|
||
|
|
"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 "assistant_conversation_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "assistant_conversation_space_idx" ON "assistant_conversation" ("spaceId");
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
CREATE TABLE "assistant_turn" (
|
||
|
|
"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,
|
||
|
|
"conversationId" BLOB NOT NULL,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "assistant_turn_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "assistant_turn_fk_1" FOREIGN KEY ("conversationId") REFERENCES "assistant_conversation" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "assistant_turn_space_idx" ON "assistant_turn" ("spaceId");
|
||
|
|
CREATE INDEX "assistant_turn_conversation_idx" ON "assistant_turn" ("conversationId");
|
||
|
|
|
||
|
|
--
|
||
|
|
-- 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
|
||
|
|
('asset', 'id', 'uuid', NULL),
|
||
|
|
('assistant_conversation', 'id', 'uuid', NULL),
|
||
|
|
('assistant_turn', 'id', 'uuid', NULL),
|
||
|
|
('assistant_turn', 'conversationId', 'uuid', NULL),
|
||
|
|
('card', 'id', 'uuid', NULL),
|
||
|
|
('card', 'studysetId', 'uuid', NULL),
|
||
|
|
('card', 'buriedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('card_revision', 'id', 'uuid', NULL),
|
||
|
|
('card_revision', 'cardId', 'uuid', NULL),
|
||
|
|
('card_revision', 'parents', 'json', NULL),
|
||
|
|
('card_revision', 'authorId', 'uuid', NULL),
|
||
|
|
('card_revision', 'reportId', 'uuid', NULL),
|
||
|
|
('card_tag', 'id', 'uuid', NULL),
|
||
|
|
('card_tag', 'cardId', 'uuid', NULL),
|
||
|
|
('card_tag', 'tagId', 'uuid', NULL),
|
||
|
|
('content_key', 'id', 'uuid', NULL),
|
||
|
|
('content_key', 'studysetId', 'uuid', NULL),
|
||
|
|
('content_key', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('feedback_decision', 'id', 'uuid', NULL),
|
||
|
|
('feedback_decision', 'threadId', 'uuid', NULL),
|
||
|
|
('feedback_message', 'id', 'uuid', NULL),
|
||
|
|
('feedback_message', 'threadId', 'uuid', NULL),
|
||
|
|
('feedback_thread', 'id', 'uuid', NULL),
|
||
|
|
('feedback_thread', 'publicationId', 'uuid', NULL),
|
||
|
|
('learning_path', 'id', 'uuid', NULL),
|
||
|
|
('learning_path', 'studysetId', 'uuid', NULL),
|
||
|
|
('learning_path_answer', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_answer', 'stepId', 'uuid', NULL),
|
||
|
|
('learning_path_answer', 'answeredAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('learning_path_step', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_step', 'pathId', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'stepId', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'parents', 'json', NULL),
|
||
|
|
('learning_path_step_revision', 'authorId', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'reportId', 'uuid', NULL),
|
||
|
|
('learning_path_tag', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_tag', 'pathId', 'uuid', NULL),
|
||
|
|
('learning_path_tag', 'tagId', 'uuid', NULL),
|
||
|
|
('note', 'id', 'uuid', NULL),
|
||
|
|
('note', 'studysetId', 'uuid', NULL),
|
||
|
|
('note_revision', 'id', 'uuid', NULL),
|
||
|
|
('note_revision', 'noteId', 'uuid', NULL),
|
||
|
|
('note_revision', 'parents', 'json', NULL),
|
||
|
|
('note_revision', 'authorId', 'uuid', NULL),
|
||
|
|
('note_revision', 'reportId', 'uuid', NULL),
|
||
|
|
('note_tag', 'id', 'uuid', NULL),
|
||
|
|
('note_tag', 'noteId', 'uuid', NULL),
|
||
|
|
('note_tag', 'tagId', 'uuid', NULL),
|
||
|
|
('pdf_reading', 'id', 'uuid', NULL),
|
||
|
|
('pdf_reading', 'pdfSourceId', 'uuid', NULL),
|
||
|
|
('pdf_reading', 'readAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('pdf_source', 'id', 'uuid', NULL),
|
||
|
|
('pdf_source', 'studysetId', 'uuid', NULL),
|
||
|
|
('person_settings', 'id', 'uuid', NULL),
|
||
|
|
('review_log', 'id', 'uuid', NULL),
|
||
|
|
('review_log', 'cardId', 'uuid', NULL),
|
||
|
|
('review_log', 'reviewedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'id', 'uuid', NULL),
|
||
|
|
('studyset', 'parentId', 'uuid', NULL),
|
||
|
|
('studyset', 'archivedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'deletedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'starredAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'updatedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('tag', 'id', '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_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_learn
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('halkyon_learn', '20261025184004860-assistant-conversations', (unixepoch('now', 'subsecond') * 1000))
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261025184004860-assistant-conversations', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR halkyon_base
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('halkyon_base', '20261025165102522-assistants', (unixepoch('now', 'subsecond') * 1000))
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261025165102522-assistants', "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 Asset as table asset
|
||
|
|
--
|
||
|
|
CREATE TABLE "asset" (
|
||
|
|
"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,
|
||
|
|
"sha256" TEXT NOT NULL,
|
||
|
|
"mimeType" TEXT NOT NULL,
|
||
|
|
"byteSize" INTEGER NOT NULL,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "asset_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "asset_space_idx" ON "asset" ("spaceId");
|
||
|
|
CREATE INDEX "asset_hash_idx" ON "asset" ("spaceId", "sha256");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class AssistantConversation as table assistant_conversation
|
||
|
|
--
|
||
|
|
CREATE TABLE "assistant_conversation" (
|
||
|
|
"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 "assistant_conversation_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "assistant_conversation_space_idx" ON "assistant_conversation" ("spaceId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class AssistantTurn as table assistant_turn
|
||
|
|
--
|
||
|
|
CREATE TABLE "assistant_turn" (
|
||
|
|
"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,
|
||
|
|
"conversationId" BLOB NOT NULL,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "assistant_turn_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "assistant_turn_fk_1" FOREIGN KEY ("conversationId") REFERENCES "assistant_conversation" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "assistant_turn_space_idx" ON "assistant_turn" ("spaceId");
|
||
|
|
CREATE INDEX "assistant_turn_conversation_idx" ON "assistant_turn" ("conversationId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class Card as table card
|
||
|
|
--
|
||
|
|
CREATE TABLE "card" (
|
||
|
|
"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,
|
||
|
|
"studysetId" BLOB NOT NULL,
|
||
|
|
"position" TEXT NOT NULL,
|
||
|
|
"buriedAt" INTEGER,
|
||
|
|
CONSTRAINT "card_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "card_fk_1" FOREIGN KEY ("studysetId") REFERENCES "studyset" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "card_space_idx" ON "card" ("spaceId");
|
||
|
|
CREATE INDEX "card_studyset_idx" ON "card" ("studysetId", "position");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class CardRevision as table card_revision
|
||
|
|
--
|
||
|
|
CREATE TABLE "card_revision" (
|
||
|
|
"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,
|
||
|
|
"cardId" BLOB NOT NULL,
|
||
|
|
"parents" TEXT NOT NULL,
|
||
|
|
"authorId" BLOB NOT NULL,
|
||
|
|
"reportId" BLOB,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "card_revision_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "card_revision_fk_1" FOREIGN KEY ("cardId") REFERENCES "card" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "card_revision_space_idx" ON "card_revision" ("spaceId");
|
||
|
|
CREATE INDEX "card_revision_card_idx" ON "card_revision" ("cardId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class CardTag as table card_tag
|
||
|
|
--
|
||
|
|
CREATE TABLE "card_tag" (
|
||
|
|
"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,
|
||
|
|
"cardId" BLOB NOT NULL,
|
||
|
|
"tagId" BLOB NOT NULL,
|
||
|
|
CONSTRAINT "card_tag_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "card_tag_fk_1" FOREIGN KEY ("cardId") REFERENCES "card" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED,
|
||
|
|
CONSTRAINT "card_tag_fk_2" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "card_tag_space_idx" ON "card_tag" ("spaceId");
|
||
|
|
CREATE INDEX "card_tag_card_idx" ON "card_tag" ("cardId");
|
||
|
|
CREATE INDEX "card_tag_tag_idx" ON "card_tag" ("tagId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- 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,
|
||
|
|
"kind" TEXT NOT NULL,
|
||
|
|
"studysetId" BLOB,
|
||
|
|
"sealedKey" BLOB NOT NULL,
|
||
|
|
"createdAt" INTEGER 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 FeedbackDecision as table feedback_decision
|
||
|
|
--
|
||
|
|
CREATE TABLE "feedback_decision" (
|
||
|
|
"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,
|
||
|
|
"threadId" BLOB NOT NULL,
|
||
|
|
"decision" TEXT NOT NULL,
|
||
|
|
CONSTRAINT "feedback_decision_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "feedback_decision_space_idx" ON "feedback_decision" ("spaceId");
|
||
|
|
CREATE INDEX "feedback_decision_thread_idx" ON "feedback_decision" ("threadId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class FeedbackMessage as table feedback_message
|
||
|
|
--
|
||
|
|
CREATE TABLE "feedback_message" (
|
||
|
|
"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,
|
||
|
|
"threadId" BLOB NOT NULL,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "feedback_message_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "feedback_message_space_idx" ON "feedback_message" ("spaceId");
|
||
|
|
CREATE INDEX "feedback_message_thread_idx" ON "feedback_message" ("threadId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class FeedbackThread as table feedback_thread
|
||
|
|
--
|
||
|
|
CREATE TABLE "feedback_thread" (
|
||
|
|
"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,
|
||
|
|
"publicationId" BLOB NOT NULL,
|
||
|
|
"kind" TEXT NOT NULL,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "feedback_thread_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "feedback_thread_space_idx" ON "feedback_thread" ("spaceId");
|
||
|
|
CREATE INDEX "feedback_thread_publication_idx" ON "feedback_thread" ("publicationId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class LearningPath as table learning_path
|
||
|
|
--
|
||
|
|
CREATE TABLE "learning_path" (
|
||
|
|
"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,
|
||
|
|
"studysetId" BLOB NOT NULL,
|
||
|
|
"position" TEXT NOT NULL,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "learning_path_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "learning_path_fk_1" FOREIGN KEY ("studysetId") REFERENCES "studyset" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "learning_path_space_idx" ON "learning_path" ("spaceId");
|
||
|
|
CREATE INDEX "learning_path_studyset_idx" ON "learning_path" ("studysetId", "position");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class LearningPathAnswer as table learning_path_answer
|
||
|
|
--
|
||
|
|
CREATE TABLE "learning_path_answer" (
|
||
|
|
"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,
|
||
|
|
"stepId" BLOB NOT NULL,
|
||
|
|
"answeredAt" INTEGER NOT NULL,
|
||
|
|
"outcome" TEXT NOT NULL,
|
||
|
|
"answer" TEXT,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "learning_path_answer_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "learning_path_answer_fk_1" FOREIGN KEY ("stepId") REFERENCES "learning_path_step" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "learning_path_answer_space_idx" ON "learning_path_answer" ("spaceId");
|
||
|
|
CREATE INDEX "learning_path_answer_step_idx" ON "learning_path_answer" ("stepId", "answeredAt");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class LearningPathStep as table learning_path_step
|
||
|
|
--
|
||
|
|
CREATE TABLE "learning_path_step" (
|
||
|
|
"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,
|
||
|
|
"pathId" BLOB NOT NULL,
|
||
|
|
"position" TEXT NOT NULL,
|
||
|
|
"kind" TEXT NOT NULL,
|
||
|
|
CONSTRAINT "learning_path_step_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "learning_path_step_fk_1" FOREIGN KEY ("pathId") REFERENCES "learning_path" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "learning_path_step_space_idx" ON "learning_path_step" ("spaceId");
|
||
|
|
CREATE INDEX "learning_path_step_path_idx" ON "learning_path_step" ("pathId", "position");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class LearningPathStepRevision as table learning_path_step_revision
|
||
|
|
--
|
||
|
|
CREATE TABLE "learning_path_step_revision" (
|
||
|
|
"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,
|
||
|
|
"stepId" BLOB NOT NULL,
|
||
|
|
"parents" TEXT NOT NULL,
|
||
|
|
"authorId" BLOB NOT NULL,
|
||
|
|
"reportId" BLOB,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "learning_path_step_revision_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "learning_path_step_revision_fk_1" FOREIGN KEY ("stepId") REFERENCES "learning_path_step" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "learning_path_step_revision_space_idx" ON "learning_path_step_revision" ("spaceId");
|
||
|
|
CREATE INDEX "learning_path_step_revision_step_idx" ON "learning_path_step_revision" ("stepId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class LearningPathTag as table learning_path_tag
|
||
|
|
--
|
||
|
|
CREATE TABLE "learning_path_tag" (
|
||
|
|
"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,
|
||
|
|
"pathId" BLOB NOT NULL,
|
||
|
|
"tagId" BLOB NOT NULL,
|
||
|
|
CONSTRAINT "learning_path_tag_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "learning_path_tag_fk_1" FOREIGN KEY ("pathId") REFERENCES "learning_path" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED,
|
||
|
|
CONSTRAINT "learning_path_tag_fk_2" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "learning_path_tag_space_idx" ON "learning_path_tag" ("spaceId");
|
||
|
|
CREATE INDEX "learning_path_tag_path_idx" ON "learning_path_tag" ("pathId");
|
||
|
|
CREATE INDEX "learning_path_tag_tag_idx" ON "learning_path_tag" ("tagId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class Note as table note
|
||
|
|
--
|
||
|
|
CREATE TABLE "note" (
|
||
|
|
"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,
|
||
|
|
"studysetId" BLOB NOT NULL,
|
||
|
|
"position" TEXT NOT NULL,
|
||
|
|
CONSTRAINT "note_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "note_fk_1" FOREIGN KEY ("studysetId") REFERENCES "studyset" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "note_space_idx" ON "note" ("spaceId");
|
||
|
|
CREATE INDEX "note_studyset_idx" ON "note" ("studysetId", "position");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class NoteRevision as table note_revision
|
||
|
|
--
|
||
|
|
CREATE TABLE "note_revision" (
|
||
|
|
"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,
|
||
|
|
"noteId" BLOB NOT NULL,
|
||
|
|
"parents" TEXT NOT NULL,
|
||
|
|
"authorId" BLOB NOT NULL,
|
||
|
|
"reportId" BLOB,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "note_revision_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "note_revision_fk_1" FOREIGN KEY ("noteId") REFERENCES "note" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "note_revision_space_idx" ON "note_revision" ("spaceId");
|
||
|
|
CREATE INDEX "note_revision_note_idx" ON "note_revision" ("noteId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class NoteTag as table note_tag
|
||
|
|
--
|
||
|
|
CREATE TABLE "note_tag" (
|
||
|
|
"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,
|
||
|
|
"noteId" BLOB NOT NULL,
|
||
|
|
"tagId" BLOB NOT NULL,
|
||
|
|
CONSTRAINT "note_tag_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "note_tag_fk_1" FOREIGN KEY ("noteId") REFERENCES "note" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED,
|
||
|
|
CONSTRAINT "note_tag_fk_2" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "note_tag_space_idx" ON "note_tag" ("spaceId");
|
||
|
|
CREATE INDEX "note_tag_note_idx" ON "note_tag" ("noteId");
|
||
|
|
CREATE INDEX "note_tag_tag_idx" ON "note_tag" ("tagId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class PdfReading as table pdf_reading
|
||
|
|
--
|
||
|
|
CREATE TABLE "pdf_reading" (
|
||
|
|
"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,
|
||
|
|
"pdfSourceId" BLOB NOT NULL,
|
||
|
|
"readAt" INTEGER NOT NULL,
|
||
|
|
"kind" TEXT NOT NULL,
|
||
|
|
"page" INTEGER NOT NULL,
|
||
|
|
CONSTRAINT "pdf_reading_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "pdf_reading_fk_1" FOREIGN KEY ("pdfSourceId") REFERENCES "pdf_source" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "pdf_reading_space_idx" ON "pdf_reading" ("spaceId");
|
||
|
|
CREATE INDEX "pdf_reading_source_idx" ON "pdf_reading" ("pdfSourceId", "readAt");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class PdfSource as table pdf_source
|
||
|
|
--
|
||
|
|
CREATE TABLE "pdf_source" (
|
||
|
|
"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,
|
||
|
|
"studysetId" BLOB NOT NULL,
|
||
|
|
"position" TEXT NOT NULL DEFAULT ('a0'),
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "pdf_source_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "pdf_source_fk_1" FOREIGN KEY ("studysetId") REFERENCES "studyset" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "pdf_source_space_idx" ON "pdf_source" ("spaceId");
|
||
|
|
CREATE INDEX "pdf_source_studyset_idx" ON "pdf_source" ("studysetId", "position");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class PersonSettings as table person_settings
|
||
|
|
--
|
||
|
|
CREATE TABLE "person_settings" (
|
||
|
|
"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 "person_settings_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "person_settings_space_idx" ON "person_settings" ("spaceId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class ReviewLog as table review_log
|
||
|
|
--
|
||
|
|
CREATE TABLE "review_log" (
|
||
|
|
"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,
|
||
|
|
"cardId" BLOB NOT NULL,
|
||
|
|
"rating" INTEGER NOT NULL,
|
||
|
|
"reviewedAt" INTEGER NOT NULL,
|
||
|
|
"durationMs" INTEGER NOT NULL,
|
||
|
|
"mode" TEXT NOT NULL DEFAULT ('review'),
|
||
|
|
CONSTRAINT "review_log_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "review_log_fk_1" FOREIGN KEY ("cardId") REFERENCES "card" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "review_log_space_idx" ON "review_log" ("spaceId");
|
||
|
|
CREATE INDEX "review_log_card_idx" ON "review_log" ("cardId", "reviewedAt");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class Studyset as table studyset
|
||
|
|
--
|
||
|
|
CREATE TABLE "studyset" (
|
||
|
|
"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,
|
||
|
|
"parentId" BLOB,
|
||
|
|
"position" TEXT NOT NULL DEFAULT ('a0'),
|
||
|
|
"archivedAt" INTEGER,
|
||
|
|
"deletedAt" INTEGER,
|
||
|
|
"starredAt" INTEGER,
|
||
|
|
"updatedAt" INTEGER,
|
||
|
|
"keyId" TEXT,
|
||
|
|
"payload" BLOB NOT NULL,
|
||
|
|
"nonce" BLOB,
|
||
|
|
CONSTRAINT "studyset_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||
|
|
CONSTRAINT "studyset_fk_1" FOREIGN KEY ("parentId") REFERENCES "studyset" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "studyset_space_idx" ON "studyset" ("spaceId");
|
||
|
|
CREATE INDEX "studyset_parent_idx" ON "studyset" ("parentId", "position");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- Class Tag as table tag
|
||
|
|
--
|
||
|
|
CREATE TABLE "tag" (
|
||
|
|
"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 "tag_fk_0" FOREIGN KEY ("spaceId") REFERENCES "offline_sync_spaces" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||
|
|
) STRICT;
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE INDEX "tag_space_idx" ON "tag" ("spaceId");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- 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 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,
|
||
|
|
"limitUnit" TEXT NOT NULL,
|
||
|
|
"dailyLimit" INTEGER,
|
||
|
|
"monthlyLimit" INTEGER,
|
||
|
|
"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
|
||
|
|
('asset', 'id', 'uuid', NULL),
|
||
|
|
('assistant_conversation', 'id', 'uuid', NULL),
|
||
|
|
('assistant_turn', 'id', 'uuid', NULL),
|
||
|
|
('assistant_turn', 'conversationId', 'uuid', NULL),
|
||
|
|
('card', 'id', 'uuid', NULL),
|
||
|
|
('card', 'studysetId', 'uuid', NULL),
|
||
|
|
('card', 'buriedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('card_revision', 'id', 'uuid', NULL),
|
||
|
|
('card_revision', 'cardId', 'uuid', NULL),
|
||
|
|
('card_revision', 'parents', 'json', NULL),
|
||
|
|
('card_revision', 'authorId', 'uuid', NULL),
|
||
|
|
('card_revision', 'reportId', 'uuid', NULL),
|
||
|
|
('card_tag', 'id', 'uuid', NULL),
|
||
|
|
('card_tag', 'cardId', 'uuid', NULL),
|
||
|
|
('card_tag', 'tagId', 'uuid', NULL),
|
||
|
|
('content_key', 'id', 'uuid', NULL),
|
||
|
|
('content_key', 'studysetId', 'uuid', NULL),
|
||
|
|
('content_key', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('feedback_decision', 'id', 'uuid', NULL),
|
||
|
|
('feedback_decision', 'threadId', 'uuid', NULL),
|
||
|
|
('feedback_message', 'id', 'uuid', NULL),
|
||
|
|
('feedback_message', 'threadId', 'uuid', NULL),
|
||
|
|
('feedback_thread', 'id', 'uuid', NULL),
|
||
|
|
('feedback_thread', 'publicationId', 'uuid', NULL),
|
||
|
|
('learning_path', 'id', 'uuid', NULL),
|
||
|
|
('learning_path', 'studysetId', 'uuid', NULL),
|
||
|
|
('learning_path_answer', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_answer', 'stepId', 'uuid', NULL),
|
||
|
|
('learning_path_answer', 'answeredAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('learning_path_step', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_step', 'pathId', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'stepId', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'parents', 'json', NULL),
|
||
|
|
('learning_path_step_revision', 'authorId', 'uuid', NULL),
|
||
|
|
('learning_path_step_revision', 'reportId', 'uuid', NULL),
|
||
|
|
('learning_path_tag', 'id', 'uuid', NULL),
|
||
|
|
('learning_path_tag', 'pathId', 'uuid', NULL),
|
||
|
|
('learning_path_tag', 'tagId', 'uuid', NULL),
|
||
|
|
('note', 'id', 'uuid', NULL),
|
||
|
|
('note', 'studysetId', 'uuid', NULL),
|
||
|
|
('note_revision', 'id', 'uuid', NULL),
|
||
|
|
('note_revision', 'noteId', 'uuid', NULL),
|
||
|
|
('note_revision', 'parents', 'json', NULL),
|
||
|
|
('note_revision', 'authorId', 'uuid', NULL),
|
||
|
|
('note_revision', 'reportId', 'uuid', NULL),
|
||
|
|
('note_tag', 'id', 'uuid', NULL),
|
||
|
|
('note_tag', 'noteId', 'uuid', NULL),
|
||
|
|
('note_tag', 'tagId', 'uuid', NULL),
|
||
|
|
('pdf_reading', 'id', 'uuid', NULL),
|
||
|
|
('pdf_reading', 'pdfSourceId', 'uuid', NULL),
|
||
|
|
('pdf_reading', 'readAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('pdf_source', 'id', 'uuid', NULL),
|
||
|
|
('pdf_source', 'studysetId', 'uuid', NULL),
|
||
|
|
('person_settings', 'id', 'uuid', NULL),
|
||
|
|
('review_log', 'id', 'uuid', NULL),
|
||
|
|
('review_log', 'cardId', 'uuid', NULL),
|
||
|
|
('review_log', 'reviewedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'id', 'uuid', NULL),
|
||
|
|
('studyset', 'parentId', 'uuid', NULL),
|
||
|
|
('studyset', 'archivedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'deletedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'starredAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'updatedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('tag', 'id', '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_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_learn
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('halkyon_learn', '20261025184004860-assistant-conversations', (unixepoch('now', 'subsecond') * 1000))
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261025184004860-assistant-conversations', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR halkyon_base
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('halkyon_base', '20261025165102522-assistants', (unixepoch('now', 'subsecond') * 1000))
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261025165102522-assistants', "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;
|
||
|
|
''';
|
||
|
|
}
|