1444 lines
66 KiB
Dart
1444 lines
66 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 _Migration20261002191122122_notes implements MigrationVersionSql {
|
||
|
|
@override
|
||
|
|
String get version => '20261002191122122-notes';
|
||
|
|
|
||
|
|
@override
|
||
|
|
String get moduleName => 'halkyon_learn';
|
||
|
|
|
||
|
|
@override
|
||
|
|
String get migrationSql => '''BEGIN;
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
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");
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
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");
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
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");
|
||
|
|
|
||
|
|
--
|
||
|
|
-- 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),
|
||
|
|
('card', 'id', 'uuid', NULL),
|
||
|
|
('card', 'studysetId', 'uuid', 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),
|
||
|
|
('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),
|
||
|
|
('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', 'starredAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'updatedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('tag', 'id', 'uuid', NULL),
|
||
|
|
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
|
||
|
|
('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL),
|
||
|
|
('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_future_call', 'scheduling', 'json', NULL),
|
||
|
|
('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_health_metric', 'isHealthy', 'boolean', NULL),
|
||
|
|
('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_message_log', 'slow', 'boolean', NULL),
|
||
|
|
('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_query_log', 'slow', 'boolean', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logSettings', 'json', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL),
|
||
|
|
('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_session_log', 'slow', 'boolean', NULL),
|
||
|
|
('serverpod_session_log', 'isOpen', 'boolean', NULL),
|
||
|
|
('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_auth_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),
|
||
|
|
('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', '20261002191122122-notes', (unixepoch('now', 'subsecond') * 1000))
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261002191122122-notes', "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 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 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,
|
||
|
|
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 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 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,
|
||
|
|
"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 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 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),
|
||
|
|
('card', 'id', 'uuid', NULL),
|
||
|
|
('card', 'studysetId', 'uuid', 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),
|
||
|
|
('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),
|
||
|
|
('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', 'starredAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('studyset', 'updatedAt', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('tag', 'id', 'uuid', NULL),
|
||
|
|
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
|
||
|
|
('serverpod_cloud_storage_direct_download', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_cloud_storage_direct_upload', 'preventOverwrite', 'boolean', NULL),
|
||
|
|
('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_future_call', 'scheduling', 'json', NULL),
|
||
|
|
('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_health_metric', 'isHealthy', 'boolean', NULL),
|
||
|
|
('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_message_log', 'slow', 'boolean', NULL),
|
||
|
|
('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_query_log', 'slow', 'boolean', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logSettings', 'json', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL),
|
||
|
|
('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL),
|
||
|
|
('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_session_log', 'slow', 'boolean', NULL),
|
||
|
|
('serverpod_session_log', 'isOpen', 'boolean', NULL),
|
||
|
|
('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL),
|
||
|
|
('serverpod_auth_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),
|
||
|
|
('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', '20261002191122122-notes', (unixepoch('now', 'subsecond') * 1000))
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261002191122122-notes', "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 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;
|
||
|
|
''';
|
||
|
|
}
|