chore: Add the generated code and migrations that were gitignored (#102)
This commit is contained in:
parent
e89f9f8561
commit
20b23a1a9c
6 changed files with 108827 additions and 101 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,951 @@
|
|||
BEGIN;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "address" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"street" TEXT NOT NULL,
|
||||
"inhabitantId" BLOB,
|
||||
CONSTRAINT "address_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "address_fk_1" FOREIGN KEY ("inhabitantId") REFERENCES "person" ("id") ON DELETE RESTRICT ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "address__inhabitantId__unique_idx" ON "address" ("inhabitantId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "city" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
CONSTRAINT "city_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "company" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"townId" BLOB NOT NULL DEFAULT (X'550e8400e29b41d4a716446655440000'),
|
||||
CONSTRAINT "company_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "company_fk_1" FOREIGN KEY ("townId") REFERENCES "town" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_cascade_middle" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"rootId" BLOB,
|
||||
CONSTRAINT "fk_chain_cascade_middle_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_cascade_middle_fk_1" FOREIGN KEY ("rootId") REFERENCES "fk_chain_root" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_middle_cascade_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"restrictBlockerId" BLOB,
|
||||
CONSTRAINT "fk_chain_middle_cascade_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_middle_cascade_child_fk_1" FOREIGN KEY ("restrictBlockerId") REFERENCES "fk_chain_restrict_blocker" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_middle_set_null_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"restrictBlockerId" BLOB,
|
||||
CONSTRAINT "fk_chain_middle_set_null_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_middle_set_null_child_fk_1" FOREIGN KEY ("restrictBlockerId") REFERENCES "fk_chain_restrict_blocker" ("id") ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_restrict_blocker" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"cascadeMiddleId" BLOB,
|
||||
CONSTRAINT "fk_chain_restrict_blocker_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_restrict_blocker_fk_1" FOREIGN KEY ("cascadeMiddleId") REFERENCES "fk_chain_cascade_middle" ("id") ON DELETE RESTRICT ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_root" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
CONSTRAINT "fk_chain_root_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_set_null_cascade_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"setNullMiddleId" BLOB,
|
||||
CONSTRAINT "fk_chain_set_null_cascade_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_set_null_cascade_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_set_null_middle" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"cascadeMiddleId" BLOB,
|
||||
CONSTRAINT "fk_chain_set_null_middle_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_set_null_middle_fk_1" FOREIGN KEY ("cascadeMiddleId") REFERENCES "fk_chain_cascade_middle" ("id") ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_set_null_restrict_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"setNullMiddleId" BLOB,
|
||||
CONSTRAINT "fk_chain_set_null_restrict_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_set_null_restrict_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE RESTRICT ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "fk_chain_set_null_set_null_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"setNullMiddleId" BLOB,
|
||||
CONSTRAINT "fk_chain_set_null_set_null_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "fk_chain_set_null_set_null_child_fk_1" FOREIGN KEY ("setNullMiddleId") REFERENCES "fk_chain_set_null_middle" ("id") ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "organization" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"cityId" BLOB,
|
||||
CONSTRAINT "organization_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "organization_fk_1" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "person" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"surname" TEXT,
|
||||
"organizationId" BLOB,
|
||||
"oldCompanyId" BLOB,
|
||||
"_cityCitizensCityId" BLOB,
|
||||
CONSTRAINT "person_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "person_fk_1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "person_fk_2" FOREIGN KEY ("oldCompanyId") REFERENCES "company" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "person_fk_3" FOREIGN KEY ("_cityCitizensCityId") REFERENCES "city" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "required_set_null_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"parentId" BLOB NOT NULL,
|
||||
CONSTRAINT "required_set_null_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "required_set_null_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "restrict_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"parentId" BLOB,
|
||||
CONSTRAINT "restrict_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "restrict_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE RESTRICT ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "town" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"cityId" BLOB,
|
||||
"mayorId" BLOB,
|
||||
CONSTRAINT "town_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "town_fk_1" FOREIGN KEY ("cityId") REFERENCES "city" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "town_fk_2" FOREIGN KEY ("mayorId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "types" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"aBool" INTEGER NOT NULL,
|
||||
"aDateTime" INTEGER NOT NULL,
|
||||
"aText" TEXT NOT NULL,
|
||||
"anInt" INTEGER NOT NULL,
|
||||
"anInt64" TEXT NOT NULL,
|
||||
"aReal" REAL NOT NULL,
|
||||
"aBlob" BLOB NOT NULL,
|
||||
"anEnum" INTEGER,
|
||||
"optionalText" TEXT,
|
||||
"optionalUuid" BLOB,
|
||||
CONSTRAINT "types_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX "types_a_text_idx" ON "types" ("aText");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
CONSTRAINT "unique_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique__scopeId__name__unique_idx" ON "unique" ("scopeId", "name");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_composite" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"scope" TEXT NOT NULL,
|
||||
"value" TEXT NOT NULL,
|
||||
CONSTRAINT "unique_composite_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_composite__scopeId__scope__value__unique_idx" ON "unique_composite" ("scopeId", "scope", "value");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_discriminator" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"categoryId" INTEGER NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
CONSTRAINT "unique_discriminator_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_discriminator__scopeId__categoryId__name__unique_idx" ON "unique_discriminator" ("scopeId", "categoryId", "name");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_no_release" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"categoryId" INTEGER NOT NULL,
|
||||
CONSTRAINT "unique_no_release_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_no_release__scopeId__categoryId__unique_idx" ON "unique_no_release" ("scopeId", "categoryId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_set_null_child" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"name" TEXT NOT NULL,
|
||||
"parentId" BLOB,
|
||||
CONSTRAINT "unique_set_null_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "unique_set_null_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_set_null_child__parentId__unique_idx" ON "unique_set_null_child" ("parentId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_uuid" (
|
||||
"id" BLOB PRIMARY KEY DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"scopeId" INTEGER,
|
||||
"value" BLOB NOT NULL,
|
||||
CONSTRAINT "unique_uuid_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_uuid__scopeId__value__unique_idx" ON "unique_uuid" ("scopeId", "value");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_cloud_storage" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"storageId" TEXT NOT NULL,
|
||||
"path" TEXT NOT NULL,
|
||||
"addedTime" INTEGER NOT NULL,
|
||||
"expiration" INTEGER,
|
||||
"byteData" BLOB NOT NULL,
|
||||
"verified" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_cloud_storage_path_idx" ON "serverpod_cloud_storage" ("storageId", "path");
|
||||
CREATE INDEX "serverpod_cloud_storage_expiration" ON "serverpod_cloud_storage" ("expiration");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_cloud_storage_direct_upload" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"storageId" TEXT NOT NULL,
|
||||
"path" TEXT NOT NULL,
|
||||
"expiration" INTEGER NOT NULL,
|
||||
"authKey" TEXT NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_cloud_storage_direct_upload_storage_path" ON "serverpod_cloud_storage_direct_upload" ("storageId", "path");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_future_call" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL,
|
||||
"time" INTEGER NOT NULL,
|
||||
"serializedObject" TEXT,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"identifier" TEXT,
|
||||
"scheduling" TEXT
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX "serverpod_future_call_time_idx" ON "serverpod_future_call" ("time");
|
||||
CREATE INDEX "serverpod_future_call_serverId_idx" ON "serverpod_future_call" ("serverId");
|
||||
CREATE INDEX "serverpod_future_call_identifier_idx" ON "serverpod_future_call" ("identifier");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_future_call_claim" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"futureCallId" INTEGER,
|
||||
"lastHeartbeatTime" INTEGER NOT NULL,
|
||||
CONSTRAINT "serverpod_future_call_claim_fk_0" FOREIGN KEY ("futureCallId") REFERENCES "serverpod_future_call" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "future_call_unique_idx" ON "serverpod_future_call_claim" ("futureCallId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_health_connection_info" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"timestamp" INTEGER NOT NULL,
|
||||
"active" INTEGER NOT NULL,
|
||||
"closing" INTEGER NOT NULL,
|
||||
"idle" INTEGER NOT NULL,
|
||||
"granularity" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_health_connection_info_timestamp_idx" ON "serverpod_health_connection_info" ("timestamp", "serverId", "granularity");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_health_metric" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"timestamp" INTEGER NOT NULL,
|
||||
"isHealthy" INTEGER NOT NULL,
|
||||
"value" REAL NOT NULL,
|
||||
"granularity" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_health_metric_timestamp_idx" ON "serverpod_health_metric" ("timestamp", "serverId", "name", "granularity");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_log" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"sessionLogId" INTEGER NOT NULL,
|
||||
"messageId" INTEGER,
|
||||
"reference" TEXT,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"time" INTEGER NOT NULL,
|
||||
"logLevel" INTEGER NOT NULL,
|
||||
"message" TEXT NOT NULL,
|
||||
"error" TEXT,
|
||||
"stackTrace" TEXT,
|
||||
"order" INTEGER NOT NULL,
|
||||
CONSTRAINT "serverpod_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX "serverpod_log_sessionLogId_idx" ON "serverpod_log" ("sessionLogId", "order");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_message_log" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"sessionLogId" INTEGER NOT NULL,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"messageId" INTEGER NOT NULL,
|
||||
"endpoint" TEXT NOT NULL,
|
||||
"messageName" TEXT NOT NULL,
|
||||
"duration" REAL NOT NULL,
|
||||
"error" TEXT,
|
||||
"stackTrace" TEXT,
|
||||
"slow" INTEGER NOT NULL,
|
||||
"order" INTEGER NOT NULL,
|
||||
CONSTRAINT "serverpod_message_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX "serverpod_message_log_sessionLogId_idx" ON "serverpod_message_log" ("sessionLogId", "order");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_method" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"endpoint" TEXT NOT NULL,
|
||||
"method" TEXT NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_method_endpoint_method_idx" ON "serverpod_method" ("endpoint", "method");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_migrations" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"module" TEXT NOT NULL,
|
||||
"version" TEXT NOT NULL,
|
||||
"timestamp" INTEGER
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_migrations_ids" ON "serverpod_migrations" ("module");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_query_log" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"sessionLogId" INTEGER NOT NULL,
|
||||
"messageId" INTEGER,
|
||||
"query" TEXT NOT NULL,
|
||||
"duration" REAL NOT NULL,
|
||||
"numRows" INTEGER,
|
||||
"error" TEXT,
|
||||
"stackTrace" TEXT,
|
||||
"slow" INTEGER NOT NULL,
|
||||
"order" INTEGER NOT NULL,
|
||||
CONSTRAINT "serverpod_query_log_fk_0" FOREIGN KEY ("sessionLogId") REFERENCES "serverpod_session_log" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX "serverpod_query_log_sessionLogId_idx" ON "serverpod_query_log" ("sessionLogId", "order");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_readwrite_test" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"number" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_runtime_settings" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"logSettings" TEXT NOT NULL,
|
||||
"logSettingsOverrides" TEXT NOT NULL,
|
||||
"logServiceCalls" INTEGER NOT NULL,
|
||||
"logMalformedCalls" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "serverpod_session_log" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"serverId" TEXT NOT NULL,
|
||||
"time" INTEGER NOT NULL,
|
||||
"module" TEXT,
|
||||
"endpoint" TEXT,
|
||||
"method" TEXT,
|
||||
"duration" REAL,
|
||||
"numQueries" INTEGER,
|
||||
"slow" INTEGER,
|
||||
"error" TEXT,
|
||||
"stackTrace" TEXT,
|
||||
"authenticatedUserId" INTEGER,
|
||||
"userId" TEXT,
|
||||
"isOpen" INTEGER,
|
||||
"touched" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX "serverpod_session_log_serverid_idx" ON "serverpod_session_log" ("serverId");
|
||||
CREATE INDEX "serverpod_session_log_time_idx" ON "serverpod_session_log" ("time");
|
||||
CREATE INDEX "serverpod_session_log_touched_idx" ON "serverpod_session_log" ("touched");
|
||||
CREATE INDEX "serverpod_session_log_isopen_idx" ON "serverpod_session_log" ("isOpen");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
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");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
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
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "serverpod_auth_profile_user_profile_email_auth_user_id" ON "serverpod_auth_core_profile" ("authUserId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
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;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
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;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
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;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_data_fields" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"hlcDatetime" INTEGER NOT NULL,
|
||||
"hlcCounter" INTEGER NOT NULL,
|
||||
"rowId" INTEGER NOT NULL,
|
||||
"columnId" INTEGER NOT NULL,
|
||||
"nodeId" INTEGER NOT NULL,
|
||||
CONSTRAINT "crdt_data_fields_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "crdt_data_fields_fk_1" FOREIGN KEY ("columnId") REFERENCES "crdt_schema_columns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "crdt_data_fields_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_data_fields_row_column_idx" ON "crdt_data_fields" ("rowId", "columnId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_data_foreign_key" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"fieldId" INTEGER NOT NULL,
|
||||
"attemptedValue" BLOB,
|
||||
"visibleValue" BLOB,
|
||||
"overrideReason" INTEGER,
|
||||
CONSTRAINT "crdt_data_foreign_key_fk_0" FOREIGN KEY ("fieldId") REFERENCES "crdt_data_fields" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_data_foreign_key_field_idx" ON "crdt_data_foreign_key" ("fieldId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_data_rows" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"hlcDatetime" INTEGER NOT NULL,
|
||||
"hlcCounter" INTEGER NOT NULL,
|
||||
"scopeId" INTEGER NOT NULL,
|
||||
"tblId" INTEGER NOT NULL,
|
||||
"uuidRowId" BLOB NOT NULL,
|
||||
"nodeId" INTEGER NOT NULL,
|
||||
"visibility" INTEGER NOT NULL DEFAULT (0),
|
||||
CONSTRAINT "crdt_data_rows_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "crdt_data_rows_fk_1" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "crdt_data_rows_fk_2" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_data_rows_scope_tbl_row_idx" ON "crdt_data_rows" ("scopeId", "tblId", "uuidRowId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_data_tombstone" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"hlcDatetime" INTEGER NOT NULL,
|
||||
"hlcCounter" INTEGER NOT NULL,
|
||||
"rowId" INTEGER NOT NULL,
|
||||
"nodeId" INTEGER NOT NULL,
|
||||
"clFlag" INTEGER NOT NULL,
|
||||
"reason" INTEGER NOT NULL,
|
||||
CONSTRAINT "crdt_data_tombstone_fk_0" FOREIGN KEY ("rowId") REFERENCES "crdt_data_rows" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "crdt_data_tombstone_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_data_tombstone_row_idx" ON "crdt_data_tombstone" ("rowId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_nodes" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"uuidNodeId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"lastHlc" BLOB
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_nodes__uuidNodeId__unique_idx" ON "crdt_nodes" ("uuidNodeId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_schema_columns" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"tblId" INTEGER NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
CONSTRAINT "crdt_schema_columns_fk_0" FOREIGN KEY ("tblId") REFERENCES "crdt_schema_tables" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_schema_columns_table_column_idx" ON "crdt_schema_columns" ("tblId", "name");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_schema_tables" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_schema_tables__name__unique_idx" ON "crdt_schema_tables" ("name");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_scope_members" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"scopeId" INTEGER NOT NULL,
|
||||
"userUuid" BLOB NOT NULL,
|
||||
"role" TEXT NOT NULL,
|
||||
CONSTRAINT "crdt_scope_members_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_scope_member_unique_idx" ON "crdt_scope_members" ("userUuid", "scopeId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_scope_nodes" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"scopeId" INTEGER NOT NULL,
|
||||
"nodeId" INTEGER NOT NULL,
|
||||
"lastReceivedHlc" BLOB,
|
||||
CONSTRAINT "crdt_scope_nodes_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "crdt_scope_nodes_fk_1" FOREIGN KEY ("nodeId") REFERENCES "crdt_nodes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_scope_node_unique_idx" ON "crdt_scope_nodes" ("scopeId", "nodeId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_scopes" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"uuidScopeId" BLOB NOT NULL DEFAULT (unhex(printf('%012x', CAST(unixepoch('now', 'subsecond') * 1000 AS INTEGER)) || '7' || substr(hex(randomblob(2)), 2, 3) || substr('89AB', 1 + (abs(random()) % 4), 1) || substr(hex(randomblob(8)), 2, 15))),
|
||||
"currentNodeId" INTEGER,
|
||||
CONSTRAINT "crdt_scopes_fk_0" FOREIGN KEY ("currentNodeId") REFERENCES "crdt_nodes" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_scopes__uuidScopeId__unique_idx" ON "crdt_scopes" ("uuidScopeId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "crdt_sync_integrity_violations" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"type" TEXT NOT NULL,
|
||||
"domainTableName" TEXT NOT NULL,
|
||||
"uuidRowId" BLOB NOT NULL,
|
||||
"ownerScopeUuid" BLOB,
|
||||
"incomingScopeUuid" BLOB NOT NULL,
|
||||
"operation" TEXT NOT NULL,
|
||||
"uuidNodeId" BLOB,
|
||||
"crdtDataRowId" INTEGER,
|
||||
"hlcDatetime" INTEGER,
|
||||
"hlcCounter" INTEGER,
|
||||
"firstSeenAt" INTEGER NOT NULL,
|
||||
"lastSeenAt" INTEGER NOT NULL,
|
||||
"occurrences" INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "crdt_sync_integrity_violations_key_idx" ON "crdt_sync_integrity_violations" ("type", "operation", "domainTableName", "uuidRowId", "ownerScopeUuid", "incomingScopeUuid");
|
||||
|
||||
--
|
||||
-- STORE COLUMN TYPES FOR MIGRATIONS
|
||||
--
|
||||
DROP TABLE IF EXISTS "serverpod_sqlite_schema";
|
||||
|
||||
CREATE TABLE "serverpod_sqlite_schema" (
|
||||
"table_name" TEXT NOT NULL,
|
||||
"column_name" TEXT NOT NULL,
|
||||
"column_type" TEXT NOT NULL,
|
||||
"column_vector_dimension" INTEGER,
|
||||
PRIMARY KEY ("table_name", "column_name")
|
||||
);
|
||||
|
||||
INSERT INTO "serverpod_sqlite_schema" VALUES
|
||||
('address', 'id', 'uuid', NULL),
|
||||
('address', 'inhabitantId', 'uuid', NULL),
|
||||
('city', 'id', 'uuid', NULL),
|
||||
('company', 'id', 'uuid', NULL),
|
||||
('company', 'townId', 'uuid', NULL),
|
||||
('fk_chain_cascade_middle', 'id', 'uuid', NULL),
|
||||
('fk_chain_cascade_middle', 'rootId', 'uuid', NULL),
|
||||
('fk_chain_middle_cascade_child', 'id', 'uuid', NULL),
|
||||
('fk_chain_middle_cascade_child', 'restrictBlockerId', 'uuid', NULL),
|
||||
('fk_chain_middle_set_null_child', 'id', 'uuid', NULL),
|
||||
('fk_chain_middle_set_null_child', 'restrictBlockerId', 'uuid', NULL),
|
||||
('fk_chain_restrict_blocker', 'id', 'uuid', NULL),
|
||||
('fk_chain_restrict_blocker', 'cascadeMiddleId', 'uuid', NULL),
|
||||
('fk_chain_root', 'id', 'uuid', NULL),
|
||||
('fk_chain_set_null_cascade_child', 'id', 'uuid', NULL),
|
||||
('fk_chain_set_null_cascade_child', 'setNullMiddleId', 'uuid', NULL),
|
||||
('fk_chain_set_null_middle', 'id', 'uuid', NULL),
|
||||
('fk_chain_set_null_middle', 'cascadeMiddleId', 'uuid', NULL),
|
||||
('fk_chain_set_null_restrict_child', 'id', 'uuid', NULL),
|
||||
('fk_chain_set_null_restrict_child', 'setNullMiddleId', 'uuid', NULL),
|
||||
('fk_chain_set_null_set_null_child', 'id', 'uuid', NULL),
|
||||
('fk_chain_set_null_set_null_child', 'setNullMiddleId', 'uuid', NULL),
|
||||
('organization', 'id', 'uuid', NULL),
|
||||
('organization', 'cityId', 'uuid', NULL),
|
||||
('person', 'id', 'uuid', NULL),
|
||||
('person', 'organizationId', 'uuid', NULL),
|
||||
('person', 'oldCompanyId', 'uuid', NULL),
|
||||
('person', '_cityCitizensCityId', 'uuid', NULL),
|
||||
('required_set_null_child', 'id', 'uuid', NULL),
|
||||
('required_set_null_child', 'parentId', 'uuid', NULL),
|
||||
('restrict_child', 'id', 'uuid', NULL),
|
||||
('restrict_child', 'parentId', 'uuid', NULL),
|
||||
('town', 'id', 'uuid', NULL),
|
||||
('town', 'cityId', 'uuid', NULL),
|
||||
('town', 'mayorId', 'uuid', NULL),
|
||||
('types', 'id', 'uuid', NULL),
|
||||
('types', 'aBool', 'boolean', NULL),
|
||||
('types', 'aDateTime', 'timestampWithoutTimeZone', NULL),
|
||||
('types', 'optionalUuid', 'uuid', NULL),
|
||||
('unique', 'id', 'uuid', NULL),
|
||||
('unique_composite', 'id', 'uuid', NULL),
|
||||
('unique_discriminator', 'id', 'uuid', NULL),
|
||||
('unique_no_release', 'id', 'uuid', NULL),
|
||||
('unique_set_null_child', 'id', 'uuid', NULL),
|
||||
('unique_set_null_child', 'parentId', 'uuid', NULL),
|
||||
('unique_uuid', 'id', 'uuid', NULL),
|
||||
('unique_uuid', 'value', 'uuid', NULL),
|
||||
('serverpod_cloud_storage', 'addedTime', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_cloud_storage', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_cloud_storage', 'verified', 'boolean', NULL),
|
||||
('serverpod_cloud_storage_direct_upload', 'expiration', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_future_call', 'time', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_future_call', 'scheduling', 'json', NULL),
|
||||
('serverpod_future_call_claim', 'lastHeartbeatTime', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_health_connection_info', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_health_metric', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_health_metric', 'isHealthy', 'boolean', NULL),
|
||||
('serverpod_log', 'time', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_message_log', 'slow', 'boolean', NULL),
|
||||
('serverpod_migrations', 'timestamp', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_query_log', 'slow', 'boolean', NULL),
|
||||
('serverpod_runtime_settings', 'logSettings', 'json', NULL),
|
||||
('serverpod_runtime_settings', 'logSettingsOverrides', 'json', NULL),
|
||||
('serverpod_runtime_settings', 'logServiceCalls', 'boolean', NULL),
|
||||
('serverpod_runtime_settings', 'logMalformedCalls', 'boolean', NULL),
|
||||
('serverpod_session_log', 'time', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_session_log', 'slow', 'boolean', NULL),
|
||||
('serverpod_session_log', 'isOpen', 'boolean', NULL),
|
||||
('serverpod_session_log', 'touched', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_jwt_refresh_token', 'id', 'uuid', NULL),
|
||||
('serverpod_auth_core_jwt_refresh_token', 'authUserId', 'uuid', NULL),
|
||||
('serverpod_auth_core_jwt_refresh_token', 'scopeNames', 'json', NULL),
|
||||
('serverpod_auth_core_jwt_refresh_token', 'lastUpdatedAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_jwt_refresh_token', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_profile', 'id', 'uuid', NULL),
|
||||
('serverpod_auth_core_profile', 'authUserId', 'uuid', NULL),
|
||||
('serverpod_auth_core_profile', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_profile', 'imageId', 'uuid', NULL),
|
||||
('serverpod_auth_core_profile_image', 'id', 'uuid', NULL),
|
||||
('serverpod_auth_core_profile_image', 'userProfileId', 'uuid', NULL),
|
||||
('serverpod_auth_core_profile_image', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_session', 'id', 'uuid', NULL),
|
||||
('serverpod_auth_core_session', 'authUserId', 'uuid', NULL),
|
||||
('serverpod_auth_core_session', 'scopeNames', 'json', NULL),
|
||||
('serverpod_auth_core_session', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_session', 'lastUsedAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_session', 'expiresAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_user', 'id', 'uuid', NULL),
|
||||
('serverpod_auth_core_user', 'createdAt', 'timestampWithoutTimeZone', NULL),
|
||||
('serverpod_auth_core_user', 'scopeNames', 'json', NULL),
|
||||
('serverpod_auth_core_user', 'blocked', 'boolean', NULL),
|
||||
('crdt_data_fields', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
|
||||
('crdt_data_foreign_key', 'attemptedValue', 'uuid', NULL),
|
||||
('crdt_data_foreign_key', 'visibleValue', 'uuid', NULL),
|
||||
('crdt_data_rows', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
|
||||
('crdt_data_rows', 'uuidRowId', 'uuid', NULL),
|
||||
('crdt_data_tombstone', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
|
||||
('crdt_nodes', 'uuidNodeId', 'uuid', NULL),
|
||||
('crdt_nodes', 'lastHlc', 'jsonb', NULL),
|
||||
('crdt_scope_members', 'userUuid', 'uuid', NULL),
|
||||
('crdt_scope_nodes', 'lastReceivedHlc', 'jsonb', NULL),
|
||||
('crdt_scopes', 'uuidScopeId', 'uuid', NULL),
|
||||
('crdt_sync_integrity_violations', 'uuidRowId', 'uuid', NULL),
|
||||
('crdt_sync_integrity_violations', 'ownerScopeUuid', 'uuid', NULL),
|
||||
('crdt_sync_integrity_violations', 'incomingScopeUuid', 'uuid', NULL),
|
||||
('crdt_sync_integrity_violations', 'uuidNodeId', 'uuid', NULL),
|
||||
('crdt_sync_integrity_violations', 'hlcDatetime', 'timestampWithoutTimeZone', NULL),
|
||||
('crdt_sync_integrity_violations', 'firstSeenAt', 'timestampWithoutTimeZone', NULL),
|
||||
('crdt_sync_integrity_violations', 'lastSeenAt', 'timestampWithoutTimeZone', NULL);
|
||||
|
||||
--
|
||||
-- MIGRATION VERSION FOR serverpod_offline_sync_test
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_offline_sync_test', '20260703114649226', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260703114649226', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
--
|
||||
-- MIGRATION VERSION FOR serverpod
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod', '20260416151914983-insights-perf', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260416151914983-insights-perf', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
--
|
||||
-- MIGRATION VERSION FOR serverpod_auth_core
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_auth_core', '20260417182253191', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260417182253191', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
--
|
||||
-- MIGRATION VERSION FOR serverpod_offline_sync
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_offline_sync', '20260703114646971', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260703114646971', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
### AUTOMATICALLY GENERATED DO NOT MODIFY
|
||||
###
|
||||
### This file is generated by Serverpod when creating a migration, do not modify it
|
||||
### manually. If a collision is detected in this file when doing a code merge, resolve
|
||||
### the conflict by removing and recreating the conflicting migration.
|
||||
|
||||
20260703114649226
|
||||
Loading…
Reference in a new issue