@sphereon/ssi-sdk.data-store 0.24.0 → 0.24.1-next.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/contact/ContactStore.d.ts +3 -0
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +84 -48
- package/dist/contact/ContactStore.js.map +1 -1
- package/dist/entities/contact/BaseContactEntity.d.ts +2 -0
- package/dist/entities/contact/BaseContactEntity.d.ts.map +1 -1
- package/dist/entities/contact/BaseContactEntity.js +12 -3
- package/dist/entities/contact/BaseContactEntity.js.map +1 -1
- package/dist/entities/contact/ConnectionEntity.d.ts +2 -0
- package/dist/entities/contact/ConnectionEntity.d.ts.map +1 -1
- package/dist/entities/contact/ConnectionEntity.js +8 -0
- package/dist/entities/contact/ConnectionEntity.js.map +1 -1
- package/dist/entities/contact/ContactMetadataItemEntity.d.ts +14 -0
- package/dist/entities/contact/ContactMetadataItemEntity.d.ts.map +1 -0
- package/dist/entities/contact/ContactMetadataItemEntity.js +88 -0
- package/dist/entities/contact/ContactMetadataItemEntity.js.map +1 -0
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +2 -0
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts.map +1 -1
- package/dist/entities/contact/CorrelationIdentifierEntity.js +8 -0
- package/dist/entities/contact/CorrelationIdentifierEntity.js.map +1 -1
- package/dist/entities/contact/DidAuthConfigEntity.d.ts +2 -0
- package/dist/entities/contact/DidAuthConfigEntity.d.ts.map +1 -1
- package/dist/entities/contact/DidAuthConfigEntity.js +8 -0
- package/dist/entities/contact/DidAuthConfigEntity.js.map +1 -1
- package/dist/entities/contact/ElectronicAddressEntity.d.ts +2 -0
- package/dist/entities/contact/ElectronicAddressEntity.d.ts.map +1 -1
- package/dist/entities/contact/ElectronicAddressEntity.js +8 -0
- package/dist/entities/contact/ElectronicAddressEntity.js.map +1 -1
- package/dist/entities/contact/IMetadataEntity.d.ts +8 -0
- package/dist/entities/contact/IMetadataEntity.d.ts.map +1 -0
- package/dist/entities/contact/IMetadataEntity.js +2 -0
- package/dist/entities/contact/IMetadataEntity.js.map +1 -0
- package/dist/entities/contact/IdentityEntity.d.ts +5 -2
- package/dist/entities/contact/IdentityEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityEntity.js +13 -0
- package/dist/entities/contact/IdentityEntity.js.map +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +6 -2
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.js +19 -3
- package/dist/entities/contact/IdentityMetadataItemEntity.js.map +1 -1
- package/dist/entities/contact/NaturalPersonEntity.d.ts +2 -0
- package/dist/entities/contact/NaturalPersonEntity.d.ts.map +1 -1
- package/dist/entities/contact/NaturalPersonEntity.js +8 -0
- package/dist/entities/contact/NaturalPersonEntity.js.map +1 -1
- package/dist/entities/contact/OpenIdConfigEntity.d.ts +2 -0
- package/dist/entities/contact/OpenIdConfigEntity.d.ts.map +1 -1
- package/dist/entities/contact/OpenIdConfigEntity.js +8 -0
- package/dist/entities/contact/OpenIdConfigEntity.js.map +1 -1
- package/dist/entities/contact/OrganizationEntity.d.ts +2 -0
- package/dist/entities/contact/OrganizationEntity.d.ts.map +1 -1
- package/dist/entities/contact/OrganizationEntity.js +8 -0
- package/dist/entities/contact/OrganizationEntity.js.map +1 -1
- package/dist/entities/contact/PartyEntity.d.ts +2 -0
- package/dist/entities/contact/PartyEntity.d.ts.map +1 -1
- package/dist/entities/contact/PartyEntity.js +8 -0
- package/dist/entities/contact/PartyEntity.js.map +1 -1
- package/dist/entities/contact/PartyRelationshipEntity.d.ts +2 -0
- package/dist/entities/contact/PartyRelationshipEntity.d.ts.map +1 -1
- package/dist/entities/contact/PartyRelationshipEntity.js +8 -0
- package/dist/entities/contact/PartyRelationshipEntity.js.map +1 -1
- package/dist/entities/contact/PartyTypeEntity.js +4 -4
- package/dist/entities/contact/PartyTypeEntity.js.map +1 -1
- package/dist/entities/contact/PhysicalAddressEntity.d.ts +2 -0
- package/dist/entities/contact/PhysicalAddressEntity.d.ts.map +1 -1
- package/dist/entities/contact/PhysicalAddressEntity.js +10 -1
- package/dist/entities/contact/PhysicalAddressEntity.js.map +1 -1
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.d.ts +14 -0
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.d.ts.map +1 -0
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.js +74 -0
- package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.js.map +1 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/migrations/generic/10-CreatePresentationDefinitions.d.ts +7 -0
- package/dist/migrations/generic/10-CreatePresentationDefinitions.d.ts.map +1 -0
- package/dist/migrations/generic/10-CreatePresentationDefinitions.js +78 -0
- package/dist/migrations/generic/10-CreatePresentationDefinitions.js.map +1 -0
- package/dist/migrations/generic/8-CreateContacts.d.ts +7 -0
- package/dist/migrations/generic/8-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/generic/8-CreateContacts.js +78 -0
- package/dist/migrations/generic/8-CreateContacts.js.map +1 -0
- package/dist/migrations/generic/9-CreateContacts.d.ts +7 -0
- package/dist/migrations/generic/9-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/generic/9-CreateContacts.js +78 -0
- package/dist/migrations/generic/9-CreateContacts.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +2 -0
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +12 -2
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts.map +1 -1
- package/dist/migrations/postgres/1690925872592-CreateContacts.js +40 -3
- package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -1
- package/dist/migrations/postgres/1710438363001-CreateContacts.d.ts +7 -0
- package/dist/migrations/postgres/1710438363001-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/postgres/1710438363001-CreateContacts.js +63 -0
- package/dist/migrations/postgres/1710438363001-CreateContacts.js.map +1 -0
- package/dist/migrations/postgres/1715761125001-CreateContacts.d.ts +7 -0
- package/dist/migrations/postgres/1715761125001-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/postgres/1715761125001-CreateContacts.js +74 -0
- package/dist/migrations/postgres/1715761125001-CreateContacts.js.map +1 -0
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts +7 -0
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts.map +1 -0
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +41 -0
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js.map +1 -0
- package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts.map +1 -1
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js +40 -3
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -1
- package/dist/migrations/sqlite/1710438363002-CreateContacts.d.ts +7 -0
- package/dist/migrations/sqlite/1710438363002-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/sqlite/1710438363002-CreateContacts.js +79 -0
- package/dist/migrations/sqlite/1710438363002-CreateContacts.js.map +1 -0
- package/dist/migrations/sqlite/1715761125002-CreateContacts.d.ts +7 -0
- package/dist/migrations/sqlite/1715761125002-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/sqlite/1715761125002-CreateContacts.js +73 -0
- package/dist/migrations/sqlite/1715761125002-CreateContacts.js.map +1 -0
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts +7 -0
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts.map +1 -0
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +38 -0
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js.map +1 -0
- package/dist/presentationDefinition/AbstractPDStore.d.ts +12 -0
- package/dist/presentationDefinition/AbstractPDStore.d.ts.map +1 -0
- package/dist/presentationDefinition/AbstractPDStore.js +7 -0
- package/dist/presentationDefinition/AbstractPDStore.js.map +1 -0
- package/dist/presentationDefinition/PDStore.d.ts +19 -0
- package/dist/presentationDefinition/PDStore.d.ts.map +1 -0
- package/dist/presentationDefinition/PDStore.js +152 -0
- package/dist/presentationDefinition/PDStore.js.map +1 -0
- package/dist/types/contact/contact.d.ts +51 -15
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/contact/contact.js +12 -7
- package/dist/types/contact/contact.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/presentationDefinition/IAbstractPDStore.d.ts +17 -0
- package/dist/types/presentationDefinition/IAbstractPDStore.d.ts.map +1 -0
- package/dist/types/presentationDefinition/IAbstractPDStore.js +3 -0
- package/dist/types/presentationDefinition/IAbstractPDStore.js.map +1 -0
- package/dist/types/presentationDefinition/presentationDefinition.d.ts +16 -0
- package/dist/types/presentationDefinition/presentationDefinition.d.ts.map +1 -0
- package/dist/types/presentationDefinition/presentationDefinition.js +3 -0
- package/dist/types/presentationDefinition/presentationDefinition.js.map +1 -0
- package/dist/utils/contact/MappingUtils.d.ts +6 -4
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.js +128 -18
- package/dist/utils/contact/MappingUtils.js.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.d.ts +6 -0
- package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -0
- package/dist/utils/presentationDefinition/MappingUtils.js +48 -0
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -0
- package/package.json +7 -4
- package/src/__tests__/contact.entities.test.ts +129 -44
- package/src/__tests__/contact.store.test.ts +205 -29
- package/src/__tests__/pd-manager.entities.test.ts +71 -0
- package/src/__tests__/pd-manager.store.test.ts +191 -0
- package/src/contact/ContactStore.ts +74 -30
- package/src/entities/contact/BaseContactEntity.ts +11 -0
- package/src/entities/contact/ConnectionEntity.ts +6 -0
- package/src/entities/contact/ContactMetadataItemEntity.ts +50 -0
- package/src/entities/contact/CorrelationIdentifierEntity.ts +6 -0
- package/src/entities/contact/DidAuthConfigEntity.ts +6 -0
- package/src/entities/contact/ElectronicAddressEntity.ts +6 -0
- package/src/entities/contact/IMetadataEntity.ts +7 -0
- package/src/entities/contact/IdentityEntity.ts +11 -2
- package/src/entities/contact/IdentityMetadataItemEntity.ts +16 -4
- package/src/entities/contact/NaturalPersonEntity.ts +6 -0
- package/src/entities/contact/OpenIdConfigEntity.ts +6 -0
- package/src/entities/contact/OrganizationEntity.ts +6 -0
- package/src/entities/contact/PartyEntity.ts +6 -0
- package/src/entities/contact/PartyRelationshipEntity.ts +6 -0
- package/src/entities/contact/PartyTypeEntity.ts +4 -4
- package/src/entities/contact/PhysicalAddressEntity.ts +9 -2
- package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +43 -0
- package/src/index.ts +13 -0
- package/src/migrations/generic/10-CreatePresentationDefinitions.ts +66 -0
- package/src/migrations/generic/8-CreateContacts.ts +66 -0
- package/src/migrations/generic/9-CreateContacts.ts +66 -0
- package/src/migrations/generic/index.ts +11 -1
- package/src/migrations/index.ts +1 -0
- package/src/migrations/postgres/1690925872592-CreateContacts.ts +59 -5
- package/src/migrations/postgres/1710438363001-CreateContacts.ts +63 -0
- package/src/migrations/postgres/1715761125001-CreateContacts.ts +60 -0
- package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +25 -0
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +70 -3
- package/src/migrations/sqlite/1710438363002-CreateContacts.ts +83 -0
- package/src/migrations/sqlite/1715761125002-CreateContacts.ts +59 -0
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +24 -0
- package/src/presentationDefinition/AbstractPDStore.ts +20 -0
- package/src/presentationDefinition/PDStore.ts +185 -0
- package/src/types/contact/contact.ts +56 -15
- package/src/types/index.ts +2 -0
- package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -0
- package/src/types/presentationDefinition/presentationDefinition.ts +17 -0
- package/src/utils/contact/MappingUtils.ts +135 -19
- package/src/utils/presentationDefinition/MappingUtils.ts +52 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,0BAA0B,EAC1B,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,0BAA0B,EAC1B,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,+BAA+B,EAC/B,yCAAyC,GAC1C,MAAM,WAAW,CAAA"}
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataStoreMachineStateMigrations = exports.DataStoreDigitalCredentialMigrations = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreMigrations = void 0;
|
|
3
|
+
exports.DataStorePresentationDefinitionMigrations = exports.DataStoreMachineStateMigrations = exports.DataStoreDigitalCredentialMigrations = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreMigrations = void 0;
|
|
4
4
|
var generic_1 = require("./generic");
|
|
5
5
|
Object.defineProperty(exports, "DataStoreMigrations", { enumerable: true, get: function () { return generic_1.DataStoreMigrations; } });
|
|
6
6
|
Object.defineProperty(exports, "DataStoreEventLoggerMigrations", { enumerable: true, get: function () { return generic_1.DataStoreEventLoggerMigrations; } });
|
|
@@ -9,4 +9,5 @@ Object.defineProperty(exports, "DataStoreIssuanceBrandingMigrations", { enumerab
|
|
|
9
9
|
Object.defineProperty(exports, "DataStoreStatusListMigrations", { enumerable: true, get: function () { return generic_1.DataStoreStatusListMigrations; } });
|
|
10
10
|
Object.defineProperty(exports, "DataStoreDigitalCredentialMigrations", { enumerable: true, get: function () { return generic_1.DataStoreDigitalCredentialMigrations; } });
|
|
11
11
|
Object.defineProperty(exports, "DataStoreMachineStateMigrations", { enumerable: true, get: function () { return generic_1.DataStoreMachineStateMigrations; } });
|
|
12
|
+
Object.defineProperty(exports, "DataStorePresentationDefinitionMigrations", { enumerable: true, get: function () { return generic_1.DataStorePresentationDefinitionMigrations; } });
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AAAA,qCASkB;AARhB,8GAAA,mBAAmB,OAAA;AACnB,yHAAA,8BAA8B,OAAA;AAC9B,qHAAA,0BAA0B,OAAA;AAC1B,8HAAA,mCAAmC,OAAA;AACnC,wHAAA,6BAA6B,OAAA;AAC7B,+HAAA,oCAAoC,OAAA;AACpC,0HAAA,+BAA+B,OAAA;AAC/B,oIAAA,yCAAyC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1690925872592-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/1690925872592-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"1690925872592-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/1690925872592-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAiG3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAsD3D"}
|
|
@@ -26,7 +26,7 @@ class CreateContacts1690925872592 {
|
|
|
26
26
|
yield queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
27
27
|
yield queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`);
|
|
28
28
|
yield queryRunner.query(`CREATE TYPE "public"."PartyOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
29
|
-
yield queryRunner.query(`CREATE TABLE "PartyType" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."PartyType_type_enum" NOT NULL, "origin" "public"."PartyOrigin_type_enum" NOT NULL
|
|
29
|
+
yield queryRunner.query(`CREATE TABLE "PartyType" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."PartyType_type_enum" NOT NULL, "origin" "public"."PartyOrigin_type_enum" NOT NULL, "name" character varying(255) NOT NULL, "description" character varying(255), "tenant_id" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"), CONSTRAINT "PK_PartyType_id" PRIMARY KEY ("id"))`);
|
|
30
30
|
yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
31
31
|
yield queryRunner.query(`CREATE TABLE "BaseContact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "legal_name" character varying(255), "display_name" character varying(255), "first_name" character varying(255), "middle_name" character varying(255), "last_name" character varying(255), "type" character varying NOT NULL, "party_id" uuid, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "PK_BaseContact_id" PRIMARY KEY ("id"))`);
|
|
32
32
|
yield queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
@@ -39,6 +39,9 @@ class CreateContacts1690925872592 {
|
|
|
39
39
|
yield queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
40
40
|
yield queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "contactId" TO "partyId"`);
|
|
41
41
|
yield queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" SET NOT NULL`);
|
|
42
|
+
yield queryRunner.query(`CREATE TYPE "public"."IdentityOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
43
|
+
yield queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "origin" "public"."IdentityOrigin_type_enum" DEFAULT 'EXTERNAL' NOT NULL`);
|
|
44
|
+
yield queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "origin" DROP DEFAULT`);
|
|
42
45
|
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
43
46
|
yield queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
44
47
|
yield queryRunner.query(`ALTER TABLE "BaseContact" ADD CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
@@ -64,8 +67,42 @@ class CreateContacts1690925872592 {
|
|
|
64
67
|
}
|
|
65
68
|
down(queryRunner) {
|
|
66
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" DROP CONSTRAINT "FK_BaseConfig_connection_id"`);
|
|
71
|
+
yield queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identity_id"`);
|
|
72
|
+
yield queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_partyId"`);
|
|
73
|
+
yield queryRunner.query(`ALTER TABLE "Party" DROP CONSTRAINT "FK_Party_party_type_id"`);
|
|
74
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP CONSTRAINT "FK_PhysicalAddress_partyId"`);
|
|
75
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP CONSTRAINT "FK_ElectronicAddress_partyId"`);
|
|
76
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_right_id"`);
|
|
77
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_left_id"`);
|
|
78
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" DROP CONSTRAINT "FK_BaseContact_party_id"`);
|
|
79
|
+
yield queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
80
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identity_id"`);
|
|
81
|
+
yield queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" DROP NOT NULL`);
|
|
82
|
+
yield queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "origin"`);
|
|
83
|
+
yield queryRunner.query(`DROP TYPE "public"."IdentityOrigin_type_enum"`);
|
|
84
|
+
yield queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "partyId" TO "contactId"`);
|
|
85
|
+
yield queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
86
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
87
|
+
yield queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
88
|
+
yield queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
89
|
+
yield queryRunner.query(`DROP TABLE "Party"`);
|
|
90
|
+
yield queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
91
|
+
yield queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
92
|
+
yield queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
93
|
+
yield queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
94
|
+
yield queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
95
|
+
yield queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
96
|
+
yield queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
97
|
+
yield queryRunner.query(`DROP TABLE "PartyType"`);
|
|
98
|
+
yield queryRunner.query(`DROP TYPE "public"."PartyOrigin_type_enum"`);
|
|
99
|
+
yield queryRunner.query(`DROP TYPE "public"."PartyType_type_enum"`);
|
|
100
|
+
yield queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
101
|
+
yield queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
102
|
+
yield queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
103
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
104
|
+
yield queryRunner.query(`CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "name" character varying(255), "alias" character varying(255), CONSTRAINT "PK_Contact_id" PRIMARY KEY ("id"))`);
|
|
105
|
+
yield queryRunner.query(`INSERT INTO "Contact"(id, uri, created_at, last_updated_at, name, alias) SELECT id, uri, created_at, last_updated_at, (SELECT legal_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id"), (SELECT display_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id") FROM "Party" WHERE party_type_id = '3875c12e-fdaa-4ef6-a340-c936e054b627'`);
|
|
69
106
|
});
|
|
70
107
|
}
|
|
71
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1690925872592-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1690925872592-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yDAAoE;AAEpE,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"1690925872592-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1690925872592-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yDAAoE;AAEpE,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;IAyJtC,CAAC;IAvJc,EAAE,CAAC,WAAwB;;YACtC,MAAM,IAAA,0CAA2B,EAAC,WAAW,CAAC,CAAA;YAC9C,MAAM,WAAW,CAAC,KAAK,CAAC,2FAA2F,CAAC,CAAA;YACpH,MAAM,WAAW,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAA;YAC1G,MAAM,WAAW,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAA;YACzF,MAAM,WAAW,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAA;YAC9F,MAAM,WAAW,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAA;YAC1G,MAAM,WAAW,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAA;YAC/F,MAAM,WAAW,CAAC,KAAK,CAAC,qFAAqF,CAAC,CAAA;YAC9G,MAAM,WAAW,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAA;YACvG,MAAM,WAAW,CAAC,KAAK,CACrB,6eAA6e,CAC9e,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,yFAAyF,CAAC,CAAA;YAClH,MAAM,WAAW,CAAC,KAAK,CACrB,0kBAA0kB,CAC3kB,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YACxF,MAAM,WAAW,CAAC,KAAK,CACrB,iSAAiS,CAClS,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,uGAAuG,CAAC,CAAA;YA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,WAAW,CAAC,KAAK,CACrB,uTAAuT,CACxT,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,8WAA8W,CAC/W,CAAA;QACH,CAAC;KAAA;CACF;AA1JD,kEA0JC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreateContacts1710438363001 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=1710438363001-CreateContacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1710438363001-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/1710438363001-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA6B3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA4B3D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreateContacts1710438363001 = void 0;
|
|
13
|
+
class CreateContacts1710438363001 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'CreateContacts1710438363001';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" uuid`);
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" uuid`);
|
|
21
|
+
yield queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "owner_id" uuid`);
|
|
22
|
+
yield queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "tenant_id" uuid`);
|
|
23
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" uuid`);
|
|
24
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" uuid`);
|
|
25
|
+
yield queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" uuid`);
|
|
26
|
+
yield queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" uuid`);
|
|
27
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" uuid`);
|
|
28
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" uuid`);
|
|
29
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" uuid`);
|
|
30
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" uuid`);
|
|
31
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" uuid`);
|
|
32
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" uuid`);
|
|
33
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" uuid`);
|
|
34
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" uuid`);
|
|
35
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" uuid`);
|
|
36
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" uuid`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
down(queryRunner) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`);
|
|
42
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`);
|
|
43
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`);
|
|
44
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`);
|
|
45
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
46
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
47
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
48
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
49
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
50
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
51
|
+
yield queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
52
|
+
yield queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
53
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
54
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
55
|
+
yield queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
56
|
+
yield queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
57
|
+
yield queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
58
|
+
yield queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.CreateContacts1710438363001 = CreateContacts1710438363001;
|
|
63
|
+
//# sourceMappingURL=1710438363001-CreateContacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1710438363001-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1710438363001-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;IA2DtC,CAAC;IAzDc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;YACzE,MAAM,WAAW,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;YAE1E,MAAM,WAAW,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAA;YAC5E,MAAM,WAAW,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAA;YAE7E,MAAM,WAAW,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAA;YACzF,MAAM,WAAW,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAA;YAE1F,MAAM,WAAW,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAA;YAC9E,MAAM,WAAW,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAA;YAE/E,MAAM,WAAW,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAA;YAC9E,MAAM,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AA;YAE1E,MAAM,WAAW,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YACtF,MAAM,WAAW,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAA;YAErF,MAAM,WAAW,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;YACzE,MAAM,WAAW,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAA;YAExE,MAAM,WAAW,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;YACtE,MAAM,WAAW,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAA;QACvE,CAAC;KAAA;CACF;AA5DD,kEA4DC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreateContacts1715761125001 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=1715761125001-CreateContacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1715761125001-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/1715761125001-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAmB3D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreateContacts1715761125001 = void 0;
|
|
13
|
+
class CreateContacts1715761125001 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'CreateContacts1715761125001';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
// Upgrade IdentityMetadata table
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
21
|
+
yield queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
22
|
+
(
|
|
23
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
24
|
+
"label" character varying(255) NOT NULL,
|
|
25
|
+
"valueType" character varying NOT NULL,
|
|
26
|
+
"stringValue" text,
|
|
27
|
+
"numberValue" double precision,
|
|
28
|
+
"dateValue" TIMESTAMP,
|
|
29
|
+
"boolValue" boolean,
|
|
30
|
+
"identityId" uuid,
|
|
31
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
32
|
+
)`);
|
|
33
|
+
yield queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
34
|
+
SELECT "id", "label", 'string', "value", "identityId"
|
|
35
|
+
FROM "temporary_IdentityMetadata"`);
|
|
36
|
+
yield queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
37
|
+
// Create new ContactMetadata table
|
|
38
|
+
yield queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
39
|
+
(
|
|
40
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
41
|
+
"label" character varying(255) NOT NULL,
|
|
42
|
+
"valueType" character varying NOT NULL,
|
|
43
|
+
"stringValue" text,
|
|
44
|
+
"numberValue" double precision,
|
|
45
|
+
"dateValue" TIMESTAMP,
|
|
46
|
+
"boolValue" boolean,
|
|
47
|
+
"contactId" uuid,
|
|
48
|
+
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
49
|
+
)`);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
down(queryRunner) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
// Drop the ContactMetadata table
|
|
55
|
+
yield queryRunner.query(`DROP TABLE "ContactMetadata"`);
|
|
56
|
+
// Restore the IdentityMetadata table
|
|
57
|
+
yield queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
58
|
+
yield queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
59
|
+
(
|
|
60
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
61
|
+
"label" character varying(255) NOT NULL,
|
|
62
|
+
"value" character varying(255) NOT NULL,
|
|
63
|
+
"identityId" uuid,
|
|
64
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
65
|
+
)`);
|
|
66
|
+
yield queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
67
|
+
SELECT "id", "label", "stringValue", "identityId"
|
|
68
|
+
FROM "temporary_IdentityMetadata"`);
|
|
69
|
+
yield queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.CreateContacts1715761125001 = CreateContacts1715761125001;
|
|
74
|
+
//# sourceMappingURL=1715761125001-CreateContacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1715761125001-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1715761125001-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;IAwDtC,CAAC;IAtDc,EAAE,CAAC,WAAwB;;YACtC,iCAAiC;YACjC,MAAM,WAAW,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAA;YAChG,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;;;+BAWG,CAAC,CAAA;YAC5B,MAAM,WAAW,CAAC,KAAK,CAAC;;+DAEmC,CAAC,CAAA;YAC5D,MAAM,WAAW,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAA;YAElE,mCAAmC;YACnC,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;;;+BAWG,CAAC,CAAA;QAC9B,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACxC,iCAAiC;YACjC,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;YAEvD,qCAAqC;YACrC,MAAM,WAAW,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAA;YAChG,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;+BAOG,CAAC,CAAA;YAC5B,MAAM,WAAW,CAAC,KAAK,CAAC;;+DAEmC,CAAC,CAAA;YAC5D,MAAM,WAAW,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAA;QACpE,CAAC;KAAA;CACF;AAzDD,kEAyDC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreatePresentationDefinitions1716475165345 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=1716475165345-CreatePresentationDefinitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1716475165345-CreatePresentationDefinitions.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,0CAA2C,YAAW,kBAAkB;IACnF,IAAI,SAA+C;IAEtC,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreatePresentationDefinitions1716475165345 = void 0;
|
|
13
|
+
class CreatePresentationDefinitions1716475165345 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'CreatePresentationDefinitions1716475165345';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`
|
|
20
|
+
CREATE TABLE "PresentationDefinitionItem" (
|
|
21
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
22
|
+
"tenant_id" TEXT,
|
|
23
|
+
"definition_id" TEXT NOT NULL,
|
|
24
|
+
"name" TEXT,
|
|
25
|
+
"version" TEXT NOT NULL,
|
|
26
|
+
"purpose" TEXT,
|
|
27
|
+
"definition_payload" TEXT NOT NULL,
|
|
28
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
29
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
30
|
+
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
31
|
+
`);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
down(queryRunner) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.CreatePresentationDefinitions1716475165345 = CreatePresentationDefinitions1716475165345;
|
|
41
|
+
//# sourceMappingURL=1716475165345-CreatePresentationDefinitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1716475165345-CreatePresentationDefinitions.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,0CAA0C;IAAvD;QACE,SAAI,GAAG,4CAA4C,CAAA;IAqBrD,CAAC;IAnBc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;;;;2CAYe,CAAC,CAAA;QAC1C,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACxC,MAAM,WAAW,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAA;QACpE,CAAC;KAAA;CACF;AAtBD,gGAsBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1690925872693-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/sqlite/1690925872693-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"1690925872693-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/sqlite/1690925872693-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0J3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAoE3D"}
|
|
@@ -20,6 +20,7 @@ class CreateContacts1690925872693 {
|
|
|
20
20
|
yield queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
21
21
|
yield queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
22
22
|
yield queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
23
|
+
// roles not null
|
|
23
24
|
yield queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"))`);
|
|
24
25
|
yield queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`);
|
|
25
26
|
yield queryRunner.query(`DROP TABLE "Identity"`);
|
|
@@ -32,6 +33,7 @@ class CreateContacts1690925872693 {
|
|
|
32
33
|
yield queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
33
34
|
yield queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
34
35
|
yield queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
36
|
+
// contactId -> partyId
|
|
35
37
|
yield queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"))`);
|
|
36
38
|
yield queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`);
|
|
37
39
|
yield queryRunner.query(`DROP TABLE "Identity"`);
|
|
@@ -40,7 +42,7 @@ class CreateContacts1690925872693 {
|
|
|
40
42
|
yield queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
41
43
|
yield queryRunner.query(`DROP TABLE "Connection"`);
|
|
42
44
|
yield queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
43
|
-
yield queryRunner.query(`CREATE TABLE "PartyType" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('naturalPerson','organization') ) NOT NULL, "origin" varchar CHECK( "origin" IN ('INTERNAL', 'EXTERNAL') ) NOT NULL
|
|
45
|
+
yield queryRunner.query(`CREATE TABLE "PartyType" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('naturalPerson','organization') ) NOT NULL, "origin" varchar CHECK( "origin" IN ('INTERNAL', 'EXTERNAL') ) NOT NULL, "name" varchar(255) NOT NULL, "description" varchar(255), "tenant_id" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"))`);
|
|
44
46
|
yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
45
47
|
yield queryRunner.query(`CREATE TABLE "BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"))`);
|
|
46
48
|
yield queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
@@ -71,6 +73,7 @@ class CreateContacts1690925872693 {
|
|
|
71
73
|
yield queryRunner.query(`INSERT INTO "temporary_Party"("id", "uri", "created_at", "last_updated_at", "party_type_id") SELECT "id", "uri", "created_at", "last_updated_at", "party_type_id" FROM "Party"`);
|
|
72
74
|
yield queryRunner.query(`DROP TABLE "Party"`);
|
|
73
75
|
yield queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
76
|
+
// Restore lost FK_Identity_partyId
|
|
74
77
|
yield queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"), CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
75
78
|
yield queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "partyId" FROM "Identity"`);
|
|
76
79
|
yield queryRunner.query(`DROP TABLE "Identity"`);
|
|
@@ -97,8 +100,42 @@ class CreateContacts1690925872693 {
|
|
|
97
100
|
}
|
|
98
101
|
down(queryRunner) {
|
|
99
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
yield queryRunner.query(`CREATE TABLE "Contact" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar(255), "alias" varchar(255))`);
|
|
104
|
+
yield queryRunner.query(`INSERT INTO "Contact"(id, uri, created_at, last_updated_at, name, alias) SELECT id, uri, created_at, last_updated_at, (SELECT legal_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id"), (SELECT display_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id") FROM "Party" WHERE party_type_id = '3875c12e-fdaa-4ef6-a340-c936e054b627'`);
|
|
105
|
+
yield queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
106
|
+
yield queryRunner.query(`DROP TABLE "Party"`);
|
|
107
|
+
yield queryRunner.query(`CREATE TABLE "BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connectionId" varchar)`);
|
|
108
|
+
yield queryRunner.query(`INSERT INTO "BaseConfigEntity"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
109
|
+
yield queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
110
|
+
yield queryRunner.query(`CREATE TABLE "temporary_Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL, CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)`);
|
|
111
|
+
yield queryRunner.query(`INSERT INTO "temporary_Party"("id", "uri", "created_at", "last_updated_at", "party_type_id") SELECT "id", "uri", "created_at", "last_updated_at", "party_type_id" FROM "Party"`);
|
|
112
|
+
yield queryRunner.query(`DROP TABLE "Party"`);
|
|
113
|
+
yield queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
114
|
+
yield queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
115
|
+
yield queryRunner.query(`CREATE TABLE "temporary_PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
116
|
+
yield queryRunner.query(`INSERT INTO "temporary_PartyRelationship"("id", "left_id", "right_id", "created_at", "last_updated_at") SELECT "id", "left_id", "right_id", "created_at", "last_updated_at" FROM "PartyRelationship"`);
|
|
117
|
+
yield queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
118
|
+
yield queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
119
|
+
yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
120
|
+
yield queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
121
|
+
yield queryRunner.query(`CREATE TABLE "temporary_BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
122
|
+
yield queryRunner.query(`INSERT INTO "temporary_BaseContact"("id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id") SELECT "id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id" FROM "BaseContact"`);
|
|
123
|
+
yield queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
124
|
+
yield queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
125
|
+
yield queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
126
|
+
yield queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
127
|
+
yield queryRunner.query(`CREATE TABLE "temporary_BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
128
|
+
yield queryRunner.query(`INSERT INTO "temporary_BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
129
|
+
yield queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
130
|
+
yield queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
131
|
+
yield queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
132
|
+
yield queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
133
|
+
yield queryRunner.query(`DROP TABLE "PartyType"`);
|
|
134
|
+
yield queryRunner.query(`DROP TABLE "Connection"`);
|
|
135
|
+
yield queryRunner.query(`DROP TABLE "Identity"`);
|
|
136
|
+
yield queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
137
|
+
yield queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
138
|
+
yield queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
102
139
|
});
|
|
103
140
|
}
|
|
104
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1690925872693-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/sqlite/1690925872693-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"1690925872693-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/sqlite/1690925872693-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;IAgOtC,CAAC;IA9Nc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CACrB,6VAA6V,CAC9V,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,8KAA8K,CAC/K,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAA;YAC7D,MAAM,WAAW,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAA;YAC1G,iBAAiB;YACjB,MAAM,WAAW,CAAC,KAAK,CACrB,4TAA4T,CAC7T,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,oMAAoM,CACrM,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;YAChD,MAAM,WAAW,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;YAChF,MAAM,WAAW,CAAC,KAAK,CACrB,8OAA8O,CAC/O,CAAA;YAC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AinB,CAClnB,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,oUAAoU,CACrU,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACnD,MAAM,WAAW,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YACtF,MAAM,WAAW,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAExF,MAAM,WAAW,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;YAC3D,MAAM,WAAW,CAAC,KAAK,CACrB,4kBAA4kB,CAC7kB,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,0bAA0b,CAC3b,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;YAClD,MAAM,WAAW,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAA;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAEtF,MAAM,WAAW,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;YACpE,MAAM,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;YACjD,MAAM,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;YAClD,MAAM,WAAW,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;YAChD,MAAM,WAAW,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAA;YAC7D,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;YACzD,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACzD,CAAC;KAAA;CACF;AAjOD,kEAiOC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreateContacts1710438363002 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=1710438363002-CreateContacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1710438363002-CreateContacts.d.ts","sourceRoot":"","sources":["../../../src/migrations/sqlite/1710438363002-CreateContacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,2BAA4B,YAAW,kBAAkB;IACpE,IAAI,SAAgC;IAEvB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAiD3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA4B3D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreateContacts1710438363002 = void 0;
|
|
13
|
+
class CreateContacts1710438363002 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'CreateContacts1710438363002';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" text`);
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" text`);
|
|
21
|
+
// Add owner_id, tenant_id & origin
|
|
22
|
+
yield queryRunner.query(`CREATE TABLE "temporary_Identity" (
|
|
23
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
24
|
+
"alias" varchar(255) NOT NULL,
|
|
25
|
+
"roles" text NOT NULL,
|
|
26
|
+
"origin" text NOT NULL,
|
|
27
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
28
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
29
|
+
"partyId" varchar,
|
|
30
|
+
"owner_id" text,
|
|
31
|
+
"tenant_id" text,
|
|
32
|
+
CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"),
|
|
33
|
+
CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
|
34
|
+
)`);
|
|
35
|
+
yield queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId", "owner_id", "tenant_id", "origin")
|
|
36
|
+
SELECT "id", "alias", "roles", 'EXTERNAL' as "origin", "created_at", "last_updated_at", "partyId", NULL as "owner_id", NULL as "tenant_id" FROM "Identity"`);
|
|
37
|
+
yield queryRunner.query(`DROP TABLE "Identity"`);
|
|
38
|
+
yield queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
39
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" text`);
|
|
40
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" text`);
|
|
41
|
+
yield queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" text`);
|
|
42
|
+
yield queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" text`);
|
|
43
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" text`);
|
|
44
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" text`);
|
|
45
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" text`);
|
|
46
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" text`);
|
|
47
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" text`);
|
|
48
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" text`);
|
|
49
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" text`);
|
|
50
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" text`);
|
|
51
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" text`);
|
|
52
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" text`);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
down(queryRunner) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`);
|
|
58
|
+
yield queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`);
|
|
59
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`);
|
|
60
|
+
yield queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`);
|
|
61
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
62
|
+
yield queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
63
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
64
|
+
yield queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
65
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
66
|
+
yield queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
67
|
+
yield queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
68
|
+
yield queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
69
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
70
|
+
yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
71
|
+
yield queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
72
|
+
yield queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
73
|
+
yield queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
74
|
+
yield queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.CreateContacts1710438363002 = CreateContacts1710438363002;
|
|
79
|
+
//# sourceMappingURL=1710438363002-CreateContacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1710438363002-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/sqlite/1710438363002-CreateContacts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,2BAA2B;IAAxC;QACE,SAAI,GAAG,6BAA6B,CAAA;IA+EtC,CAAC;IA7Ec,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;YACzE,MAAM,WAAW,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;YAE1E,mCAAmC;YACnC,MAAM,WAAW,CAAC,KAAK,CACrB;;;;;;;;;;;;WAY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