test: Make the DST more robust (#116)
This commit is contained in:
parent
2a6d66c79e
commit
574f8d067a
11 changed files with 63267 additions and 720 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
|
|
@ -0,0 +1,430 @@
|
|||
{
|
||||
"__className__": "serverpod.DatabaseMigration",
|
||||
"actions": [
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "unique_fk_pair",
|
||||
"dartName": "UniqueFkPair",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "leftId",
|
||||
"fieldName": "leftId",
|
||||
"columnType": 7,
|
||||
"isNullable": true,
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "rightId",
|
||||
"fieldName": "rightId",
|
||||
"columnType": 7,
|
||||
"isNullable": true,
|
||||
"dartType": "UuidValue?"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_fk_pair_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_fk_pair_fk_1",
|
||||
"columns": [
|
||||
"leftId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 3,
|
||||
"deferrable": "initiallyDeferred"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_fk_pair_fk_2",
|
||||
"columns": [
|
||||
"rightId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 0,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_fk_pair_parents",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "leftId"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "rightId"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "unique_mixed_fk",
|
||||
"dartName": "UniqueMixedFk",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "parentId",
|
||||
"fieldName": "parentId",
|
||||
"columnType": 7,
|
||||
"isNullable": true,
|
||||
"dartType": "UuidValue?"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_mixed_fk_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_mixed_fk_fk_1",
|
||||
"columns": [
|
||||
"parentId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_mixed_fk_name_parent",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "scopeId"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "name"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "parentId"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "unique_nullable",
|
||||
"dartName": "UniqueNullable",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "value",
|
||||
"fieldName": "value",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_nullable_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_nullable__scopeId__value__unique_idx",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "scopeId"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "value"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "unique_overlapping",
|
||||
"dartName": "UniqueOverlapping",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "first",
|
||||
"fieldName": "first",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "second",
|
||||
"fieldName": "second",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "third",
|
||||
"fieldName": "third",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_overlapping_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_overlapping_first_second",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "scopeId"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "first"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "second"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_overlapping_second_third",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "scopeId"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "second"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "third"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"warnings": [],
|
||||
"migrationApiVersion": 1
|
||||
}
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
BEGIN;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_fk_pair" (
|
||||
"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,
|
||||
"leftId" BLOB,
|
||||
"rightId" BLOB,
|
||||
CONSTRAINT "unique_fk_pair_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "unique_fk_pair_fk_1" FOREIGN KEY ("leftId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED,
|
||||
CONSTRAINT "unique_fk_pair_fk_2" FOREIGN KEY ("rightId") REFERENCES "person" ("id") ON DELETE SET NULL ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_fk_pair_parents" ON "unique_fk_pair" ("leftId", "rightId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_mixed_fk" (
|
||||
"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_mixed_fk_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "unique_mixed_fk_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_mixed_fk_name_parent" ON "unique_mixed_fk" ("scopeId", "name", "parentId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_nullable" (
|
||||
"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" INTEGER,
|
||||
CONSTRAINT "unique_nullable_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_nullable__scopeId__value__unique_idx" ON "unique_nullable" ("scopeId", "value");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_overlapping" (
|
||||
"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,
|
||||
"first" TEXT NOT NULL,
|
||||
"second" TEXT NOT NULL,
|
||||
"third" TEXT NOT NULL,
|
||||
CONSTRAINT "unique_overlapping_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_overlapping_first_second" ON "unique_overlapping" ("scopeId", "first", "second");
|
||||
CREATE UNIQUE INDEX "unique_overlapping_second_third" ON "unique_overlapping" ("scopeId", "second", "third");
|
||||
|
||||
--
|
||||
-- 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', 'cityId', '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_cascade_child', 'id', 'uuid', NULL),
|
||||
('unique_cascade_child', 'parentId', 'uuid', NULL),
|
||||
('unique_composite', 'id', 'uuid', NULL),
|
||||
('unique_discriminator', 'id', 'uuid', NULL),
|
||||
('unique_fk_pair', 'id', 'uuid', NULL),
|
||||
('unique_fk_pair', 'leftId', 'uuid', NULL),
|
||||
('unique_fk_pair', 'rightId', 'uuid', NULL),
|
||||
('unique_mixed_fk', 'id', 'uuid', NULL),
|
||||
('unique_mixed_fk', 'parentId', 'uuid', NULL),
|
||||
('unique_no_release', 'id', 'uuid', NULL),
|
||||
('unique_nullable', 'id', 'uuid', NULL),
|
||||
('unique_overlapping', '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_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_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_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),
|
||||
('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', '20260907165715131', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260907165715131', "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_core
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_auth_core', '20260824182354731', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260824182354731', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
--
|
||||
-- MIGRATION VERSION FOR serverpod_offline_sync
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_offline_sync', '20260902195732182', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260902195732182', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
|
||||
COMMIT;
|
||||
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,433 @@
|
|||
{
|
||||
"__className__": "serverpod.DatabaseMigration",
|
||||
"actions": [
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "nullable_set_default_child",
|
||||
"dartName": "NullableSetDefaultChild",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "parentId",
|
||||
"fieldName": "parentId",
|
||||
"columnType": 7,
|
||||
"isNullable": true,
|
||||
"dartType": "UuidValue?"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "nullable_set_default_child_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "nullable_set_default_child_fk_1",
|
||||
"columns": [
|
||||
"parentId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 1,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "required_cascade_child",
|
||||
"dartName": "RequiredCascadeChild",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "parentId",
|
||||
"fieldName": "parentId",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"dartType": "UuidValue"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "required_cascade_child_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "required_cascade_child_fk_1",
|
||||
"columns": [
|
||||
"parentId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "required_no_action_child",
|
||||
"dartName": "RequiredNoActionChild",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "parentId",
|
||||
"fieldName": "parentId",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"dartType": "UuidValue"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "required_no_action_child_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "required_no_action_child_fk_1",
|
||||
"columns": [
|
||||
"parentId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 3,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "unique_cascade_reference",
|
||||
"dartName": "UniqueCascadeReference",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "parentId",
|
||||
"fieldName": "parentId",
|
||||
"columnType": 7,
|
||||
"isNullable": true,
|
||||
"dartType": "UuidValue?"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_cascade_reference_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_cascade_reference_fk_1",
|
||||
"columns": [
|
||||
"parentId"
|
||||
],
|
||||
"referenceTable": "person",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_cascade_reference__parentId__unique_idx",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "parentId"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.DatabaseMigrationAction",
|
||||
"type": "createTable",
|
||||
"createTable": {
|
||||
"__className__": "serverpod.TableDefinition",
|
||||
"name": "unique_set_default_child",
|
||||
"dartName": "UniqueSetDefaultChild",
|
||||
"module": "serverpod_offline_sync_test",
|
||||
"schema": "public",
|
||||
"columns": [
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "id",
|
||||
"fieldName": "id",
|
||||
"columnType": 7,
|
||||
"isNullable": false,
|
||||
"columnDefault": "random_v7",
|
||||
"dartType": "UuidValue?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "scopeId",
|
||||
"fieldName": "scopeId",
|
||||
"columnType": 6,
|
||||
"isNullable": true,
|
||||
"dartType": "int?"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "name",
|
||||
"fieldName": "name",
|
||||
"columnType": 0,
|
||||
"isNullable": false,
|
||||
"dartType": "String"
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ColumnDefinition",
|
||||
"name": "parentId",
|
||||
"fieldName": "parentId",
|
||||
"columnType": 7,
|
||||
"isNullable": true,
|
||||
"columnDefault": "'550e8400-e29b-41d4-a716-446655440000'",
|
||||
"dartType": "UuidValue?"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_set_default_child_fk_0",
|
||||
"columns": [
|
||||
"scopeId"
|
||||
],
|
||||
"referenceTable": "crdt_scopes",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 4
|
||||
},
|
||||
{
|
||||
"__className__": "serverpod.ForeignKeyDefinition",
|
||||
"constraintName": "unique_set_default_child_fk_1",
|
||||
"columns": [
|
||||
"parentId"
|
||||
],
|
||||
"referenceTable": "town",
|
||||
"referenceTableSchema": "public",
|
||||
"referenceColumns": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": 3,
|
||||
"onDelete": 1,
|
||||
"deferrable": "initiallyDeferred"
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"__className__": "serverpod.IndexDefinition",
|
||||
"indexName": "unique_set_default_child__parentId__unique_idx",
|
||||
"elements": [
|
||||
{
|
||||
"__className__": "serverpod.IndexElementDefinition",
|
||||
"type": 0,
|
||||
"definition": "parentId"
|
||||
}
|
||||
],
|
||||
"type": "btree",
|
||||
"isUnique": true,
|
||||
"isPrimary": false
|
||||
}
|
||||
],
|
||||
"managed": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"warnings": [],
|
||||
"migrationApiVersion": 1
|
||||
}
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
BEGIN;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "nullable_set_default_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 "nullable_set_default_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "nullable_set_default_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "required_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,
|
||||
"parentId" BLOB NOT NULL,
|
||||
CONSTRAINT "required_cascade_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "required_cascade_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "required_no_action_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_no_action_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "required_no_action_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_cascade_reference" (
|
||||
"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_cascade_reference_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "unique_cascade_reference_fk_1" FOREIGN KEY ("parentId") REFERENCES "person" ("id") ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_cascade_reference__parentId__unique_idx" ON "unique_cascade_reference" ("parentId");
|
||||
|
||||
--
|
||||
-- ACTION CREATE TABLE
|
||||
--
|
||||
CREATE TABLE "unique_set_default_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 DEFAULT (X'550e8400e29b41d4a716446655440000'),
|
||||
CONSTRAINT "unique_set_default_child_fk_0" FOREIGN KEY ("scopeId") REFERENCES "crdt_scopes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT "unique_set_default_child_fk_1" FOREIGN KEY ("parentId") REFERENCES "town" ("id") ON DELETE SET DEFAULT ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED
|
||||
) STRICT;
|
||||
|
||||
-- Indexes
|
||||
CREATE UNIQUE INDEX "unique_set_default_child__parentId__unique_idx" ON "unique_set_default_child" ("parentId");
|
||||
|
||||
--
|
||||
-- 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),
|
||||
('nullable_set_default_child', 'id', 'uuid', NULL),
|
||||
('nullable_set_default_child', 'parentId', 'uuid', NULL),
|
||||
('organization', 'id', 'uuid', NULL),
|
||||
('organization', 'cityId', 'uuid', NULL),
|
||||
('person', 'id', 'uuid', NULL),
|
||||
('person', 'organizationId', 'uuid', NULL),
|
||||
('person', 'oldCompanyId', 'uuid', NULL),
|
||||
('person', 'cityId', 'uuid', NULL),
|
||||
('required_cascade_child', 'id', 'uuid', NULL),
|
||||
('required_cascade_child', 'parentId', 'uuid', NULL),
|
||||
('required_no_action_child', 'id', 'uuid', NULL),
|
||||
('required_no_action_child', 'parentId', '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_cascade_child', 'id', 'uuid', NULL),
|
||||
('unique_cascade_child', 'parentId', 'uuid', NULL),
|
||||
('unique_cascade_reference', 'id', 'uuid', NULL),
|
||||
('unique_cascade_reference', 'parentId', 'uuid', NULL),
|
||||
('unique_composite', 'id', 'uuid', NULL),
|
||||
('unique_discriminator', 'id', 'uuid', NULL),
|
||||
('unique_fk_pair', 'id', 'uuid', NULL),
|
||||
('unique_fk_pair', 'leftId', 'uuid', NULL),
|
||||
('unique_fk_pair', 'rightId', 'uuid', NULL),
|
||||
('unique_mixed_fk', 'id', 'uuid', NULL),
|
||||
('unique_mixed_fk', 'parentId', 'uuid', NULL),
|
||||
('unique_no_release', 'id', 'uuid', NULL),
|
||||
('unique_nullable', 'id', 'uuid', NULL),
|
||||
('unique_overlapping', 'id', 'uuid', NULL),
|
||||
('unique_set_default_child', 'id', 'uuid', NULL),
|
||||
('unique_set_default_child', 'parentId', '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_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_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_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),
|
||||
('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', '20260907170602693', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260907170602693', "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_core
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_auth_core', '20260824182354731', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260824182354731', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
--
|
||||
-- MIGRATION VERSION FOR serverpod_offline_sync
|
||||
--
|
||||
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||||
VALUES ('serverpod_offline_sync', '20260902195732182', (unixepoch('now', 'subsecond') * 1000))
|
||||
ON CONFLICT ("module")
|
||||
DO UPDATE SET "version" = '20260902195732182', "timestamp" = (unixepoch('now', 'subsecond') * 1000);
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -10,3 +10,5 @@
|
|||
20260901174859443
|
||||
20260902184218563
|
||||
20260902195734685
|
||||
20260907165715131
|
||||
20260907170602693
|
||||
|
|
|
|||
Loading…
Reference in a new issue